fs/session: restore normal blocking semantics for statewait

statewait is a blocking wait file with a 5-second timeout, not an
indefinite long-block stream like chat. Remove LongBlock=true so the
9P server uses the normal blocking path (WithTimeout 5s) instead of
WithCancel-only behavior.

Also remove temporary statewait debug instrumentation.
This commit is contained in:
Ollie Agent 2026-08-01 21:45:39 +02:00
parent d12cebe40e
commit c5285ac259
2 changed files with 4 additions and 3 deletions

View File

@ -876,6 +876,10 @@ func (s *Server) read(cs *connState, fc *plan9.Fcall, ctx context.Context) *plan
return errFcall(fc, err.Error())
}
if strings.HasSuffix(path, "/statewait") {
s.log.Debug("statewait read path=%q isBlocking=%v longBlock=%v oneShot=%v", path, entry.IsBlocking(), entry.LongBlock(), entry.OneShot())
}
// OneShot entries yield data once per open; offset>0 means EOF.
if entry.OneShot() && fc.Offset > 0 {
return &plan9.Fcall{Type: plan9.Rread, Tag: fc.Tag, Count: 0}

View File

@ -367,14 +367,11 @@ func (h *agentHelper) fileSpec(name string, mode os.FileMode) FileSpec {
if base == "" {
base = h.ag.State()
}
h.log.Debug("statewait: begin base=%q ag=%q", base, h.ag.Name())
v, ok := h.ag.WaitChange(ctx, agent.WatchState, base)
if !ok {
s := h.ag.State()
h.log.Debug("statewait: !ok returning state=%q", s)
return []byte(s + "\n"), s, nil
}
h.log.Debug("statewait: ok returning state=%q", v)
return []byte(v + "\n"), v, nil
}
}