Compare commits

..

2 Commits

Author SHA1 Message Date
Fangliding ba8157f2f1 Handle usage on packet-up switch 2026-05-11 15:07:56 +08:00
Fangliding 1c4f3ec598 Use hKeepAlivePeriod for xhttp3 if not specified in quicParams 2026-05-11 14:53:00 +08:00
2 changed files with 4 additions and 2 deletions
-2
View File
@@ -71,7 +71,6 @@ func (c *DefaultDialerClient) OpenStream(ctx context.Context, url string, sessio
errors.LogInfoInner(ctx, err, "failed to "+method+" "+url)
}
gotConn.Close()
common.Close(body)
wrc.Close()
return
}
@@ -81,7 +80,6 @@ func (c *DefaultDialerClient) OpenStream(ctx context.Context, url string, sessio
if resp.StatusCode != 200 || uploadOnly { // stream-up
io.Copy(io.Discard, resp.Body)
resp.Body.Close() // if it is called immediately, the upload will be interrupted also
common.Close(body)
wrc.Close()
return
}
+4
View File
@@ -183,6 +183,8 @@ func createHTTPClient(dest net.Destination, streamSettings *internet.MemoryStrea
if quicParams.KeepAlivePeriod == 0 {
if keepAlivePeriod == 0 {
quicConfig.KeepAlivePeriod = net.QuicgoH3KeepAlivePeriod
} else if keepAlivePeriod > 0 {
quicConfig.KeepAlivePeriod = keepAlivePeriod
}
}
if quicParams.MaxIncomingStreams == 0 {
@@ -542,7 +544,9 @@ func Dial(ctx context.Context, dest net.Destination, streamSettings *internet.Me
if xmuxClient != nil && (xmuxClient.LeftRequests.Add(-1) <= 0 ||
(xmuxClient.UnreusableAt != time.Time{} && lastWrite.After(xmuxClient.UnreusableAt))) {
xmuxClient.OpenUsage.Add(-1)
httpClient, xmuxClient = getHTTPClient(ctx, dest, streamSettings)
xmuxClient.OpenUsage.Add(1)
}
go func() {