diff options
author | Fedor Indutny <fedor@indutny.com> | 2016-06-03 13:06:06 -0400 |
---|---|---|
committer | Fedor Indutny <fedor@indutny.com> | 2016-06-03 13:06:06 -0400 |
commit | 106064e3968df9702ca9841f00703be9736a00bb (patch) | |
tree | 96f09c5f508ee3056f393c96436149d3c2c17aed /src/uv_link_t.c | |
parent | 1c8f4ad0972cdcac8f9c3a5408380f8fa19392f8 (diff) | |
download | uv_link_t-106064e3968df9702ca9841f00703be9736a00bb.tar.gz |
src: more experiments
Diffstat (limited to 'src/uv_link_t.c')
-rw-r--r-- | src/uv_link_t.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/uv_link_t.c b/src/uv_link_t.c index 9058b55..59b5fa7 100644 --- a/src/uv_link_t.c +++ b/src/uv_link_t.c @@ -87,14 +87,17 @@ void uv_link_close(uv_link_t* link, uv_link_close_cb cb) { void uv_link_maybe_close(uv_link_t* link) { uv_link_close_cb cb; + uv_link_t* source; - if (link->saved_close_cb == NULL) + if (link->pending_close_cb == NULL) return; - cb = link->saved_close_cb; + cb = link->pending_close_cb; + source = link->pending_close_source; - link->saved_close_cb = NULL; - return uv_link_propagate_close(link, link, cb); + link->pending_close_cb = NULL; + link->pending_close_source = NULL; + return uv_link_propagate_close(link, source, cb); } @@ -139,7 +142,12 @@ void uv_link_propagate_close(uv_link_t* link, uv_link_t* source, if (child != NULL) CHECK_EQ(uv_link_unchain(root, child), 0, "close unchain"); - root->methods->close(root, source, uv_link_close_join); + if (root->close_depth == 0) { + root->methods->close(root, source, uv_link_close_join); + } else { + root->pending_close_cb = uv_link_close_join; + root->pending_close_source = source; + } root = child; } } |