diff options
author | Fedor Indutny <fedor@indutny.com> | 2016-06-03 13:08:52 -0400 |
---|---|---|
committer | Fedor Indutny <fedor@indutny.com> | 2016-06-03 13:08:52 -0400 |
commit | 1d9649b1ae65b2b119b01a376f5c232982af1b89 (patch) | |
tree | ffa3522623560797d61ee3ca2c0146d2694b3480 /src/uv_link_t.c | |
parent | fe32ad3b58bffda1cb6e2b436e8cba64a4c6ba65 (diff) | |
download | uv_link_t-1d9649b1ae65b2b119b01a376f5c232982af1b89.tar.gz |
src: experiment fix
Diffstat (limited to 'src/uv_link_t.c')
-rw-r--r-- | src/uv_link_t.c | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/src/uv_link_t.c b/src/uv_link_t.c index a3359cb..32fa6c9 100644 --- a/src/uv_link_t.c +++ b/src/uv_link_t.c @@ -85,25 +85,22 @@ void uv_link_close(uv_link_t* link, uv_link_close_cb cb) { } +static void uv_link_close_join(uv_link_t* link) { + if (--link->close_waiting == 0) + return link->saved_close_cb(link); +} + + void uv_link_maybe_close(uv_link_t* link) { - uv_link_close_cb cb; uv_link_t* source; - if (link->pending_close_cb == NULL) + if (link->pending_close_source == NULL) return; - cb = link->pending_close_cb; source = link->pending_close_source; - link->pending_close_cb = NULL; link->pending_close_source = NULL; - return uv_link_propagate_close(link, source, cb); -} - - -static void uv_link_close_join(uv_link_t* link) { - if (--link->close_waiting == 0) - return link->saved_close_cb(link); + link->methods->close(link, source, uv_link_close_join); } @@ -134,12 +131,10 @@ 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"); - if (root->close_depth == 0) { + if (root->close_depth == 0) root->methods->close(root, source, uv_link_close_join); - } else { - root->pending_close_cb = uv_link_close_join; + else root->pending_close_source = source; - } root = child; } } |