unix: move uv_shutdown() assertion
Allows uv_shutdown() to return an error as intended if the stream has already been closed. Fixes #972, refs JuliaLang/julia#4229.
This commit is contained in:
parent
ee434b3069
commit
fb36c09966
@ -1092,7 +1092,6 @@ static void uv__read(uv_stream_t* stream) {
|
||||
int uv_shutdown(uv_shutdown_t* req, uv_stream_t* stream, uv_shutdown_cb cb) {
|
||||
assert((stream->type == UV_TCP || stream->type == UV_NAMED_PIPE) &&
|
||||
"uv_shutdown (unix) only supports uv_handle_t right now");
|
||||
assert(uv__stream_fd(stream) >= 0);
|
||||
|
||||
if (!(stream->flags & UV_STREAM_WRITABLE) ||
|
||||
stream->flags & UV_STREAM_SHUT ||
|
||||
@ -1101,6 +1100,8 @@ int uv_shutdown(uv_shutdown_t* req, uv_stream_t* stream, uv_shutdown_cb cb) {
|
||||
return -ENOTCONN;
|
||||
}
|
||||
|
||||
assert(uv__stream_fd(stream) >= 0);
|
||||
|
||||
/* Initialize request */
|
||||
uv__req_init(stream->loop, req, UV_SHUTDOWN);
|
||||
req->handle = stream;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user