uv-unix: defer uv_pipe_connect callback to next tick
This commit is contained in:
parent
685c083c79
commit
332bbecd19
@ -877,6 +877,8 @@ static void uv__stream_io(EV_P_ ev_io* watcher, int revents) {
|
|||||||
if (stream->connect_req) {
|
if (stream->connect_req) {
|
||||||
uv__stream_connect(stream);
|
uv__stream_connect(stream);
|
||||||
} else {
|
} else {
|
||||||
|
assert(revents & (EV_READ | EV_WRITE));
|
||||||
|
|
||||||
if (revents & EV_READ) {
|
if (revents & EV_READ) {
|
||||||
uv__read((uv_stream_t*)stream);
|
uv__read((uv_stream_t*)stream);
|
||||||
}
|
}
|
||||||
@ -1909,15 +1911,16 @@ int uv_pipe_connect(uv_connect_t* req,
|
|||||||
status = 0;
|
status = 0;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
uv__req_init((uv_req_t*)req);
|
handle->delayed_error = status; /* Passed to callback. */
|
||||||
|
handle->connect_req = req;
|
||||||
req->handle = (uv_stream_t*)handle;
|
req->handle = (uv_stream_t*)handle;
|
||||||
req->type = UV_CONNECT;
|
req->type = UV_CONNECT;
|
||||||
req->cb = cb;
|
req->cb = cb;
|
||||||
ngx_queue_init(&req->queue);
|
ngx_queue_init(&req->queue);
|
||||||
|
|
||||||
if (cb) {
|
/* Run callback on next tick. */
|
||||||
cb(req, status);
|
ev_feed_event(EV_DEFAULT_ &handle->read_watcher, EV_CUSTOM);
|
||||||
}
|
assert(ev_is_pending(&handle->read_watcher));
|
||||||
|
|
||||||
/* Mimic the Windows pipe implementation, always
|
/* Mimic the Windows pipe implementation, always
|
||||||
* return 0 and let the callback handle errors.
|
* return 0 and let the callback handle errors.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user