diff options
author | Mikko Koppanen <mkoppanen@php.net> | 2011-09-13 16:27:07 +0200 |
---|---|---|
committer | Martin Sustrik <sustrik@250bpm.com> | 2011-09-13 16:27:07 +0200 |
commit | 8f8bfcaba0f0e827a2d034c76c5b498bbdf4e7e1 (patch) | |
tree | 1507a259ddda1d0baeaed2a5d484deca14490955 /src | |
parent | e191e806ead4e8954e03612a4b385aff40871272 (diff) |
Fixed issue with req assertions (issue 252)
Signed-off-by: Mikko Koppanen <mkoppanen@php.net>
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/req.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
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)) { |