diff options
author | Bhasker Hariharan <bhaskerh@google.com> | 2020-06-01 09:56:52 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-06-01 10:29:47 -0700 |
commit | 839208f118793c665f48a057d1f35d74979b7916 (patch) | |
tree | c47711c1f618cf6dbc7ca401c77512344d7340c0 /pkg/tcpip | |
parent | a9b47390c821942d60784e308f681f213645049c (diff) |
Enable TCP Receive buffer moderation in gonet and benchmark.
Fixes #1666
PiperOrigin-RevId: 314148384
Diffstat (limited to 'pkg/tcpip')
-rw-r--r-- | pkg/tcpip/adapters/gonet/gonet.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/pkg/tcpip/adapters/gonet/gonet.go b/pkg/tcpip/adapters/gonet/gonet.go index 6e0db2741..d82ed5205 100644 --- a/pkg/tcpip/adapters/gonet/gonet.go +++ b/pkg/tcpip/adapters/gonet/gonet.go @@ -335,6 +335,11 @@ func (c *TCPConn) Read(b []byte) (int, error) { deadline := c.readCancel() numRead := 0 + defer func() { + if numRead != 0 { + c.ep.ModerateRecvBuf(numRead) + } + }() for numRead != len(b) { if len(c.read) == 0 { var err error |