Skip to content

Commit 85b3a94

Browse files
committed
Problem: Warnings about send being deprecated
Solution: Refactoring and addition deprecation of a send function taking int flags
1 parent d25c58a commit 85b3a94

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
@@ -1146,10 +1146,19 @@ class socket_base
11461146
throw error_t();
11471147
}
11481148

1149-
template<typename T> bool send(T first, T last, int flags_ = 0)
1149+
template<typename T>
1150+
#ifdef ZMQ_CPP11
1151+
ZMQ_DEPRECATED("from 4.4.1, use send taking message_t or buffer (for contiguous ranges), and send_flags")
1152+
#endif
1153+
bool send(T first, T last, int flags_ = 0)
11501154
{
11511155
zmq::message_t msg(first, last);
1152-
return send(msg, flags_);
1156+
int nbytes = zmq_msg_send(msg.handle(), _handle, flags_);
1157+
if (nbytes >= 0)
1158+
return true;
1159+
if (zmq_errno() == EAGAIN)
1160+
return false;
1161+
throw error_t();
11531162
}
11541163

11551164
#ifdef ZMQ_HAS_RVALUE_REFS

0 commit comments

Comments
 (0)