Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2016-04-26 14:32:44 +0300
committerBen Noordhuis <info@bnoordhuis.nl>2016-04-27 17:27:28 +0300
commita58d4839af6dfcb493ead8771cbff21b5ef9f18d (patch)
tree6d926fbecebc2b091087824728f680a568ebb17c /src/handle_wrap.h
parentcad1a62d325b011887349687962700dfe7510525 (diff)
src: simplify handlewrap state tracking logic
This also updates the tests to expect that a closed handle has no reference count. PR-URL: https://github.com/nodejs/node/pull/6395 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/handle_wrap.h')
-rw-r--r--src/handle_wrap.h8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/handle_wrap.h b/src/handle_wrap.h
index fe3c5a8d9dc..ef37cf9e341 100644
--- a/src/handle_wrap.h
+++ b/src/handle_wrap.h
@@ -38,15 +38,11 @@ class HandleWrap : public AsyncWrap {
static void Unrefed(const v8::FunctionCallbackInfo<v8::Value>& args);
static inline bool IsAlive(const HandleWrap* wrap) {
- // XXX(bnoordhuis) It's debatable whether only kInitialized should
- // count as alive but it's compatible with the check that it replaces.
- return wrap != nullptr && wrap->state_ == kInitialized;
+ return wrap != nullptr && wrap->state_ != kClosed;
}
static inline bool HasRef(const HandleWrap* wrap) {
- return wrap != nullptr &&
- wrap->state_ != kClosed &&
- uv_has_ref(wrap->GetHandle());
+ return IsAlive(wrap) && uv_has_ref(wrap->GetHandle());
}
inline uv_handle_t* GetHandle() const { return handle__; }