From 6cc694d8c20d63379cbc9404c30ee24f8a0525f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90or=C4=91ije=20Manojlovi=C4=87?= Date: Fri, 28 Oct 2022 15:44:04 +0200 Subject: [PATCH] Problem: Handshake timeout error with ZMTP_2_0 When two parties are trying to establish ZMTP connection and do a handshake, in which one partie selects hanshake version 2 or lower has been selected, handshake timer fires always (by default after 30s) as the timer never gets cancelled. Solution: Cancel handshake timer after handhake has been done. --- src/stream_engine_base.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/stream_engine_base.cpp b/src/stream_engine_base.cpp index bb64e0db..b5ce18c9 100644 --- a/src/stream_engine_base.cpp +++ b/src/stream_engine_base.cpp @@ -255,8 +255,14 @@ bool zmq::stream_engine_base_t::in_event_internal () // Switch into the normal message flow. _handshaking = false; - if (_mechanism == NULL && _has_handshake_stage) + if (_mechanism == NULL && _has_handshake_stage) { _session->engine_ready (); + + if (_has_handshake_timer) { + cancel_timer (handshake_timer_id); + _has_handshake_timer = false; + } + } } else return false; }