Closed iyermi closed 4 years ago
Just to record what was discussed. The new behaviour mirrors linux, I believe the old behaviour was incorrect. eg. Linux behaviour is here https://code.woboq.org/linux/linux/net/ipv4/tcp.c.html#2249 and it matches what is now implemented in Netstack.
I would recommend introducing a separate counter. In terms of TCP, ESTABLISHED is a specific state and this counter is meant to track connections in that state. The shutdown states are considered connected states but not Established.
With the recent changes, I see that TCP CurrentEstablished counter decrements soon after transition from Established state. This is problematic because: (1) The TCP connection can still be active (behave as established) and be receiving data even after transition from StateEstablished. (2) With the current behavior, an active TCP connection would not be accounted for by any of the stats up until it transitions to StateClose.
Suggest to decrement this counter only when we transition to StateClose from StateLastAck or StateTimeWait. This was the older behavior. OR we can introduce a new counter to track all active TCP connections (previously established) that are not yet closed.