Merge pull request #57 from gdfast/patch-1

Avoid using deprecated function zmq_recvmsg
This commit is contained in:
Constantin Rack 2015-11-10 21:20:22 +01:00
commit 7c3d374ff8

10
zmq.hpp
View File

@ -86,6 +86,12 @@ typedef struct {
} zmq_event_t; } zmq_event_t;
#endif #endif
// Avoid using deprecated message receive function when possible
#if ZMQ_VERSION < ZMQ_MAKE_VERSION(3, 2, 0)
# define zmq_msg_recv zmq_recvmsg
#endif
// In order to prevent unused variable warnings when building in non-debug // In order to prevent unused variable warnings when building in non-debug
// mode use this macro to make assertions. // mode use this macro to make assertions.
#ifndef NDEBUG #ifndef NDEBUG
@ -657,7 +663,7 @@ namespace zmq
while (true) { while (true) {
zmq_msg_t eventMsg; zmq_msg_t eventMsg;
zmq_msg_init (&eventMsg); zmq_msg_init (&eventMsg);
rc = zmq_recvmsg (s, &eventMsg, 0); rc = zmq_msg_recv (s, &eventMsg, 0);
if (rc == -1 && zmq_errno() == ETERM) if (rc == -1 && zmq_errno() == ETERM)
break; break;
assert (rc != -1); assert (rc != -1);
@ -674,7 +680,7 @@ namespace zmq
#ifdef ZMQ_NEW_MONITOR_EVENT_LAYOUT #ifdef ZMQ_NEW_MONITOR_EVENT_LAYOUT
zmq_msg_t addrMsg; zmq_msg_t addrMsg;
zmq_msg_init (&addrMsg); zmq_msg_init (&addrMsg);
rc = zmq_recvmsg (s, &addrMsg, 0); rc = zmq_msg_recv (s, &addrMsg, 0);
if (rc == -1 && zmq_errno() == ETERM) if (rc == -1 && zmq_errno() == ETERM)
break; break;
assert (rc != -1); assert (rc != -1);