diff options
author | Bhasker Hariharan <bhaskerh@google.com> | 2019-08-14 14:33:11 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2019-08-14 14:34:27 -0700 |
commit | 570fb1db6b4e01be37386a379fea4d63e5a3cdc2 (patch) | |
tree | 44cd127ffaa546b3f0c9bc1b642fe8980e69bbd9 /pkg/sentry/socket/epsocket/stack.go | |
parent | cee044c2ab009c9faae154e1751eef93430fc141 (diff) |
Improve SendMsg performance.
SendMsg before this change would copy all the data over into a
new slice even if the underlying socket could only accept a
small amount of data. This is really inefficient with non-blocking
sockets and under high throughput where large writes could get
ErrWouldBlock or if there was say a timeout associated with the sendmsg()
syscall.
With this change we delay copying bytes in till they are needed and only
copy what can be potentially sent/held in the socket buffer. Reducing
the need to repeatedly copy data over.
Also a minor fix to change state FIN-WAIT-1 when shutdown(..., SHUT_WR) is called
instead of when we transmit the actual FIN. Otherwise the socket could remain in
CONNECTED state even though the user has called shutdown() on the socket.
Updates #627
PiperOrigin-RevId: 263430505
Diffstat (limited to 'pkg/sentry/socket/epsocket/stack.go')
0 files changed, 0 insertions, 0 deletions