summaryrefslogtreecommitdiff
path: root/src/zmq_decoder.cpp
diff options
context:
space:
mode:
authormalosek <malosek@fastmq.com>2009-11-30 16:45:36 +0100
committermalosek <malosek@fastmq.com>2009-11-30 16:45:36 +0100
commitc637bf292d0dc97be5c94c5c96a033c2d665576c (patch)
treef6e82c3003ac1e4a646f588a7423d60c0e7dcc23 /src/zmq_decoder.cpp
parent9ccf2b42cf932b4c29ea20cc9c6e3d5d8e7a62b4 (diff)
parentfa1641afc593be5926e558381861112b584e861a (diff)
Merge branch 'master' of git@github.com:sustrik/zeromq2
Diffstat (limited to 'src/zmq_decoder.cpp')
-rw-r--r--src/zmq_decoder.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/zmq_decoder.cpp b/src/zmq_decoder.cpp
index 53811a1..8040f21 100644
--- a/src/zmq_decoder.cpp
+++ b/src/zmq_decoder.cpp
@@ -51,6 +51,9 @@ bool zmq::zmq_decoder_t::one_byte_size_ready ()
else {
// TODO: Handle over-sized message decently.
+ // in_progress is initialised at this point so in theory we should
+ // close it before calling zmq_msg_init_size, however, it's a 0-byte
+ // message and thus we can treat it as uninitialised...
int rc = zmq_msg_init_size (&in_progress, *tmpbuf);
errno_assert (rc == 0);
@@ -67,6 +70,9 @@ bool zmq::zmq_decoder_t::eight_byte_size_ready ()
size_t size = (size_t) get_uint64 (tmpbuf);
// TODO: Handle over-sized message decently.
+ // in_progress is initialised at this point so in theory we should
+ // close it before calling zmq_msg_init_size, however, it's a 0-byte
+ // message and thus we can treat it as uninitialised...
int rc = zmq_msg_init_size (&in_progress, size);
errno_assert (rc == 0);
@@ -78,7 +84,7 @@ bool zmq::zmq_decoder_t::eight_byte_size_ready ()
bool zmq::zmq_decoder_t::message_ready ()
{
// Message is completely read. Push it further and start reading
- // new message.
+ // new message. (in_progress is a 0-byte message after this point.)
if (!destination || !destination->write (&in_progress))
return false;