diff options
author | Jianfeng Tan <henry.tjf@antfin.com> | 2019-08-29 16:23:11 +0000 |
---|---|---|
committer | Jianfeng Tan <henry.tjf@antfin.com> | 2019-10-15 16:38:40 +0000 |
commit | aee2c93366f451b9cc0a62430185749556fc3900 (patch) | |
tree | 22aae176d3fe1cdc2ebc568a5d1a6d63e837c9be /pkg/tcpip/transport/tcp/accept.go | |
parent | dd7d1f825d2f6464b61287b3a324c13139b0d661 (diff) |
netstack: add counters for tcp CurrEstab and EstabResets
Signed-off-by: Jianfeng Tan <henry.tjf@antfin.com>
Diffstat (limited to 'pkg/tcpip/transport/tcp/accept.go')
-rw-r--r-- | pkg/tcpip/transport/tcp/accept.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/pkg/tcpip/transport/tcp/accept.go b/pkg/tcpip/transport/tcp/accept.go index 844959fa0..2b4c5c2f9 100644 --- a/pkg/tcpip/transport/tcp/accept.go +++ b/pkg/tcpip/transport/tcp/accept.go @@ -297,7 +297,10 @@ func (l *listenContext) createEndpointAndPerformHandshake(s *segment, opts *head return nil, err } ep.mu.Lock() - ep.state = StateEstablished + if ep.state != StateEstablished { + ep.stack.Stats().TCP.CurrentEstablished.Increment() + ep.state = StateEstablished + } ep.mu.Unlock() // Update the receive window scaling. We can't do it before the @@ -519,6 +522,7 @@ func (e *endpoint) handleListenSegment(ctx *listenContext, s *segment) { n.tsOffset = 0 // Switch state to connected. + n.stack.Stats().TCP.CurrentEstablished.Increment() n.state = StateEstablished // Do the delivery in a separate goroutine so |