summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/p2p.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/p2p.cpp b/src/p2p.cpp
index 9a5e186..72bc26b 100644
--- a/src/p2p.cpp
+++ b/src/p2p.cpp
@@ -93,6 +93,11 @@ int zmq::p2p_t::xsend (zmq_msg_t *msg_, int flags_)
outpipe->write (msg_);
if (!(flags_ & ZMQ_NOFLUSH))
outpipe->flush ();
+
+ // Detach the original message from the data buffer.
+ int rc = zmq_msg_init (msg_);
+ zmq_assert (rc == 0);
+
return 0;
}