libzmq  master
ZeroMQ C++ Core Engine (LIBZMQ)
zmq::tcp_connecter_t Class Reference

#include <tcp_connecter.hpp>

Inheritance diagram for zmq::tcp_connecter_t:
Collaboration diagram for zmq::tcp_connecter_t:

Public Member Functions

 tcp_connecter_t (zmq::io_thread_t *io_thread_, zmq::session_base_t *session_, const options_t &options_, address_t *addr_, bool delayed_start_)
 
 ~tcp_connecter_t ()
 
- Public Member Functions inherited from zmq::own_t
 own_t (zmq::ctx_t *parent_, uint32_t tid_)
 
 own_t (zmq::io_thread_t *io_thread_, const options_t &options_)
 
void inc_seqnum ()
 
void register_term_acks (int count_)
 
void unregister_term_ack ()
 
- Public Member Functions inherited from zmq::object_t
 object_t (zmq::ctx_t *ctx_, uint32_t tid_)
 
 object_t (object_t *parent_)
 
virtual ~object_t ()
 
ctx_tget_ctx ()
 
uint32_t get_tid ()
 
void process_command (zmq::command_t &cmd_)
 
void send_bind (zmq::own_t *destination_, zmq::pipe_t *pipe_, bool inc_seqnum_=true)
 
void send_inproc_connected (zmq::socket_base_t *socket_)
 
void set_tid (uint32_t id)
 
- Public Member Functions inherited from zmq::io_object_t
 io_object_t (zmq::io_thread_t *io_thread_=NULL)
 
 ~io_object_t ()
 
void plug (zmq::io_thread_t *io_thread_)
 
void unplug ()
 
- Public Member Functions inherited from zmq::i_poll_events
virtual ~i_poll_events ()
 

Private Types

enum  { reconnect_timer_id = 1, connect_timer_id }
 

Private Member Functions

 tcp_connecter_t (const tcp_connecter_t &)
 
void add_connect_timer ()
 
void add_reconnect_timer ()
 
void close ()
 
fd_t connect ()
 
int get_new_reconnect_ivl ()
 
void in_event ()
 
int open ()
 
const tcp_connecter_toperator= (const tcp_connecter_t &)
 
void out_event ()
 
void process_plug ()
 
void process_term (int linger_)
 
void start_connecting ()
 
void timer_event (int id_)
 

Private Attributes

address_taddr
 
bool connect_timer_started
 
int current_reconnect_ivl
 
const bool delayed_start
 
std::string endpoint
 
handle_t handle
 
bool handle_valid
 
bool reconnect_timer_started
 
fd_t s
 
zmq::session_base_tsession
 
zmq::socket_base_tsocket
 

Additional Inherited Members

- Protected Types inherited from zmq::io_object_t
typedef poller_t::handle_t handle_t
 
- Protected Member Functions inherited from zmq::own_t
virtual ~own_t ()
 
bool is_terminating ()
 
void launch_child (own_t *object_)
 
virtual void process_destroy ()
 
void term_child (own_t *object_)
 
void terminate ()
 
- Protected Member Functions inherited from zmq::object_t
zmq::io_thread_tchoose_io_thread (uint64_t affinity_)
 
void connect_pending (const char *addr_, zmq::socket_base_t *bind_socket_)
 
void destroy_socket (zmq::socket_base_t *socket_)
 
zmq::endpoint_t find_endpoint (const char *addr_)
 
void log (const char *format_,...)
 
void pend_connection (const std::string &addr_, const endpoint_t &endpoint, pipe_t **pipes_)
 
virtual void process_activate_read ()
 
virtual void process_activate_write (uint64_t msgs_read_)
 
virtual void process_attach (zmq::i_engine *engine_)
 
virtual void process_bind (zmq::pipe_t *pipe_)
 
virtual void process_hiccup (void *pipe_)
 
virtual void process_pipe_term ()
 
virtual void process_pipe_term_ack ()
 
virtual void process_reap (zmq::socket_base_t *socket_)
 
virtual void process_reaped ()
 
virtual void process_stop ()
 
int register_endpoint (const char *addr_, const zmq::endpoint_t &endpoint_)
 
void send_activate_read (zmq::pipe_t *destination_)
 
void send_activate_write (zmq::pipe_t *destination_, uint64_t msgs_read_)
 
void send_attach (zmq::session_base_t *destination_, zmq::i_engine *engine_, bool inc_seqnum_=true)
 
void send_done ()
 
void send_hiccup (zmq::pipe_t *destination_, void *pipe_)
 
void send_own (zmq::own_t *destination_, zmq::own_t *object_)
 
void send_pipe_term (zmq::pipe_t *destination_)
 
void send_pipe_term_ack (zmq::pipe_t *destination_)
 
void send_plug (zmq::own_t *destination_, bool inc_seqnum_=true)
 
void send_reap (zmq::socket_base_t *socket_)
 
void send_reaped ()
 
void send_stop ()
 
void send_term (zmq::own_t *destination_, int linger_)
 
void send_term_ack (zmq::own_t *destination_)
 
void send_term_req (zmq::own_t *destination_, zmq::own_t *object_)
 
int unregister_endpoint (const std::string &addr_, socket_base_t *socket_)
 
void unregister_endpoints (zmq::socket_base_t *socket_)
 
- Protected Member Functions inherited from zmq::io_object_t
handle_t add_fd (fd_t fd_)
 
