peer.cpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MPL-2.0 */
2 
3 #include "precompiled.hpp"
4 #include "macros.hpp"
5 #include "peer.hpp"
6 #include "pipe.hpp"
7 #include "wire.hpp"
8 #include "random.hpp"
9 #include "likely.hpp"
10 #include "err.hpp"
11 
12 zmq::peer_t::peer_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
13  server_t (parent_, tid_, sid_)
14 {
15  options.type = ZMQ_PEER;
16  options.can_send_hello_msg = true;
17  options.can_recv_disconnect_msg = true;
18  options.can_recv_hiccup_msg = true;
19 }
20 
21 uint32_t zmq::peer_t::connect_peer (const char *endpoint_uri_)
22 {
23  scoped_optional_lock_t sync_lock (&_sync);
24 
25  // connect_peer cannot work with immediate enabled
26  if (options.immediate == 1) {
27  errno = EFAULT;
28  return 0;
29  }
30 
31  int rc = socket_base_t::connect_internal (endpoint_uri_);
32  if (rc != 0)
33  return 0;
34 
35  return _peer_last_routing_id;
36 }
37 
38 void zmq::peer_t::xattach_pipe (pipe_t *pipe_,
39  bool subscribe_to_all_,
40  bool locally_initiated_)
41 {
42  server_t::xattach_pipe (pipe_, subscribe_to_all_, locally_initiated_);
43  _peer_last_routing_id = pipe_->get_server_socket_routing_id ();
44 }
options
Message * options
Definition: src/google/protobuf/descriptor.cc:3119
precompiled.hpp
random.hpp
errno
int errno
wire.hpp
peer.hpp
macros.hpp
pipe.hpp
ZMQ_PEER
#define ZMQ_PEER
Definition: zmq_draft.h:21
err.hpp
likely.hpp
EFAULT
#define EFAULT
Definition: errno.hpp:17


libaditof
Author(s):
autogenerated on Wed May 21 2025 02:06:57