Skip to content

Commit 3b1038d

Browse files
authored
Merge pull request #337 from gummif/gfa/clang-warnings
Problem: Warnings about send being deprecated
2 parents 527a873 + 85b3a94 commit 3b1038d

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

zmq.hpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,10 +1213,19 @@ class socket_base
12131213
throw error_t();
12141214
}
12151215

1216-
template<typename T> bool send(T first, T last, int flags_ = 0)
1216+
template<typename T>
1217+
#ifdef ZMQ_CPP11
1218+
ZMQ_DEPRECATED("from 4.4.1, use send taking message_t or buffer (for contiguous ranges), and send_flags")
1219+
#endif
1220+
bool send(T first, T last, int flags_ = 0)
12171221
{
12181222
zmq::message_t msg(first, last);
1219-
return send(msg, flags_);
1223+
int nbytes = zmq_msg_send(msg.handle(), _handle, flags_);
1224+
if (nbytes >= 0)
1225+
return true;
1226+
if (zmq_errno() == EAGAIN)
1227+
return false;
1228+
throw error_t();
12201229
}
12211230

12221231
#ifdef ZMQ_HAS_RVALUE_REFS

0 commit comments

Comments
 (0)