summaryrefslogtreecommitdiff
path: root/src/zmq_decoder.cpp
diff options
context:
space:
mode:
authormalosek <malosek@fastmq.com>2009-09-15 09:44:44 +0200
committermalosek <malosek@fastmq.com>2009-09-15 09:44:44 +0200
commit364281343ce0fd03b25bc6b1b451ee7ba8db436b (patch)
tree32cd09900e2ecdc31d6a8f2a47a68fe128980169 /src/zmq_decoder.cpp
parentbdf22e9c2fe82366283f4edc02fd59c37fdb2c4b (diff)
parentf7ad4a203ad184d97002111f4ffb8bfe6a8f7c01 (diff)
Merge branch 'master' of git@github.com:sustrik/zeromq2
Diffstat (limited to 'src/zmq_decoder.cpp')
-rw-r--r--src/zmq_decoder.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/zmq_decoder.cpp b/src/zmq_decoder.cpp
index e51d802..53811a1 100644
--- a/src/zmq_decoder.cpp
+++ b/src/zmq_decoder.cpp
@@ -20,6 +20,7 @@
#include "zmq_decoder.hpp"
#include "i_inout.hpp"
#include "wire.hpp"
+#include "err.hpp"
zmq::zmq_decoder_t::zmq_decoder_t () :
destination (NULL)
@@ -48,7 +49,11 @@ bool zmq::zmq_decoder_t::one_byte_size_ready ()
if (*tmpbuf == 0xff)
next_step (tmpbuf, 8, &zmq_decoder_t::eight_byte_size_ready);
else {
- zmq_msg_init_size (&in_progress, *tmpbuf);
+
+ // TODO: Handle over-sized message decently.
+ int rc = zmq_msg_init_size (&in_progress, *tmpbuf);
+ errno_assert (rc == 0);
+
next_step (zmq_msg_data (&in_progress), *tmpbuf,
&zmq_decoder_t::message_ready);
}
@@ -60,7 +65,11 @@ bool zmq::zmq_decoder_t::eight_byte_size_ready ()
// 8-byte size is read. Allocate the buffer for message body and
// read the message data into it.
size_t size = (size_t) get_uint64 (tmpbuf);
- zmq_msg_init_size (&in_progress, size);
+
+ // TODO: Handle over-sized message decently.
+ int rc = zmq_msg_init_size (&in_progress, size);
+ errno_assert (rc == 0);
+
next_step (zmq_msg_data (&in_progress), size,
&zmq_decoder_t::message_ready);
return true;