diff options
author | gVisor bot <gvisor-bot@google.com> | 2020-11-19 05:28:06 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-11-19 05:28:06 +0000 |
commit | 317cc02865c2b8f184688a852dce0ed0bdb19c20 (patch) | |
tree | d087e9c172195b98e05eeb925a0900e376689579 /pkg/tcpip/transport/tcp/endpoint.go | |
parent | 3f09108ecd49e1c40544d593b145ee6a6815717c (diff) | |
parent | e5650d124032e38a26e4b8058778e1c5b5aacbf0 (diff) |
Merge release-20201109.0-84-ge5650d124 (automated)
Diffstat (limited to 'pkg/tcpip/transport/tcp/endpoint.go')
-rw-r--r-- | pkg/tcpip/transport/tcp/endpoint.go | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/pkg/tcpip/transport/tcp/endpoint.go b/pkg/tcpip/transport/tcp/endpoint.go index f893324c2..9c9f1ab87 100644 --- a/pkg/tcpip/transport/tcp/endpoint.go +++ b/pkg/tcpip/transport/tcp/endpoint.go @@ -851,7 +851,6 @@ func (e *endpoint) recentTimestamp() uint32 { // +stateify savable type keepalive struct { sync.Mutex `state:"nosave"` - enabled bool idle time.Duration interval time.Duration count int @@ -1643,6 +1642,11 @@ func (e *endpoint) OnReusePortSet(v bool) { e.UnlockUser() } +// OnKeepAliveSet implements tcpip.SocketOptionsHandler.OnKeepAliveSet. +func (e *endpoint) OnKeepAliveSet(v bool) { + e.notifyProtocolGoroutine(notifyKeepaliveChanged) +} + // SetSockOptBool sets a socket option. func (e *endpoint) SetSockOptBool(opt tcpip.SockOptBool, v bool) *tcpip.Error { switch opt { @@ -1669,12 +1673,6 @@ func (e *endpoint) SetSockOptBool(opt tcpip.SockOptBool, v bool) *tcpip.Error { e.sndWaker.Assert() } - case tcpip.KeepaliveEnabledOption: - e.keepalive.Lock() - e.keepalive.enabled = v - e.keepalive.Unlock() - e.notifyProtocolGoroutine(notifyKeepaliveChanged) - case tcpip.QuickAckOption: o := uint32(1) if v { @@ -1980,6 +1978,13 @@ func (e *endpoint) readyReceiveSize() (int, *tcpip.Error) { return e.rcvBufUsed, nil } +// IsListening implements tcpip.SocketOptionsHandler.IsListening. +func (e *endpoint) IsListening() bool { + e.LockUser() + defer e.UnlockUser() + return e.EndpointState() == StateListen +} + // GetSockOptBool implements tcpip.Endpoint.GetSockOptBool. func (e *endpoint) GetSockOptBool(opt tcpip.SockOptBool) (bool, *tcpip.Error) { switch opt { @@ -1990,13 +1995,6 @@ func (e *endpoint) GetSockOptBool(opt tcpip.SockOptBool) (bool, *tcpip.Error) { case tcpip.DelayOption: return atomic.LoadUint32(&e.delay) != 0, nil - case tcpip.KeepaliveEnabledOption: - e.keepalive.Lock() - v := e.keepalive.enabled - e.keepalive.Unlock() - - return v, nil - case tcpip.QuickAckOption: v := atomic.LoadUint32(&e.slowAck) == 0 return v, nil @@ -2016,12 +2014,6 @@ func (e *endpoint) GetSockOptBool(opt tcpip.SockOptBool) (bool, *tcpip.Error) { case tcpip.MulticastLoopOption: return true, nil - case tcpip.AcceptConnOption: - e.LockUser() - defer e.UnlockUser() - - return e.EndpointState() == StateListen, nil - default: return false, tcpip.ErrUnknownProtocolOption } |