mirror of
https://github.com/XTLS/Xray-core.git
synced 2026-07-05 11:18:37 +00:00
XHTTP/3 client: Actively close underlying QUIC & UDP (#6332)
Fixes https://github.com/XTLS/Xray-core/issues/6328#issuecomment-4730379021
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
"net/http/httptrace"
|
||||
"sync"
|
||||
|
||||
"github.com/apernet/quic-go/http3"
|
||||
"github.com/xtls/xray-core/common"
|
||||
"github.com/xtls/xray-core/common/buf"
|
||||
"github.com/xtls/xray-core/common/errors"
|
||||
@@ -176,6 +177,15 @@ func (c *DefaultDialerClient) PostPacket(ctx context.Context, url string, sessio
|
||||
return nil
|
||||
}
|
||||
|
||||
// HTTP/1.1 and HTTP/2 will close itself, we only handle HTTP/3 here
|
||||
func (c *DefaultDialerClient) Close() error {
|
||||
transport := c.client.Transport
|
||||
if h3Transport, ok := transport.(*http3.Transport); ok {
|
||||
h3Transport.Close()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type WaitReadCloser struct {
|
||||
Wait chan struct{}
|
||||
io.ReadCloser
|
||||
|
||||
Reference in New Issue
Block a user