Commit d8edfb0
Count TCP server connections in the public stats (#219)
server_stats_.connections_active and connections_total are supposed
to track accepted connections on the server, but ConnectionImpl only
raises ConnectionEvent::Connected on the client-side connect-completion
path, never for server-accepted sockets. The per-connection lifecycle
adapter therefore never fired the Connected branch of
onConnectionLifecycleEvent, and the counters stayed at 0 on connect.
The matching decrement on RemoteClose/LocalClose still ran, so after
the first client disconnect connections_active wrapped the uint64 to
UINT64_MAX.
Bump the counters directly in onNewConnection, which is the
server-side checkpoint where the socket is accepted, the filter chain
is built, and the call runs on the dispatcher thread. The symmetric
decrement in onConnectionLifecycleEvent also runs on that thread, so
the stats stay consistent without extra synchronization.
Remove the dead Connected/ConnectedZeroRtt increment branch from
onConnectionLifecycleEvent to keep one canonical increment site --
otherwise a future change that did raise Connected for server
connections would quietly double-count.
The stdio path is unaffected: McpConnectionManager still raises
Connected through ServerProtocolCallbacks::onConnectionEvent, which
routes to the separate McpServer::onConnectionEvent handler and keeps
its own increment.1 parent af8ca80 commit d8edfb0
1 file changed
Lines changed: 20 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
818 | 818 | | |
819 | 819 | | |
820 | 820 | | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
821 | 828 | | |
822 | 829 | | |
823 | 830 | | |
824 | | - | |
825 | | - | |
826 | 831 | | |
827 | 832 | | |
828 | 833 | | |
| |||
1312 | 1317 | | |
1313 | 1318 | | |
1314 | 1319 | | |
1315 | | - | |
| 1320 | + | |
| 1321 | + | |
| 1322 | + | |
| 1323 | + | |
| 1324 | + | |
| 1325 | + | |
| 1326 | + | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
| 1330 | + | |
1316 | 1331 | | |
| 1332 | + | |
| 1333 | + | |
1317 | 1334 | | |
1318 | 1335 | | |
1319 | 1336 | | |
| |||
0 commit comments