server: clarify event subscription uses 9P client connection context

This commit is contained in:
Levi Neely 2026-10-06 13:37:56 +02:00
parent 43d3051a78
commit 63e7ed5c65
1 changed files with 4 additions and 2 deletions

View File

@ -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