/src/libzmq/src/scatter.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* SPDX-License-Identifier: MPL-2.0 */ |
2 | | |
3 | | #include "precompiled.hpp" |
4 | | #include "macros.hpp" |
5 | | #include "scatter.hpp" |
6 | | #include "pipe.hpp" |
7 | | #include "err.hpp" |
8 | | #include "msg.hpp" |
9 | | |
10 | | zmq::scatter_t::scatter_t (class ctx_t *parent_, uint32_t tid_, int sid_) : |
11 | 0 | socket_base_t (parent_, tid_, sid_, true) |
12 | 0 | { |
13 | 0 | options.type = ZMQ_SCATTER; |
14 | 0 | } |
15 | | |
16 | | zmq::scatter_t::~scatter_t () |
17 | 0 | { |
18 | 0 | } |
19 | | |
20 | | void zmq::scatter_t::xattach_pipe (pipe_t *pipe_, |
21 | | bool subscribe_to_all_, |
22 | | bool locally_initiated_) |
23 | 0 | { |
24 | 0 | LIBZMQ_UNUSED (subscribe_to_all_); |
25 | 0 | LIBZMQ_UNUSED (locally_initiated_); |
26 | | |
27 | | // Don't delay pipe termination as there is no one |
28 | | // to receive the delimiter. |
29 | 0 | pipe_->set_nodelay (); |
30 | |
|
31 | 0 | zmq_assert (pipe_); |
32 | 0 | _lb.attach (pipe_); |
33 | 0 | } |
34 | | |
35 | | void zmq::scatter_t::xwrite_activated (pipe_t *pipe_) |
36 | 0 | { |
37 | 0 | _lb.activated (pipe_); |
38 | 0 | } |
39 | | |
40 | | void zmq::scatter_t::xpipe_terminated (pipe_t *pipe_) |
41 | 0 | { |
42 | 0 | _lb.pipe_terminated (pipe_); |
43 | 0 | } |
44 | | |
45 | | int zmq::scatter_t::xsend (msg_t *msg_) |
46 | 0 | { |
47 | | // SCATTER sockets do not allow multipart data (ZMQ_SNDMORE) |
48 | 0 | if (msg_->flags () & msg_t::more) { |
49 | 0 | errno = EINVAL; |
50 | 0 | return -1; |
51 | 0 | } |
52 | | |
53 | 0 | return _lb.send (msg_); |
54 | 0 | } |
55 | | |
56 | | bool zmq::scatter_t::xhas_out () |
57 | 0 | { |
58 | 0 | return _lb.has_out (); |
59 | 0 | } |