mirror of
https://github.com/zeromq/libzmq.git
synced 2025-10-26 10:32:58 +01:00
Problem: destructors of tcp_connecter_t, ipc_connecter_t, tipc_connecter_t contain duplicated code
Solution: pull up to stream_connecter_base_t
This commit is contained in:
@@ -62,13 +62,6 @@ zmq::ipc_connecter_t::ipc_connecter_t (class io_thread_t *io_thread_,
|
||||
zmq_assert (_addr->protocol == protocol_name::ipc);
|
||||
}
|
||||
|
||||
zmq::ipc_connecter_t::~ipc_connecter_t ()
|
||||
{
|
||||
zmq_assert (!_reconnect_timer_started);
|
||||
zmq_assert (_handle == static_cast<handle_t> (NULL));
|
||||
zmq_assert (_s == retired_fd);
|
||||
}
|
||||
|
||||
void zmq::ipc_connecter_t::process_plug ()
|
||||
{
|
||||
if (_delayed_start)
|
||||
|
||||
@@ -48,7 +48,6 @@ class ipc_connecter_t : public stream_connecter_base_t
|
||||
const options_t &options_,
|
||||
address_t *addr_,
|
||||
bool delayed_start_);
|
||||
~ipc_connecter_t ();
|
||||
|
||||
private:
|
||||
// ID of the timer used to delay the reconnection.
|
||||
|
||||
@@ -55,3 +55,10 @@ zmq::stream_connecter_base_t::stream_connecter_base_t (
|
||||
// or does not matter, change such that endpoint in initialized using an
|
||||
// initializer, and make endpoint const
|
||||
}
|
||||
|
||||
zmq::stream_connecter_base_t::~stream_connecter_base_t ()
|
||||
{
|
||||
zmq_assert (!_reconnect_timer_started);
|
||||
zmq_assert (!_handle);
|
||||
zmq_assert (_s == retired_fd);
|
||||
}
|
||||
|
||||
@@ -51,6 +51,9 @@ class stream_connecter_base_t : public own_t, public io_object_t
|
||||
address_t *addr_,
|
||||
bool delayed_start_);
|
||||
|
||||
~stream_connecter_base_t ();
|
||||
|
||||
|
||||
protected:
|
||||
// Address to connect to. Owned by session_base_t.
|
||||
// It is non-const since some parts may change during opening.
|
||||
|
||||
@@ -79,9 +79,6 @@ zmq::tcp_connecter_t::tcp_connecter_t (class io_thread_t *io_thread_,
|
||||
zmq::tcp_connecter_t::~tcp_connecter_t ()
|
||||
{
|
||||
zmq_assert (!_connect_timer_started);
|
||||
zmq_assert (!_reconnect_timer_started);
|
||||
zmq_assert (!_handle);
|
||||
zmq_assert (_s == retired_fd);
|
||||
}
|
||||
|
||||
void zmq::tcp_connecter_t::process_plug ()
|
||||
|
||||
@@ -64,13 +64,6 @@ zmq::tipc_connecter_t::tipc_connecter_t (class io_thread_t *io_thread_,
|
||||
zmq_assert (_addr->protocol == "tipc");
|
||||
}
|
||||
|
||||
zmq::tipc_connecter_t::~tipc_connecter_t ()
|
||||
{
|
||||
zmq_assert (!_reconnect_timer_started);
|
||||
zmq_assert (_handle == static_cast<handle_t> (NULL));
|
||||
zmq_assert (_s == retired_fd);
|
||||
}
|
||||
|
||||
void zmq::tipc_connecter_t::process_plug ()
|
||||
{
|
||||
if (_delayed_start)
|
||||
|
||||
@@ -49,7 +49,6 @@ class tipc_connecter_t : public stream_connecter_base_t
|
||||
const options_t &options_,
|
||||
address_t *addr_,
|
||||
bool delayed_start_);
|
||||
~tipc_connecter_t ();
|
||||
|
||||
private:
|
||||
// ID of the timer used to delay the reconnection.
|
||||
|
||||
Reference in New Issue
Block a user