From 8f8bfcaba0f0e827a2d034c76c5b498bbdf4e7e1 Mon Sep 17 00:00:00 2001 From: Mikko Koppanen Date: Tue, 13 Sep 2011 16:27:07 +0200 Subject: Fixed issue with req assertions (issue 252) Signed-off-by: Mikko Koppanen Signed-off-by: Martin Sustrik --- src/req.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/req.cpp') diff --git a/src/req.cpp b/src/req.cpp index 7831672..b3a9359 100644 --- a/src/req.cpp +++ b/src/req.cpp @@ -89,8 +89,13 @@ int zmq::req_t::xrecv (msg_t *msg_, int flags_) int rc = xreq_t::xrecv (msg_, flags_); if (rc != 0) return rc; - zmq_assert (msg_->flags () & msg_t::label); - zmq_assert (msg_->size () == 4); + + // TODO: This should also close the connection with the peer! + if (unlikely (!(msg_->flags () & msg_t::label) || msg_->size () != 4)) { + errno = EAGAIN; + return -1; + } + unsigned char *data = (unsigned char*) msg_->data (); if (unlikely (get_uint32 (data) != request_id)) { -- cgit v1.2.3