From 20a7978d679c653eb58e67753f66feb19e55c001 Mon Sep 17 00:00:00 2001 From: Martin Hurton Date: Sat, 22 Jun 2013 08:11:55 +0200 Subject: [PATCH] Stop ZMTP handshake when an unexpected message comes --- src/curve_client.cpp | 3 ++- src/curve_server.cpp | 2 +- src/plain_mechanism.cpp | 3 ++- src/stream_engine.cpp | 2 -- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/curve_client.cpp b/src/curve_client.cpp index 40dd6b0b..fae7414d 100644 --- a/src/curve_client.cpp +++ b/src/curve_client.cpp @@ -88,8 +88,9 @@ int zmq::curve_client_t::process_handshake_message (msg_t *msg_) state = connected; break; default: - errno = EAGAIN; + errno = EPROTO; rc = -1; + break; } if (rc == 0) { rc = msg_->close (); diff --git a/src/curve_server.cpp b/src/curve_server.cpp index a60b4d8e..87e56706 100644 --- a/src/curve_server.cpp +++ b/src/curve_server.cpp @@ -98,7 +98,7 @@ int zmq::curve_server_t::process_handshake_message (msg_t *msg_) } break; default: - errno = EAGAIN; + errno = EPROTO; rc = -1; break; } diff --git a/src/plain_mechanism.cpp b/src/plain_mechanism.cpp index d09a4577..6d7b2f9e 100644 --- a/src/plain_mechanism.cpp +++ b/src/plain_mechanism.cpp @@ -109,8 +109,9 @@ int zmq::plain_mechanism_t::process_handshake_message (msg_t *msg_) state = ready; break; default: - errno = EAGAIN; + errno = EPROTO; rc = -1; + break; } if (rc == 0) { rc = msg_->close (); diff --git a/src/stream_engine.cpp b/src/stream_engine.cpp index 61533897..16404e05 100644 --- a/src/stream_engine.cpp +++ b/src/stream_engine.cpp @@ -599,8 +599,6 @@ int zmq::stream_engine_t::next_handshake_message (msg_t *msg_) if (rc == 0) { if (mechanism->is_handshake_complete ()) mechanism_ready (); - if (input_paused) - activate_in (); } return rc;