diff --git a/src/net.h b/src/net.h index 1449eb6fb4..a3b9a24f61 100644 --- a/src/net.h +++ b/src/net.h @@ -128,7 +128,10 @@ protected: server_.on_connection = Server::on_connection; server_.data = this; } - virtual ~Server () { Close(); } + + virtual ~Server () { + oi_server_close (&server_); + } int Listen (struct addrinfo *address) { int r = oi_server_listen (&server_, address); @@ -138,7 +141,7 @@ protected: return 0; } - void Close ( ) { + void Close ( ) { oi_server_close (&server_); Detach(); } diff --git a/src/object_wrap.h b/src/object_wrap.h index b96fc364a6..4fcc304acd 100644 --- a/src/object_wrap.h +++ b/src/object_wrap.h @@ -55,6 +55,8 @@ class ObjectWrap { * the object after making this call as it might be gone! * (A "weak reference" is v8 terminology for an object that only has a * persistant handle.) + * + * DO NOT CALL THIS FROM DESTRUCTOR */ void Detach() { assert(!handle_.IsEmpty());