Branch: refs/heads/blead Home: https://github.com/Perl/perl5 Commit: 17e4de6a25c1ce35029ae916bd2bdb6ef045f0f5 https://github.com/Perl/perl5/commit/17e4de6a25c1ce35029ae916bd2bdb6ef045f0f5 Author: Bram <perl...@wizbit.be> Date: 2022-09-05 (Mon, 05 Sep 2022)
Changed paths: M t/io/socket.t Log Message: ----------- io/socket.t: Use SO_SNDBUF instead of SO_RCVBUF The test was checking the return value of `getsockopt(..., SO_RCVBUF)` after setting it with `setsockopt(..., SO_RCVBUF, $i)`. The values the test accepted: - '$i' - '2 * $i' The '2 * $i' is because Linux doubles the size of the buffer.[^1] On OmniOS(/SmartOS/Solaris?) it also treats the SO_RCVBUF special.. Apparently: - when using g++: it returns '$i' - when using gcc: the value depends on the 'tcp_mss_def_ipv4' setting.[^2]. By default this is 536 so the value it returns is: '536 * ceil($i / 536)' (with a minimum of 'tcp_recv_hiwat_minmss' (=4) * 'tcp_mss_def_ipv4' (=536) It doesn't seem to do anything special for `SO_SNDBUF` so let's use that in the test instead. (Tested on: Linux (gcc), Windows 10 (gcc), OmniOS (gcc,g++), FreeBSD (gcc).) Fixes #20188 [^1]: https://www.cs.helsinki.fi/linux/linux-kernel/2001-30/0880.html [^2]: https://github.com/TritonDataCenter/illumos-joyent/blob/master/usr/src/stand/lib/tcp/tcp.c#L7034 ``` case SOL_SOCKET: { switch (option) { case SO_RCVBUF: ... val = MSS_ROUNDUP(val, tcp->tcp_mss); ``` (with thanks to @wolfsage for that link)