-
-
Save bnoordhuis/8ecfddd74773a016c893 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/deps/uv/include/uv-private/uv-unix.h b/deps/uv/include/uv-private/uv-unix.h | |
index b7f01ae..3d53f76 100644 | |
--- a/deps/uv/include/uv-private/uv-unix.h | |
+++ b/deps/uv/include/uv-private/uv-unix.h | |
@@ -99,7 +99,8 @@ typedef int uv_file; | |
ngx_queue_t write_completed_queue; \ | |
int delayed_error; \ | |
uv_connection_cb connection_cb; \ | |
- int accepted_fd; | |
+ int accepted_fd; \ | |
+ int dead; | |
/* UV_TCP */ | |
diff --git a/deps/uv/src/unix/core.c b/deps/uv/src/unix/core.c | |
index 8569eae..8518ae2 100644 | |
--- a/deps/uv/src/unix/core.c | |
+++ b/deps/uv/src/unix/core.c | |
@@ -92,6 +92,7 @@ void uv_close(uv_handle_t* handle, uv_close_cb close_cb) { | |
case UV_TCP: | |
stream = (uv_stream_t*)handle; | |
+ stream->dead = 1; | |
uv_read_stop(stream); | |
ev_io_stop(stream->loop->ev, &stream->write_watcher); | |
diff --git a/deps/uv/src/unix/pipe.c b/deps/uv/src/unix/pipe.c | |
index 6f1d816..4a6e828 100644 | |
--- a/deps/uv/src/unix/pipe.c | |
+++ b/deps/uv/src/unix/pipe.c | |
@@ -37,6 +37,7 @@ int uv_pipe_init(uv_loop_t* loop, uv_pipe_t* handle) { | |
handle->type = UV_NAMED_PIPE; | |
handle->pipe_fname = NULL; /* Only set by listener. */ | |
+ handle->dead = 0; | |
ev_init(&handle->write_watcher, uv__stream_io); | |
ev_init(&handle->read_watcher, uv__stream_io); | |
diff --git a/deps/uv/src/unix/stream.c b/deps/uv/src/unix/stream.c | |
index c6aa56c..c258b66 100644 | |
--- a/deps/uv/src/unix/stream.c | |
+++ b/deps/uv/src/unix/stream.c | |
@@ -265,6 +265,7 @@ static uv_write_t* uv__write(uv_stream_t* stream) { | |
ssize_t n; | |
assert(stream->fd >= 0); | |
+ assert(!stream->dead); | |
/* TODO: should probably while(1) here until EAGAIN */ | |
diff --git a/deps/uv/src/unix/tcp.c b/deps/uv/src/unix/tcp.c | |
index fb402e7..0e1682c 100644 | |
--- a/deps/uv/src/unix/tcp.c | |
+++ b/deps/uv/src/unix/tcp.c | |
@@ -38,6 +38,7 @@ int uv_tcp_init(uv_loop_t* loop, uv_tcp_t* tcp) { | |
ngx_queue_init(&tcp->write_queue); | |
ngx_queue_init(&tcp->write_completed_queue); | |
tcp->write_queue_size = 0; | |
+ tcp->dead = 0; | |
ev_init(&tcp->read_watcher, uv__stream_io); | |
tcp->read_watcher.data = tcp; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment