Split the status summary into per-section helpers and scope retrackConn to service mode

This commit is contained in:
Viktor Liu
2026-08-27 19:49:39 +02:00
parent 2e1a0bde9a
commit e426401941
3 changed files with 203 additions and 167 deletions
+11
View File
@@ -294,3 +294,14 @@ func dialAgentWithRetry(ctx context.Context, addr string) (net.Conn, error) {
}
return nil, lastErr
}
// retrackConn replaces a tracked raw connection with the wrapper its handler
// will actually hold, so shutdown and the handler's own untrackConn agree on
// which object is registered. Service mode only: that is where an accepted
// connection is wrapped before the handler sees it.
func (s *Server) retrackConn(raw, wrapped net.Conn) {
s.sessionsMu.Lock()
delete(s.acceptedConns, raw)
s.acceptedConns[wrapped] = struct{}{}
s.sessionsMu.Unlock()
}
-10
View File
@@ -459,16 +459,6 @@ func (s *Server) trackConn(c net.Conn) {
s.sessionsMu.Unlock()
}
// retrackConn replaces a tracked raw connection with the wrapper its handler
// will actually hold, so shutdown and the handler's own untrackConn agree on
// which object is registered.
func (s *Server) retrackConn(raw, wrapped net.Conn) {
s.sessionsMu.Lock()
delete(s.acceptedConns, raw)
s.acceptedConns[wrapped] = struct{}{}
s.sessionsMu.Unlock()
}
// untrackConn forgets a connection once its handler is returning.
func (s *Server) untrackConn(c net.Conn) {
s.sessionsMu.Lock()