commit | 30f3745e42780f4ee84c5193b002e5462a7b6c8c | [log] [tgz] |
---|---|---|
author | Bhasker Hariharan <bhaskerh@google.com> | Wed Aug 14 14:33:11 2019 -0700 |
committer | gVisor bot <gvisor-bot@google.com> | Wed Aug 14 14:33:39 2019 -0700 |
tree | 874c41d9585d16d0b0a68d650190b23963d8f5ef | |
parent | cf5a2be90ed2ae6ee7ebda794d1a71fe6164bb30 [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
Netstack is a network stack written in Go.
Try it out on Linux by installing the tun_tcp_echo demo:
go install github.com/google/netstack/tcpip/sample/tun_tcp_echo
Create a TUN device with:
[sudo] ip tuntap add user <username> mode tun <device-name> [sudo] ip link set <device-name> up [sudo] ip addr add <ipv4-address>/<mask-length> dev <device-name>
Then run with:
tun_tcp_echo <device-name> <ipv4-address> <port>
Please see CONTRIBUTING.md for more details.
Netstack is primarily developed as part of gVisor and any issues/bugs should be filed against the gVisor repository as this repo is not actively monitored for bug reports.
This is not an official Google product (experimental or otherwise), it is just code that happens to be owned by Google.