diff options
author | Mikko Koppanen <mkoppanen@php.net> | 2010-12-15 14:41:18 +0100 |
---|---|---|
committer | Martin Sustrik <sustrik@250bpm.com> | 2010-12-15 14:41:18 +0100 |
commit | a46980babe076d34347629a54e9635466e6e2a9f (patch) | |
tree | 2910018ecd3f5d8812d21c822f7d5b982ac479df /src | |
parent | f749f2d21c1b47e6dcd626633acff764a4484b99 (diff) |
Remove assertions from devices
Signed-off-by: Mikko Koppanen <mkoppanen@php.net>
Diffstat (limited to 'src')
-rw-r--r-- | src/device.cpp | 33 |
1 files changed, 11 insertions, 22 deletions
diff --git a/src/device.cpp b/src/device.cpp index e7c6090..cf1f9f6 100644 --- a/src/device.cpp +++ b/src/device.cpp @@ -31,7 +31,10 @@ int zmq::device (class socket_base_t *insocket_, { zmq_msg_t msg; int rc = zmq_msg_init (&msg); - zmq_assert (rc == 0); + + if (rc != 0) { + return -1; + } int64_t more; size_t moresz; @@ -51,9 +54,7 @@ int zmq::device (class socket_base_t *insocket_, // Wait while there are either requests or replies to process. rc = zmq_poll (&items [0], 2, -1); if (unlikely (rc < 0)) { - if (errno == ETERM) - return -1; - errno_assert (false); + return -1; } // The algorithm below asumes ratio of request and replies processed @@ -67,24 +68,18 @@ int zmq::device (class socket_base_t *insocket_, rc = insocket_->recv (&msg, 0); if (unlikely (rc < 0)) { - if (errno == ETERM) - return -1; - errno_assert (false); + return -1; } moresz = sizeof (more); rc = insocket_->getsockopt (ZMQ_RCVMORE, &more, &moresz); if (unlikely (rc < 0)) { - if (errno == ETERM) - return -1; - errno_assert (false); + return -1; } rc = outsocket_->send (&msg, more ? ZMQ_SNDMORE : 0); if (unlikely (rc < 0)) { - if (errno == ETERM) - return -1; - errno_assert (false); + return -1; } if (!more) @@ -98,24 +93,18 @@ int zmq::device (class socket_base_t *insocket_, rc = outsocket_->recv (&msg, 0); if (unlikely (rc < 0)) { - if (errno == ETERM) - return -1; - errno_assert (false); + return -1; } moresz = sizeof (more); rc = outsocket_->getsockopt (ZMQ_RCVMORE, &more, &moresz); if (unlikely (rc < 0)) { - if (errno == ETERM) - return -1; - errno_assert (false); + return -1; } rc = insocket_->send (&msg, more ? ZMQ_SNDMORE : 0); if (unlikely (rc < 0)) { - if (errno == ETERM) - return -1; - errno_assert (false); + return -1; } if (!more) |