From 9a53f334d25c27416b84d94a2d40e74656135b50 Mon Sep 17 00:00:00 2001 From: Martin Hurton Date: Sun, 18 May 2014 08:49:29 +0200 Subject: [PATCH] Don't reconnect on protocol errors --- src/session_base.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/session_base.cpp b/src/session_base.cpp index f1b61d6f..074db2a3 100644 --- a/src/session_base.cpp +++ b/src/session_base.cpp @@ -376,10 +376,22 @@ void zmq::session_base_t::engine_error ( if (pipe) clean_pipes (); - if (active) - reconnect (); - else - terminate (); + zmq_assert (reason == stream_engine_t::connection_error + || reason == stream_engine_t::timeout_error + || reason == stream_engine_t::protocol_error); + + switch (reason) { + case stream_engine_t::timeout_error: + case stream_engine_t::connection_error: + if (active) + reconnect (); + else + terminate (); + break; + case stream_engine_t::protocol_error: + terminate (); + break; + } // Just in case there's only a delimiter in the pipe. if (pipe)