diff options
author | Ian Gudger <igudger@google.com> | 2018-10-31 18:41:48 -0700 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2018-10-31 18:42:44 -0700 |
commit | 59b7766af7c78f330d09044e68bb195e495993ea (patch) | |
tree | 8d729c85ec5c2755cafe50846c54a2b36dd80693 /pkg/tcpip/transport/tcp/connect.go | |
parent | eeddae1199d9b84ee84011be0019328724ebdcf3 (diff) |
Fix a race where keepalives could be sent while there is pending data
PiperOrigin-RevId: 219571556
Change-Id: I5a1042c1cb05eb2711eb01627fd298bad6c543a6
Diffstat (limited to 'pkg/tcpip/transport/tcp/connect.go')
-rw-r--r-- | pkg/tcpip/transport/tcp/connect.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/pkg/tcpip/transport/tcp/connect.go b/pkg/tcpip/transport/tcp/connect.go index 800d2409e..965779a68 100644 --- a/pkg/tcpip/transport/tcp/connect.go +++ b/pkg/tcpip/transport/tcp/connect.go @@ -829,6 +829,13 @@ func (e *endpoint) resetKeepaliveTimer(receivedData bool) { } } +// disableKeepaliveTimer stops the keepalive timer. +func (e *endpoint) disableKeepaliveTimer() { + e.keepalive.Lock() + e.keepalive.timer.disable() + e.keepalive.Unlock() +} + // protocolMainLoop is the main loop of the TCP protocol. It runs in its own // goroutine and is responsible for sending segments and handling received // segments. |