fix callback hell

pull/655/head
Rick V 5 years ago
parent a346f0d279
commit 042baf9270
No known key found for this signature in database
GPG Key ID: C0EDC8723FDC3465

@ -202,6 +202,7 @@ namespace libuv
llarp::LogDebug("close tcp connection");
uv_timer_stop(&m_Ticker);
uv_close((uv_handle_t*)&m_Handle, &OnClosed);
OnClosed((uv_handle_t*)&m_Handle);
}
static void
@ -381,6 +382,7 @@ namespace libuv
{
uv_check_stop(&m_Ticker);
uv_close((uv_handle_t*)&m_Handle, &OnClosed);
OnClosed((uv_handle_t*)&m_Handle);
}
};
@ -453,6 +455,9 @@ namespace libuv
Close()
{
uv_close((uv_handle_t*)&m_Handle, &OnClosed);
// It seems that the event loop stops before we get around to the callback (!!!)
// so call the function
OnClosed((uv_handle_t*)&m_Handle);
}
bool

Loading…
Cancel
Save