TUN inbound: Cancel ctx when handling is done (#5565)

https://github.com/XTLS/Xray-core/pull/5565#issuecomment-3777939907

---------

Co-authored-by: RPRX <63339210+RPRX@users.noreply.github.com>
This commit is contained in:
patterniha
2026-01-21 16:28:30 +03:30
committed by GitHub
parent 66628943d8
commit e813a3744f

View File

@@ -106,8 +106,9 @@ func (t *Handler) HandleConnection(conn net.Conn, destination net.Destination) {
// to close, send completion packets back to the network, and cleanup
defer conn.Close()
sid := session.NewID()
ctx := c.ContextWithID(t.ctx, sid)
ctx, cancel := context.WithCancel(t.ctx)
defer cancel()
ctx = c.ContextWithID(ctx, session.NewID())
source := net.DestinationFromAddr(conn.RemoteAddr())
inbound := session.Inbound{