clean up poll handle data in close() function so that assert() won't fail

This commit is contained in:
Konstantin Käfer
2014-11-06 13:21:46 +01:00
parent 0480c10f90
commit 01d4cdbb02

View File

@@ -134,6 +134,8 @@ public:
}
void stop() {
assert(poll_handle.data);
poll_handle.data = nullptr;
uv_poll_stop(&poll_handle);
uv_close((uv_handle_t *)&poll_handle, [](uv_handle_t *handle) {
delete (Socket *)handle->data;
@@ -141,7 +143,7 @@ public:
}
private:
// Make the destructor private to ensure that ew can only close the Socket
// Make the destructor private to ensure that we can only close the Socket
// with stop(), and disallow manual deletion.
~Socket() {
assert(!poll_handle.data);