Skip to content
This repository has been archived by the owner on May 4, 2018. It is now read-only.

uv_accept should take optional sockaddr #1193

Open
tjfontaine opened this issue Mar 12, 2014 · 3 comments
Open

uv_accept should take optional sockaddr #1193

tjfontaine opened this issue Mar 12, 2014 · 3 comments
Assignees

Comments

@tjfontaine
Copy link
Contributor

we should be able to fill out the peer information by default when accepting a socket, and avoid where possible the extra syscall

@saghul
Copy link
Contributor

saghul commented Mar 13, 2014

For Windows we'll need to use GetAcceptExSockaddrs after AcceptEx, apparently. http://msdn.microsoft.com/en-us/library/windows/desktop/ms738516%28v=vs.85%29.aspx

@indutny
Copy link
Contributor

indutny commented Mar 14, 2014

There are subtle problems with this, though it is still feasible. In fact, we are accepting new sockets ahead of time on unixes (in both IPC pipes and TCP server), and uv_accept() is technically are pop() equivalent on internal list of incoming sockets. On a bright side, only one socket is queued for TCP server, but even in case of that we'll need to allocate space for sockaddr_storage in order to be able to fetch with accept() syscall.

@saghul
Copy link
Contributor

saghul commented Mar 14, 2014

Sure, we'll need to look into that. IIRC Windows does a similar trick. I just had a quick look and I was curious about how this would work on Windows, so I left a note :-)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants