server: clarify event subscription uses 9P client connection context
This commit is contained in:
parent
43d3051a78
commit
63e7ed5c65
|
|
@ -602,7 +602,9 @@ func read(root *fs.Tree, cs *connState, fc *plan9.Fcall, ctx context.Context) *p
|
|||
if path == "event" {
|
||||
cs.mu.RLock()
|
||||
f, fidOK := cs.fids[fc.Fid]
|
||||
connCtx := cs.ctx // Use connection context, not request context
|
||||
// Use 9P connection context (not request context) so subscription
|
||||
// lives until the client disconnects or clunks the fid
|
||||
clientConnCtx := cs.ctx
|
||||
cs.mu.RUnlock()
|
||||
if fidOK {
|
||||
f.mu.Lock()
|
||||
|
|
@ -615,7 +617,7 @@ func read(root *fs.Tree, cs *connState, fc *plan9.Fcall, ctx context.Context) *p
|
|||
if filter == "" {
|
||||
filter = "*"
|
||||
}
|
||||
subCtx, cancel := context.WithCancel(connCtx)
|
||||
subCtx, cancel := context.WithCancel(clientConnCtx)
|
||||
ch := session.SubscribeEventsFiltered(subCtx, filter)
|
||||
f.mu.Lock()
|
||||
f.eventFilter = filter
|
||||
|
|
|
|||
Loading…
Reference in New Issue