On Tue, Apr 23, 2024 at 07:50:10PM +0200, Stefano Brivio wrote: > On Sat, 20 Apr 2024 15:19:19 -0400 > Jon Maloy wrote: [snip] > > + set_peek_offset(s, 0); > > Do we really need to initialise it to zero on a new connection? Extra > system calls on this path matter for latency of connection > establishment. Sort of, yes: we need to enable the SO_PEEK_OFF behaviour by setting it to 0, rather than the default -1. We could lazily enable it, but we'd need either to a) do it later in the handshake (maybe when we set ESTABLISHED), but we'd need to be careful it is always set before the first MSG_PEEK or b) keep track of whether it's set on a per-socket basis (this would have the advantage of robustness if we ever encountered a kernel that weirdly allows it for some but not all TCP sockets). -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson