mirror of
https://github.com/netbirdio/netbird.git
synced 2026-10-01 02:59:08 +02:00
Split the status summary into per-section helpers and scope retrackConn to service mode
This commit is contained in:
@@ -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()
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user