aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2011-07-06 14:02:55 -0700
committerRyan Dahl <ry@tinyclouds.org>2011-07-08 15:22:40 -0700
commit0df2f74d364826053641395b01c2fcb1345057a9 (patch)
tree61afd5e84b0c5e66a7cc4844ab64d6eaca46eb99 /src
parent19f248400f55eb26c306eab733ff6de12070dcd4 (diff)
downloadandroid-node-v8-0df2f74d364826053641395b01c2fcb1345057a9.tar.gz
android-node-v8-0df2f74d364826053641395b01c2fcb1345057a9.tar.bz2
android-node-v8-0df2f74d364826053641395b01c2fcb1345057a9.zip
Add several asserts to tcp_wrap
OnAlloc and OnConnection should not be occurring after uv_close was called on the handle.
Diffstat (limited to 'src')
-rw-r--r--src/tcp_wrap.cc20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/tcp_wrap.cc b/src/tcp_wrap.cc
index 125b880cf4..50b584adc8 100644
--- a/src/tcp_wrap.cc
+++ b/src/tcp_wrap.cc
@@ -206,9 +206,13 @@ class TCPWrap {
HandleScope scope;
TCPWrap* wrap = static_cast<TCPWrap*>(handle->data);
-
assert(&wrap->handle_ == (uv_tcp_t*)handle);
+ // We should not be getting this callback if someone as already called
+ // uv_close() on the handle. Since we've destroyed object_ at the same
+ // time as calling uv_close() we can test for this here.
+ assert(wrap->object_.IsEmpty() == false);
+
if (status != 0) {
// TODO Handle server error (call onerror?)
assert(0);
@@ -315,6 +319,11 @@ class TCPWrap {
TCPWrap* wrap = static_cast<TCPWrap*>(handle->data);
+ // We should not be getting this callback if someone as already called
+ // uv_close() on the handle. Since we've destroyed object_ at the same
+ // time as calling uv_close() we can test for this here.
+ assert(wrap->object_.IsEmpty() == false);
+
// Remove the reference to the slab to avoid memory leaks;
Local<Value> slab_v = wrap->object_->GetHiddenValue(slab_sym);
wrap->object_->SetHiddenValue(slab_sym, v8::Null());
@@ -370,6 +379,9 @@ class TCPWrap {
HandleScope scope;
+ // The request object should still be there.
+ assert(req_wrap->object_.IsEmpty() == false);
+
if (status) {
SetErrno(uv_last_error().code);
}
@@ -439,6 +451,9 @@ class TCPWrap {
HandleScope scope;
+ // The request object should still be there.
+ assert(req_wrap->object_.IsEmpty() == false);
+
if (status) {
SetErrno(uv_last_error().code);
}
@@ -512,6 +527,9 @@ class TCPWrap {
ReqWrap* req_wrap = (ReqWrap*) req->data;
TCPWrap* wrap = (TCPWrap*) req->handle->data;
+ // The request object should still be there.
+ assert(req_wrap->object_.IsEmpty() == false);
+
HandleScope scope;
if (status) {