From 67a6594fc02f8df80647ff1690624cbe2c7b1287 Mon Sep 17 00:00:00 2001 From: laplaceyang Date: Fri, 2 Jun 2017 11:36:41 +0800 Subject: [PATCH] fix bug: coredump if set linger and immediate together In function session_base_t::reconnect, if we set immediate to 1 and set linger, we will get into first block of reconnect function, and set pipe to NULL, but we forget to cancel timer of linger. Once timer tiggered, we will get coredump. Solution: cancel timer in the end of set pipe to NULL --- src/session_base.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/session_base.cpp b/src/session_base.cpp index 29e8d509..aa8dd633 100644 --- a/src/session_base.cpp +++ b/src/session_base.cpp @@ -506,6 +506,11 @@ void zmq::session_base_t::reconnect () pipe->terminate (false); terminating_pipes.insert (pipe); pipe = NULL; + + if (has_linger_timer) { + cancel_timer (linger_timer_id); + has_linger_timer = false; + } } reset ();