mirror of
https://github.com/XTLS/Xray-core.git
synced 2026-05-08 14:13:22 +00:00
Close inbound conn
This commit is contained in:
@@ -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,
|
||||||
|
|||||||
@@ -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))
|
||||||
|
|||||||
Reference in New Issue
Block a user