commit | 034b968794aea0db3c8c88195437c9601f493d78 | [log] [tgz] |
---|---|---|
author | Tamir Duberstein <tamird@google.com> | Tue Jul 27 16:31:32 2021 +0000 |
committer | CQ Bot <commit-bot@chromium.org> | Tue Jul 27 16:31:32 2021 +0000 |
tree | bb0662c8a85906b4c709136fe8dcc36067f4622d | |
parent | 9bf43581afe8952e6aa3bfc4d278944662a3cc57 [diff] |
[netstack] Apply overhead factor before limits Fixes TCPSocketPairTest.SetTCPWindowClampBelowMinRcvBufConnectedSocket. See https://github.com/google/gvisor/blob/9a96e00/test/syscalls/linux/socket_ip_tcp_generic.cc#L1087 Change-Id: I45a312339ce0c326773a7099a9259472a165501c Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/560805 Fuchsia-Auto-Submit: Tamir Duberstein <tamird@google.com> Commit-Queue: Auto-Submit <auto-submit@fuchsia-infra.iam.gserviceaccount.com> Reviewed-by: Ghanan Gowripalan <ghanan@google.com>
diff --git a/src/connectivity/network/netstack/fuchsia_posix_socket.go b/src/connectivity/network/netstack/fuchsia_posix_socket.go index 96be70a..9c85c90 100644 --- a/src/connectivity/network/netstack/fuchsia_posix_socket.go +++ b/src/connectivity/network/netstack/fuchsia_posix_socket.go
@@ -516,13 +516,6 @@ { size := int64(size) - min, max := limits() - if size > max { - size = max - } - if size < min { - size = min - } // packetOverheadFactor is used to multiply the value provided by the user on // a setsockopt(2) for setting the send/receive buffer sizes sockets. @@ -532,6 +525,15 @@ } else { size *= packetOverheadFactor } + + min, max := limits() + if size > max { + size = max + } + if size < min { + size = min + } + set(size, true /* notify */) } }