ccommon
ccommon copied to clipboard
tcp_maximize_sndbuf behavior broken on Linux
I was writing a test for tcp_maximize_sndbuf
and it was easy on OS X, but it's current implementation makes no sense on Linux (Ubuntu).
The implementation does a binary search with these values:
134250496 0
201342976 0
234889216 0
251662336 0
260048896 0
264242176 0
266338816 0
267387136 0
267911296 0
268173376 0
268304416 0
268369936 0
268402696 0
268419076 0
268427266 0
268431361 0
268433409 0
268434433 0
268434945 0
268435201 0
268435329 0
268435393 0
268435425 0
268435441 0
268435449 0
268435453 0
268435455 0
268435456 0
The left column is the attempted value and the right column is the status
received. It can be seen that the status is always 0, meaning that setsockopt
never fails even if the value used is higher than the maximum value possible. Calling getsockopt at the end returns the value 425984
(at least on my machine), which is lower than any value attempted.
Should we set it to INT_MAX
instead of doing the binary search?