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: run pending shutdown cb when stream is closed
Browse files Browse the repository at this point in the history
  • Loading branch information
bnoordhuis committed Apr 12, 2012
1 parent 4f0ff3c commit a41016e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/unix/stream.c
Expand Up @@ -152,6 +152,14 @@ void uv__stream_destroy(uv_stream_t* stream) {
req->cb(req, req->error ? -1 : 0);
}
}

if (stream->flags & UV_SHUTTING) {
uv_shutdown_t* req = stream->shutdown_req;
if (req && req->cb) {
uv__set_artificial_error(stream->loop, UV_EINTR);
req->cb(req, -1);
}
}
}


Expand Down Expand Up @@ -291,6 +299,7 @@ static void uv__drain(uv_stream_t* stream) {
assert(stream->shutdown_req);

req = stream->shutdown_req;
stream->shutdown_req = NULL;

if (shutdown(stream->fd, SHUT_WR)) {
/* Error. Report it. User should call uv_close(). */
Expand Down

0 comments on commit a41016e

Please sign in to comment.