v1.0.0-rc.31

This commit is contained in:
2025-03-02 13:15:28 +01:00
parent aeabc81a4c
commit ddf4c75645
309 changed files with 8705 additions and 1421 deletions
+4 -9
View File
@@ -86,20 +86,15 @@ void ZMQSocket::Send(zmq_msg_t *msg) {
throw JFJochException(JFJochExceptionCategory::ZeroMQ, "zmq_msg_send failed");
}
void zmq_socket_free(void *data, void *hint) {
auto z = (ZeroCopyReturnValue *) hint;
z->release();
}
void ZMQSocket::SendZeroCopy(const void *buf, size_t buf_size, ZeroCopyReturnValue *zero_copy_ret_val) {
void ZMQSocket::SendZeroCopy(void *data, size_t size,void (*callback)(void *, void *), void *hint) {
std::unique_lock ul(m);
zmq_msg_t msg;
if (zmq_msg_init_data(&msg, const_cast<void *>(buf), buf_size, zmq_socket_free, zero_copy_ret_val) != 0) {
zero_copy_ret_val->release();
if (zmq_msg_init_data(&msg, data, size, callback, hint) != 0) {
callback(data, hint);
throw JFJochException(JFJochExceptionCategory::ZeroMQ, "zmq_msg_init_data failed");
}
if (zmq_msg_send(&msg, socket, 0) < 0) {
zero_copy_ret_val->release();
callback(data, hint);
throw JFJochException(JFJochExceptionCategory::ZeroMQ, "zmq_msg_send failed");
}
}