summaryrefslogtreecommitdiff
path: root/community/zeromq/LIBZMQ-569.patch
blob: a1e27f622b506587b72e3b4f86cb318d9097bbdf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
From 7ecab54ac3b7a6103c46892990217acafb039eed Mon Sep 17 00:00:00 2001
From: Martin Hurton <hurtonm@gmail.com>
Date: Fri, 21 Jun 2013 16:23:38 +0200
Subject: [PATCH] Load identity message to decoder at start

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

diff --git a/src/stream_engine.cpp b/src/stream_engine.cpp
index 0d87581..2c07889 100644
--- a/src/stream_engine.cpp
+++ b/src/stream_engine.cpp
@@ -480,6 +480,13 @@ bool zmq::stream_engine_t::handshake ()
         //  header data away.
         const size_t header_size = options.identity_size + 1 >= 255 ? 10 : 2;
         unsigned char tmp [10], *bufferp = tmp;
+
+        //  Prepare the identity message and load it into encoder.
+        //  Then consume bytes we have already sent to the peer.
+        const int rc = tx_msg.init_size (options.identity_size);
+        zmq_assert (rc == 0);
+        memcpy (tx_msg.data (), options.identity, options.identity_size);
+        encoder->load_msg (&tx_msg);
         size_t buffer_size = encoder->encode (&bufferp, header_size);
         zmq_assert (buffer_size == header_size);
 
-- 
1.8.4