uv-unix: call uv__accept() instead of accept()

uv__accept() puts the socket in non-blocking close-on-exec mode,
accept() by itself does not.

Solves the case of the mysteriously hanging HTTP benchmarks.
This commit is contained in:
Ben Noordhuis 2011-07-21 02:13:02 +02:00
parent 332bbecd19
commit 66f936bfd7

View File

@ -405,7 +405,6 @@ static int uv__stream_open(uv_stream_t* stream, int fd) {
void uv__server_io(EV_P_ ev_io* watcher, int revents) {
int fd;
struct sockaddr_storage addr;
socklen_t addrlen = sizeof(struct sockaddr_storage);
uv_stream_t* stream = watcher->data;
assert(watcher == &stream->read_watcher ||
@ -421,7 +420,7 @@ void uv__server_io(EV_P_ ev_io* watcher, int revents) {
while (1) {
assert(stream->accepted_fd < 0);
fd = accept(stream->fd, (struct sockaddr*)&addr, &addrlen);
fd = uv__accept(stream->fd, (struct sockaddr*)&addr, sizeof addr);
if (fd < 0) {
if (errno == EAGAIN) {