Close inbound conn

This commit is contained in:
Fangliding
2026-05-08 00:36:18 +08:00
parent f7e6510199
commit 47cbf7fa3c
2 changed files with 3 additions and 1 deletions

View File

@@ -17,6 +17,7 @@ import (
func CopyPacketConn(ctx context.Context, inboundConn net.Conn, link *transport.Link, destination net.Destination, serverConn net.PacketConn) error { func CopyPacketConn(ctx context.Context, inboundConn net.Conn, link *transport.Link, destination net.Destination, serverConn net.PacketConn) error {
cancel := func() { cancel := func() {
common.Interrupt(link.Reader) common.Interrupt(link.Reader)
common.Interrupt(serverConn)
} }
conn := &PacketConnWrapper{ conn := &PacketConnWrapper{
Reader: link.Reader, Reader: link.Reader,

View File

@@ -24,7 +24,8 @@ func CopyConn(ctx context.Context, inboundConn net.Conn, link *transport.Link, s
conn.R = &buf.BufferedReader{Reader: link.Reader} conn.R = &buf.BufferedReader{Reader: link.Reader}
} }
cancel := func() { cancel := func() {
common.Interrupt(conn.R) common.Interrupt(link.Reader)
common.Interrupt(serverConn)
} }
conn.T = signal.CancelAfterInactivity(ctx, cancel, 300*time.Second) conn.T = signal.CancelAfterInactivity(ctx, cancel, 300*time.Second)
return ReturnError(bufio.CopyConn(ctx, conn, serverConn)) return ReturnError(bufio.CopyConn(ctx, conn, serverConn))