Skip to content

Commit 3168d27

Browse files
committed
Splice update timer to 8 hours
1 parent b98d060 commit 3168d27

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

proxy/proxy.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ func UnwrapRawConn(conn net.Conn) (net.Conn, stats.Counter, stats.Counter) {
470470
// CopyRawConnIfExist use the most efficient copy method.
471471
// - If caller don't want to turn on splice, do not pass in both reader conn and writer conn
472472
// - writer are from *transport.Link
473-
func CopyRawConnIfExist(ctx context.Context, readerConn net.Conn, writerConn net.Conn, writer buf.Writer, timer signal.ActivityUpdater) error {
473+
func CopyRawConnIfExist(ctx context.Context, readerConn net.Conn, writerConn net.Conn, writer buf.Writer, timer *signal.ActivityTimer) error {
474474
readerConn, readCounter, _ := UnwrapRawConn(readerConn)
475475
writerConn, _, writeCounter := UnwrapRawConn(writerConn)
476476
reader := buf.NewReader(readerConn)
@@ -509,6 +509,7 @@ func CopyRawConnIfExist(ctx context.Context, readerConn net.Conn, writerConn net
509509
statWriter, _ := writer.(*dispatcher.SizeStatWriter)
510510
//runtime.Gosched() // necessary
511511
time.Sleep(time.Millisecond) // without this, there will be a rare ssl error for freedom splice
512+
timer.SetTimeout(8 * time.Hour) // prevent leak, just in case
512513
w, err := tc.ReadFrom(readerConn)
513514
if readCounter != nil {
514515
readCounter.Add(w) // outbound stats

proxy/vless/encoding/encoding.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ func DecodeResponseHeader(reader io.Reader, request *protocol.RequestHeader) (*A
174174
}
175175

176176
// XtlsRead filter and read xtls protocol
177-
func XtlsRead(reader buf.Reader, writer buf.Writer, timer signal.ActivityUpdater, conn net.Conn, input *bytes.Reader, rawInput *bytes.Buffer, trafficState *proxy.TrafficState, ob *session.Outbound, ctx context.Context) error {
177+
func XtlsRead(reader buf.Reader, writer buf.Writer, timer *signal.ActivityTimer, conn net.Conn, input *bytes.Reader, rawInput *bytes.Buffer, trafficState *proxy.TrafficState, ob *session.Outbound, ctx context.Context) error {
178178
err := func() error {
179179
for {
180180
if trafficState.ReaderSwitchToDirectCopy {

0 commit comments

Comments
 (0)