void add_timer (int timout_, int id_)
 
void cancel_timer (int id_)
 
void reset_pollin (handle_t handle_)
 
void reset_pollout (handle_t handle_)
 
void rm_fd (handle_t handle_)
 
void set_pollin (handle_t handle_)
 
void set_pollout (handle_t handle_)
 
- Protected Attributes inherited from zmq::own_t
options_t options
 

Detailed Description

Definition at line 46 of file tcp_connecter.hpp.

Member Enumeration Documentation

anonymous enum
private
Enumerator
reconnect_timer_id 
connect_timer_id 

Definition at line 60 of file tcp_connecter.hpp.

Constructor & Destructor Documentation

zmq::tcp_connecter_t::tcp_connecter_t ( zmq::io_thread_t io_thread_,
zmq::session_base_t session_,
const options_t options_,
address_t addr_,
bool  delayed_start_ 
)

Definition at line 63 of file tcp_connecter.cpp.

References addr, endpoint, zmq::session_base_t::get_socket(), zmq::address_t::protocol, session, socket, zmq::address_t::to_string(), and zmq_assert.

Here is the call graph for this function:

zmq::tcp_connecter_t::~tcp_connecter_t ( )
zmq::tcp_connecter_t::tcp_connecter_t ( const tcp_connecter_t )
private

Member Function Documentation

void zmq::tcp_connecter_t::add_connect_timer ( )
private

Definition at line 218 of file tcp_connecter.cpp.

References zmq::io_object_t::add_timer(), zmq::options_t::connect_timeout, connect_timer_id, connect_timer_started, and zmq::own_t::options.

Referenced by start_connecting().

Here is the call graph for this function:

Here is the caller graph for this function:

void zmq::tcp_connecter_t::add_reconnect_timer ( )
private

Definition at line 226 of file tcp_connecter.cpp.

References zmq::io_object_t::add_timer(), endpoint, zmq::socket_base_t::event_connect_retried(), get_new_reconnect_ivl(), reconnect_timer_id, reconnect_timer_started, and socket.

Referenced by out_event(), process_plug(), start_connecting(), and timer_event().

Here is the call graph for this function:

Here is the caller graph for this function:

void zmq::tcp_connecter_t::close ( )
private

Definition at line 395 of file tcp_connecter.cpp.

References endpoint, errno_assert, zmq::socket_base_t::event_closed(), zmq::retired_fd, s, socket, and zmq_assert.

Referenced by out_event(), process_term(), start_connecting(), and timer_event().

Here is the call graph for this function:

Here is the caller graph for this function:

zmq::fd_t zmq::tcp_connecter_t::connect ( )
private

Definition at line 347 of file tcp_connecter.cpp.

References ENOBUFS, ENOTSOCK, errno_assert, zmq::retired_fd, s, and zmq_assert.

Referenced by open(), and out_event().

Here is the caller graph for this function:

int zmq::tcp_connecter_t::get_new_reconnect_ivl ( )
private

Definition at line 234 of file tcp_connecter.cpp.

References current_reconnect_ivl, zmq::generate_random(), zmq::own_t::options, zmq::options_t::reconnect_ivl, and zmq::options_t::reconnect_ivl_max.

Referenced by add_reconnect_timer().

Here is the call graph for this function:

Here is the caller graph for this function:

void zmq::tcp_connecter_t::in_event ( )
privatevirtual

Reimplemented from zmq::io_object_t.

Definition at line 123 of file tcp_connecter.cpp.

References out_event().

Here is the call graph for this function:

const tcp_connecter_t& zmq::tcp_connecter_t::operator= ( const tcp_connecter_t )
private
void zmq::tcp_connecter_t::process_plug ( )
privatevirtual

Reimplemented from zmq::object_t.

Definition at line 92 of file tcp_connecter.cpp.

References add_reconnect_timer(), delayed_start, and start_connecting().

Here is the call graph for this function:

void zmq::tcp_connecter_t::process_term ( int  linger_)
privatevirtual
void zmq::tcp_connecter_t::start_connecting ( )
private
void zmq::tcp_connecter_t::timer_event ( int  id_)
privatevirtual

Member Data Documentation

address_t* zmq::tcp_connecter_t::addr
private

Definition at line 98 of file tcp_connecter.hpp.

Referenced by open(), and tcp_connecter_t().

bool zmq::tcp_connecter_t::connect_timer_started
private
int zmq::tcp_connecter_t::current_reconnect_ivl
private

Definition at line 121 of file tcp_connecter.hpp.

Referenced by get_new_reconnect_ivl().

const bool zmq::tcp_connecter_t::delayed_start
private

Definition at line 111 of file tcp_connecter.hpp.

Referenced by process_plug().

std::string zmq::tcp_connecter_t::endpoint
private
handle_t zmq::tcp_connecter_t::handle
private

Definition at line 104 of file tcp_connecter.hpp.

Referenced by out_event(), process_term(), start_connecting(), and timer_event().

bool zmq::tcp_connecter_t::handle_valid
private
bool zmq::tcp_connecter_t::reconnect_timer_started
private
fd_t zmq::tcp_connecter_t::s
private
zmq::session_base_t* zmq::tcp_connecter_t::session
private

Definition at line 118 of file tcp_connecter.hpp.

Referenced by out_event(), and tcp_connecter_t().

zmq::socket_base_t* zmq::tcp_connecter_t::socket
private