From dbf211af10fe69c5185764b08496e35bdaf37aad Mon Sep 17 00:00:00 2001 From: Patrick Freeman <12616285+pfree@users.noreply.github.com> Date: Tue, 16 Jun 2020 17:47:46 -0400 Subject: [PATCH] Unset handler on disconnect This fixes a bug where uv_poll_stop was called twice on a handle. Explanation of the bug: In the OnDisconnect callback, it calls uv_poll_stop to stop watching the handle. Later, in OnConnect, it sees that the handle is non-NULL and calls uv_poll_stop again. --- LDAPCnx.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/LDAPCnx.cc b/LDAPCnx.cc index 4662fef..1ef0117 100644 --- a/LDAPCnx.cc +++ b/LDAPCnx.cc @@ -269,6 +269,7 @@ void LDAPCnx::OnDisconnect(LDAP *ld, Sockbuf *sb, LDAPCnx * lc = (LDAPCnx *)ctx->lc_arg; if (lc->handle) { uv_poll_stop(lc->handle); + lc->handle = NULL; } lc->disconnect_callback->Call(0, NULL); }