nix icon indicating copy to clipboard operation
nix copied to clipboard

Make accept() return a (fd, SockaddrLike) tuple

Open lk16 opened this issue 2 years ago • 1 comments
trafficstars

This PR addresses #1298.

On my machine 4 tests are failing, I don't understand what's the exact cause. Any suggestions how to fix them would be appreciated.

lk16 avatar Apr 15 '23 18:04 lk16

Maybe this should be a new function instead of a change to the signature of the original? That would be backwards-compatible too.

There is already a function that does this, getpeername(). But is a workaround, see also my post here.

Does every caller really want the peer's address? I think not.

Not every caller will be interested in the peer's address. But in my opinion the caller should decide if they want that information. Currently Nix making that decision and that doesn't seem right to me.

If it's not worth breaking backwards compatibility over this, then we can add some note to the documentation of accept() to suggest getpeername() if the caller is interested in the peer's address. I can make PR for that as well.

lk16 avatar Apr 16 '23 15:04 lk16