1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-04-10 07:45:54 -04:00

propagate context

This commit is contained in:
Shelikhoo
2020-06-18 12:37:10 +08:00
parent 73616ab9e2
commit 85bd352bc1
4 changed files with 9 additions and 2 deletions

View File

@@ -43,6 +43,8 @@ type tcpWorker struct {
downlinkCounter stats.Counter
hub internet.Listener
ctx context.Context
}
func getTProxyType(s *internet.MemoryStreamConfig) internet.SocketConfig_TProxyMode {
@@ -53,7 +55,7 @@ func getTProxyType(s *internet.MemoryStreamConfig) internet.SocketConfig_TProxyM
}
func (w *tcpWorker) callback(conn internet.Connection) {
ctx, cancel := context.WithCancel(context.Background())
ctx, cancel := context.WithCancel(w.ctx)
sid := session.NewID()
ctx = session.ContextWithID(ctx, sid)