From 1d431190f50c86f624605ab11c1580b2d2f7ee06 Mon Sep 17 00:00:00 2001 From: Nir Soffer Date: Sat, 2 Oct 2010 10:01:18 +0200 Subject: make sure that reader does not terminate in the middle of a multipart message --- AUTHORS | 1 + src/xrep.cpp | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/AUTHORS b/AUTHORS index 8ad7f5e..70d816a 100644 --- a/AUTHORS +++ b/AUTHORS @@ -30,6 +30,7 @@ Matus Hamorsky Max Wolf McClain Looney Mikael Helbo Kjaer +Nir Soffer Pavel Gushcha Pavol Malosek Pieter Hintjens diff --git a/src/xrep.cpp b/src/xrep.cpp index 96f991a..d45b8aa 100644 --- a/src/xrep.cpp +++ b/src/xrep.cpp @@ -101,6 +101,13 @@ void zmq::xrep_t::terminated (reader_t *pipe_) for (inpipes_t::iterator it = inpipes.begin (); it != inpipes.end (); it++) { if (it->reader == pipe_) { + if (inpipes [current_in].reader == pipe_) { + + // A reader is not allowed to terminate in the middle of a + // multipart message. + zmq_assert (!prefetched); + zmq_assert (!more_in); + } inpipes.erase (it); if (terminating) unregister_term_ack (); -- cgit v1.2.3