diff options
author | luigi1111 <luigi1111w@gmail.com> | 2020-05-01 15:13:58 -0500 |
---|---|---|
committer | luigi1111 <luigi1111w@gmail.com> | 2020-05-01 15:13:58 -0500 |
commit | 3e21e591b8201fdb852822b1d30faa1fb97d870a (patch) | |
tree | 66f7e7af1eb010d5ed97320916b40abc58a36268 /src/net/zmq.h | |
parent | Merge pull request #6487 (diff) | |
parent | Use byte_slice for sending zmq messages - removes data copy within zmq (diff) | |
download | monero-3e21e591b8201fdb852822b1d30faa1fb97d870a.tar.xz |
Merge pull request #6350
da99157 Use byte_slice for sending zmq messages - removes data copy within zmq (vtnerd)
Diffstat (limited to 'src/net/zmq.h')
-rw-r--r-- | src/net/zmq.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/net/zmq.h b/src/net/zmq.h index c6a7fd743..65560b62e 100644 --- a/src/net/zmq.h +++ b/src/net/zmq.h @@ -53,6 +53,11 @@ #define MONERO_ZMQ_THROW(msg) \ MONERO_THROW( ::net::zmq::get_error_code(), msg ) +namespace epee +{ + class byte_slice; +} + namespace net { namespace zmq @@ -132,5 +137,24 @@ namespace zmq \param flags See `zmq_send` for possible flags. \return `success()` if sent, otherwise ZMQ error. */ expect<void> send(epee::span<const std::uint8_t> payload, void* socket, int flags = 0) noexcept; + + /*! Sends `payload` on `socket`. Blocks until the entire message is queued + for sending, or until `zmq_term` is called on the `zmq_context` + associated with `socket`. If the context is terminated, + `make_error_code(ETERM)` is returned. + + \note This will automatically retry on `EINTR`, so exiting on + interrupts requires context termination. + \note If non-blocking behavior is requested on `socket` or by `flags`, + then `net::zmq::make_error_code(EAGAIN)` will be returned if this + would block. + + \param payload sent as one message on `socket`. + \param socket Handle created with `zmq_socket`. + \param flags See `zmq_msg_send` for possible flags. + + \post `payload.emtpy()` - ownership is transferred to zmq. + \return `success()` if sent, otherwise ZMQ error. */ + expect<void> send(epee::byte_slice&& payload, void* socket, int flags = 0) noexcept; } // zmq } // net |