summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDhammika Pathirana <dhammika@gmail.com>2010-10-26 16:02:47 +0200
committerMartin Sustrik <sustrik@250bpm.com>2010-10-26 16:02:47 +0200
commit465da7b17eef4c86020a5def41a87977410b965a (patch)
tree151f30ee0e277cffefa1eceecdfb951ff72a383b /src
parent401986e6bb565f94d975acaba9504eb6ee3c8598 (diff)
drop connection requests with duplicate peer identity
Signed-off-by: Dhammika Pathirana <dhammika@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/session.cpp9
-rw-r--r--src/zmq_init.hpp2
2 files changed, 8 insertions, 3 deletions
diff --git a/src/session.cpp b/src/session.cpp
index f853d5a..98e3c49 100644
--- a/src/session.cpp
+++ b/src/session.cpp
@@ -231,6 +231,13 @@ void zmq::session_t::process_attach (i_engine *engine_,
return;
}
+ // If the session already has an engine attached, destroy new one.
+ // Note new engine is not plugged in yet, we don't have to unplug it.
+ if (engine) {
+ delete engine_;
+ return;
+ }
+
// Check whether the required pipes already exist. If not so, we'll
// create them and bind them to the socket object.
if (!pipes_attached) {
@@ -257,8 +264,6 @@ void zmq::session_t::process_attach (i_engine *engine_,
}
// Plug in the engine.
- zmq_assert (!engine);
- zmq_assert (engine_);
engine = engine_;
engine->plug (io_thread, this);
diff --git a/src/zmq_init.hpp b/src/zmq_init.hpp
index 6087de9..2233b7b 100644
--- a/src/zmq_init.hpp
+++ b/src/zmq_init.hpp
@@ -55,7 +55,7 @@ namespace zmq
void process_plug ();
void process_unplug ();
- // Associated wite-protocol engine.
+ // Associated wire-protocol engine.
i_engine *engine;
// True if our own identity was already sent to the peer.