tcp_connecter.hpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MPL-2.0 */
2 
3 #ifndef __TCP_CONNECTER_HPP_INCLUDED__
4 #define __TCP_CONNECTER_HPP_INCLUDED__
5 
6 #include "fd.hpp"
7 #include "stdint.hpp"
9 
10 namespace zmq
11 {
12 class tcp_connecter_t ZMQ_FINAL : public stream_connecter_base_t
13 {
14  public:
15  // If 'delayed_start' is true connecter first waits for a while,
16  // then starts connection process.
17  tcp_connecter_t (zmq::io_thread_t *io_thread_,
18  zmq::session_base_t *session_,
19  const options_t &options_,
20  address_t *addr_,
21  bool delayed_start_);
22  ~tcp_connecter_t ();
23 
24  private:
25  // ID of the timer used to check the connect timeout, must be different from stream_connecter_base_t::reconnect_timer_id.
26  enum
27  {
28  connect_timer_id = 2
29  };
30 
31  // Handlers for incoming commands.
32  void process_term (int linger_);
33 
34  // Handlers for I/O events.
35  void out_event ();
36  void timer_event (int id_);
37 
38  // Internal function to start the actual connection establishment.
39  void start_connecting ();
40 
41  // Internal function to add a connect timer
42  void add_connect_timer ();
43 
44  // Open TCP connecting socket. Returns -1 in case of error,
45  // 0 if connect was successful immediately. Returns -1 with
46  // EAGAIN errno if async connect was launched.
47  int open ();
48 
49  // Get the file descriptor of newly created connection. Returns
50  // retired_fd if the connection was unsuccessful.
51  fd_t connect ();
52 
53  // Tunes a connected socket.
54  bool tune_socket (fd_t fd_);
55 
56  // True iff a timer has been started.
58 
59  ZMQ_NON_COPYABLE_NOR_MOVABLE (tcp_connecter_t)
60 };
61 }
62 
63 #endif
zmq::session_base_t
Definition: session_base.hpp:21
zmq::fd_t
int fd_t
Definition: zmq.hpp:287
zmq::ZMQ_FINAL::_connect_timer_started
bool _connect_timer_started
Definition: tcp_connecter.hpp:57
zmq
Definition: zmq.hpp:229
stdint.hpp
ZMQ_NON_COPYABLE_NOR_MOVABLE
#define ZMQ_NON_COPYABLE_NOR_MOVABLE(classname)
Definition: macros.hpp:58
fd.hpp
stream_connecter_base.hpp
ZMQ_FINAL
Definition: unittest_ip_resolver.cpp:26
options_
DebugStringOptions options_
Definition: src/google/protobuf/descriptor.cc:2410


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