From 1d431190f50c86f624605ab11c1580b2d2f7ee06 Mon Sep 17 00:00:00 2001
From: Nir Soffer <nirsof@gmail.com>
Date: Sat, 2 Oct 2010 10:01:18 +0200
Subject: make sure that reader does not terminate in the middle of a multipart
 message

---
 src/xrep.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

(limited to 'src')

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