Problem: duplication across ipc_listener_t, tcp_listener_t, tipc_listener_t

Solution: extract common base class stream_listener_base_t
This commit is contained in:
Simon Giesecke
2019-01-31 10:52:51 -05:00
parent a40a3b7a34
commit 93c1843f3e
10 changed files with 206 additions and 196 deletions

View File

@@ -132,34 +132,11 @@ int zmq::ipc_listener_t::create_wildcard_address (std::string &path_,
zmq::ipc_listener_t::ipc_listener_t (io_thread_t *io_thread_,
socket_base_t *socket_,
const options_t &options_) :
own_t (io_thread_, options_),
io_object_t (io_thread_),
_has_file (false),
_s (retired_fd),
_handle (static_cast<handle_t> (NULL)),
_socket (socket_)
stream_listener_base_t (io_thread_, socket_, options_),
_has_file (false)
{
}
zmq::ipc_listener_t::~ipc_listener_t ()
{
zmq_assert (_s == retired_fd);
}
void zmq::ipc_listener_t::process_plug ()
{
// Start polling for incoming connections.
_handle = add_fd (_s);
set_pollin (_handle);
}
void zmq::ipc_listener_t::process_term (int linger_)
{
rm_fd (_handle);
close ();
own_t::process_term (linger_);
}
void zmq::ipc_listener_t::in_event ()
{
fd_t fd = accept ();