mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-28 16:15:23 +08:00
Rename engine's methods to improve code readability
This commit is contained in:
parent
63e0fe915e
commit
b35c08beb4
@ -41,11 +41,11 @@ namespace zmq
|
||||
|
||||
// This method is called by the session to signalise that more
|
||||
// messages can be written to the pipe.
|
||||
virtual void activate_in () = 0;
|
||||
virtual void restart_input () = 0;
|
||||
|
||||
// This method is called by the session to signalise that there
|
||||
// are messages to send available.
|
||||
virtual void activate_out () = 0;
|
||||
virtual void restart_output () = 0;
|
||||
|
||||
virtual void zap_msg_available () = 0;
|
||||
};
|
||||
|
@ -102,12 +102,12 @@ void zmq::pgm_receiver_t::terminate ()
|
||||
delete this;
|
||||
}
|
||||
|
||||
void zmq::pgm_receiver_t::activate_out ()
|
||||
void zmq::pgm_receiver_t::restart_output ()
|
||||
{
|
||||
drop_subscriptions ();
|
||||
}
|
||||
|
||||
void zmq::pgm_receiver_t::activate_in ()
|
||||
void zmq::pgm_receiver_t::restart_input ()
|
||||
{
|
||||
zmq_assert (session != NULL);
|
||||
zmq_assert (active_tsi != NULL);
|
||||
|
@ -57,8 +57,8 @@ namespace zmq
|
||||
void plug (zmq::io_thread_t *io_thread_,
|
||||
zmq::session_base_t *session_);
|
||||
void terminate ();
|
||||
void activate_in ();
|
||||
void activate_out ();
|
||||
void restart_input ();
|
||||
void restart_output ();
|
||||
void zap_msg_available () {}
|
||||
|
||||
// i_poll_events interface implementation.
|
||||
|
@ -119,13 +119,13 @@ void zmq::pgm_sender_t::terminate ()
|
||||
delete this;
|
||||
}
|
||||
|
||||
void zmq::pgm_sender_t::activate_out ()
|
||||
void zmq::pgm_sender_t::restart_output ()
|
||||
{
|
||||
set_pollout (handle);
|
||||
out_event ();
|
||||
}
|
||||
|
||||
void zmq::pgm_sender_t::activate_in ()
|
||||
void zmq::pgm_sender_t::restart_input ()
|
||||
{
|
||||
zmq_assert (false);
|
||||
}
|
||||
|
@ -56,8 +56,8 @@ namespace zmq
|
||||
void plug (zmq::io_thread_t *io_thread_,
|
||||
zmq::session_base_t *session_);
|
||||
void terminate ();
|
||||
void activate_in ();
|
||||
void activate_out ();
|
||||
void restart_input ();
|
||||
void restart_output ();
|
||||
void zap_msg_available () {}
|
||||
|
||||
// i_poll_events interface implementation.
|
||||
|
@ -243,7 +243,7 @@ void zmq::session_base_t::read_activated (pipe_t *pipe_)
|
||||
}
|
||||
|
||||
if (likely (pipe_ == pipe))
|
||||
engine->activate_out ();
|
||||
engine->restart_output ();
|
||||
else
|
||||
engine->zap_msg_available ();
|
||||
}
|
||||
@ -257,7 +257,7 @@ void zmq::session_base_t::write_activated (pipe_t *pipe_)
|
||||
}
|
||||
|
||||
if (engine)
|
||||
engine->activate_in ();
|
||||
engine->restart_input ();
|
||||
}
|
||||
|
||||
void zmq::session_base_t::hiccuped (pipe_t *)
|
||||
|
@ -74,8 +74,8 @@ zmq::stream_engine_t::stream_engine_t (fd_t fd_, const options_t &options_,
|
||||
io_error (false),
|
||||
subscription_required (false),
|
||||
mechanism (NULL),
|
||||
input_paused (false),
|
||||
output_paused (false),
|
||||
input_stopped (false),
|
||||
output_stopped (false),
|
||||
socket (NULL)
|
||||
{
|
||||
int rc = tx_msg.init ();
|
||||
@ -204,7 +204,7 @@ void zmq::stream_engine_t::in_event ()
|
||||
zmq_assert (decoder);
|
||||
|
||||
// If there has been an I/O error, stop polling.
|
||||
if (input_paused) {
|
||||
if (input_stopped) {
|
||||
rm_fd (handle);
|
||||
io_error = true;
|
||||
return;
|
||||
@ -252,7 +252,7 @@ void zmq::stream_engine_t::in_event ()
|
||||
error ();
|
||||
return;
|
||||
}
|
||||
input_paused = true;
|
||||
input_stopped = true;
|
||||
reset_pollin (handle);
|
||||
}
|
||||
|
||||
@ -291,7 +291,7 @@ void zmq::stream_engine_t::out_event ()
|
||||
|
||||
// If there is no data to send, stop polling for output.
|
||||
if (outsize == 0) {
|
||||
output_paused = true;
|
||||
output_stopped = true;
|
||||
reset_pollout (handle);
|
||||
return;
|
||||
}
|
||||
@ -328,14 +328,14 @@ void zmq::stream_engine_t::out_event ()
|
||||
terminate ();
|
||||
}
|
||||
|
||||
void zmq::stream_engine_t::activate_out ()
|
||||
void zmq::stream_engine_t::restart_output ()
|
||||
{
|
||||
if (unlikely (io_error))
|
||||
return;
|
||||
|
||||
if (likely (output_paused)) {
|
||||
if (likely (output_stopped)) {
|
||||
set_pollout (handle);
|
||||
output_paused = false;
|
||||
output_stopped = false;
|
||||
}
|
||||
|
||||
// Speculative write: The assumption is that at the moment new message
|
||||
@ -345,9 +345,9 @@ void zmq::stream_engine_t::activate_out ()
|
||||
out_event ();
|
||||
}
|
||||
|
||||
void zmq::stream_engine_t::activate_in ()
|
||||
void zmq::stream_engine_t::restart_input ()
|
||||
{
|
||||
zmq_assert (input_paused);
|
||||
zmq_assert (input_stopped);
|
||||
zmq_assert (session != NULL);
|
||||
zmq_assert (decoder != NULL);
|
||||
|
||||
@ -379,7 +379,7 @@ void zmq::stream_engine_t::activate_in ()
|
||||
if (rc == -1 || io_error)
|
||||
error ();
|
||||
else {
|
||||
input_paused = false;
|
||||
input_stopped = false;
|
||||
set_pollin (handle);
|
||||
session->flush ();
|
||||
|
||||
@ -614,8 +614,8 @@ int zmq::stream_engine_t::process_handshake_command (msg_t *msg_)
|
||||
if (rc == 0) {
|
||||
if (mechanism->is_handshake_complete ())
|
||||
mechanism_ready ();
|
||||
if (output_paused)
|
||||
activate_out ();
|
||||
if (output_stopped)
|
||||
restart_output ();
|
||||
}
|
||||
|
||||
return rc;
|
||||
@ -630,10 +630,10 @@ void zmq::stream_engine_t::zap_msg_available ()
|
||||
error ();
|
||||
return;
|
||||
}
|
||||
if (input_paused)
|
||||
activate_in ();
|
||||
if (output_paused)
|
||||
activate_out ();
|
||||
if (input_stopped)
|
||||
restart_input ();
|
||||
if (output_stopped)
|
||||
restart_output ();
|
||||
}
|
||||
|
||||
void zmq::stream_engine_t::mechanism_ready ()
|
||||
|
@ -60,8 +60,8 @@ namespace zmq
|
||||
void plug (zmq::io_thread_t *io_thread_,
|
||||
zmq::session_base_t *session_);
|
||||
void terminate ();
|
||||
void activate_in ();
|
||||
void activate_out ();
|
||||
void restart_input ();
|
||||
void restart_output ();
|
||||
void zap_msg_available ();
|
||||
|
||||
// i_poll_events interface implementation.
|
||||
@ -179,10 +179,10 @@ namespace zmq
|
||||
mechanism_t *mechanism;
|
||||
|
||||
// True iff the engine couldn't consume the last decoded message.
|
||||
bool input_paused;
|
||||
bool input_stopped;
|
||||
|
||||
// True iff the engine doesn't have any message to encode.
|
||||
bool output_paused;
|
||||
bool output_stopped;
|
||||
|
||||
// Socket
|
||||
zmq::socket_base_t *socket;
|
||||
|
Loading…
x
Reference in New Issue
Block a user