Navigation Menu

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

Commit

Permalink
unix: fix close-before-connect bug
Browse files Browse the repository at this point in the history
Closing the TCP socket before the SYN/ACK handshake completed hung the event
loop, the connect req didn't get unregistered.
  • Loading branch information
bnoordhuis committed May 17, 2012
1 parent e10a87a commit e82d464
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/unix/stream.c
Expand Up @@ -129,6 +129,13 @@ void uv__stream_destroy(uv_stream_t* stream) {

assert(stream->flags & UV_CLOSED);

if (stream->connect_req) {
uv__req_unregister(stream->loop, stream->connect_req);
uv__set_artificial_error(stream->loop, UV_EINTR);
stream->connect_req->cb(stream->connect_req, -1);
stream->connect_req = NULL;
}

while (!ngx_queue_empty(&stream->write_queue)) {
q = ngx_queue_head(&stream->write_queue);
ngx_queue_remove(q);
Expand Down

0 comments on commit e82d464

Please sign in to comment.