0
0
mirror of https://github.com/zeromq/libzmq.git synced 2024-12-31 01:43:02 +08:00

Rename engine's methods to improve code readability

This commit is contained in:
Martin Hurton 2013-09-26 09:37:04 +02:00
parent 63e0fe915e
commit b35c08beb4
8 changed files with 33 additions and 33 deletions

View File

@ -41,11 +41,11 @@ namespace zmq
// This method is called by the session to signalise that more // This method is called by the session to signalise that more
// messages can be written to the pipe. // 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 // This method is called by the session to signalise that there
// are messages to send available. // are messages to send available.
virtual void activate_out () = 0; virtual void restart_output () = 0;
virtual void zap_msg_available () = 0; virtual void zap_msg_available () = 0;
}; };

View File

@ -102,12 +102,12 @@ void zmq::pgm_receiver_t::terminate ()
delete this; delete this;
} }
void zmq::pgm_receiver_t::activate_out () void zmq::pgm_receiver_t::restart_output ()
{ {
drop_subscriptions (); drop_subscriptions ();
} }
void zmq::pgm_receiver_t::activate_in () void zmq::pgm_receiver_t::restart_input ()
{ {
zmq_assert (session != NULL); zmq_assert (session != NULL);
zmq_assert (active_tsi != NULL); zmq_assert (active_tsi != NULL);

View File

@ -57,8 +57,8 @@ namespace zmq
void plug (zmq::io_thread_t *io_thread_, void plug (zmq::io_thread_t *io_thread_,
zmq::session_base_t *session_); zmq::session_base_t *session_);
void terminate (); void terminate ();
void activate_in (); void restart_input ();
void activate_out (); void restart_output ();
void zap_msg_available () {} void zap_msg_available () {}
// i_poll_events interface implementation. // i_poll_events interface implementation.

View File

@ -119,13 +119,13 @@ void zmq::pgm_sender_t::terminate ()
delete this; delete this;
} }
void zmq::pgm_sender_t::activate_out () void zmq::pgm_sender_t::restart_output ()
{ {
set_pollout (handle); set_pollout (handle);
out_event (); out_event ();
} }
void zmq::pgm_sender_t::activate_in () void zmq::pgm_sender_t::restart_input ()
{ {
zmq_assert (false); zmq_assert (false);
} }

View File

@ -56,8 +56,8 @@ namespace zmq
void plug (zmq::io_thread_t *io_thread_, void plug (zmq::io_thread_t *io_thread_,
zmq::session_base_t *session_); zmq::session_base_t *session_);
void terminate (); void terminate ();
void activate_in (); void restart_input ();
void activate_out (); void restart_output ();
void zap_msg_available () {} void zap_msg_available () {}
// i_poll_events interface implementation. // i_poll_events interface implementation.

View File

@ -243,7 +243,7 @@ void zmq::session_base_t::read_activated (pipe_t *pipe_)
} }
if (likely (pipe_ == pipe)) if (likely (pipe_ == pipe))
engine->activate_out (); engine->restart_output ();
else else
engine->zap_msg_available (); engine->zap_msg_available ();
} }
@ -257,7 +257,7 @@ void zmq::session_base_t::write_activated (pipe_t *pipe_)
} }
if (engine) if (engine)
engine->activate_in (); engine->restart_input ();
} }
void zmq::session_base_t::hiccuped (pipe_t *) void zmq::session_base_t::hiccuped (pipe_t *)

View File

@ -74,8 +74,8 @@ zmq::stream_engine_t::stream_engine_t (fd_t fd_, const options_t &options_,
io_error (false), io_error (false),
subscription_required (false), subscription_required (false),
mechanism (NULL), mechanism (NULL),
input_paused (false), input_stopped (false),
output_paused (false), output_stopped (false),
socket (NULL) socket (NULL)
{ {
int rc = tx_msg.init (); int rc = tx_msg.init ();
@ -204,7 +204,7 @@ void zmq::stream_engine_t::in_event ()
zmq_assert (decoder); zmq_assert (decoder);
// If there has been an I/O error, stop polling. // If there has been an I/O error, stop polling.
if (input_paused) { if (input_stopped) {
rm_fd (handle); rm_fd (handle);
io_error = true; io_error = true;
return; return;
@ -252,7 +252,7 @@ void zmq::stream_engine_t::in_event ()
error (); error ();
return; return;
} }
input_paused = true; input_stopped = true;
reset_pollin (handle); 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 there is no data to send, stop polling for output.
if (outsize == 0) { if (outsize == 0) {
output_paused = true; output_stopped = true;
reset_pollout (handle); reset_pollout (handle);
return; return;
} }
@ -328,14 +328,14 @@ void zmq::stream_engine_t::out_event ()
terminate (); terminate ();
} }
void zmq::stream_engine_t::activate_out () void zmq::stream_engine_t::restart_output ()
{ {
if (unlikely (io_error)) if (unlikely (io_error))
return; return;
if (likely (output_paused)) { if (likely (output_stopped)) {
set_pollout (handle); set_pollout (handle);
output_paused = false; output_stopped = false;
} }
// Speculative write: The assumption is that at the moment new message // Speculative write: The assumption is that at the moment new message
@ -345,9 +345,9 @@ void zmq::stream_engine_t::activate_out ()
out_event (); 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 (session != NULL);
zmq_assert (decoder != NULL); zmq_assert (decoder != NULL);
@ -379,7 +379,7 @@ void zmq::stream_engine_t::activate_in ()
if (rc == -1 || io_error) if (rc == -1 || io_error)
error (); error ();
else { else {
input_paused = false; input_stopped = false;
set_pollin (handle); set_pollin (handle);
session->flush (); session->flush ();
@ -614,8 +614,8 @@ int zmq::stream_engine_t::process_handshake_command (msg_t *msg_)
if (rc == 0) { if (rc == 0) {
if (mechanism->is_handshake_complete ()) if (mechanism->is_handshake_complete ())
mechanism_ready (); mechanism_ready ();
if (output_paused) if (output_stopped)
activate_out (); restart_output ();
} }
return rc; return rc;
@ -630,10 +630,10 @@ void zmq::stream_engine_t::zap_msg_available ()
error (); error ();
return; return;
} }
if (input_paused) if (input_stopped)
activate_in (); restart_input ();
if (output_paused) if (output_stopped)
activate_out (); restart_output ();
} }
void zmq::stream_engine_t::mechanism_ready () void zmq::stream_engine_t::mechanism_ready ()

View File

@ -60,8 +60,8 @@ namespace zmq
void plug (zmq::io_thread_t *io_thread_, void plug (zmq::io_thread_t *io_thread_,
zmq::session_base_t *session_); zmq::session_base_t *session_);
void terminate (); void terminate ();
void activate_in (); void restart_input ();
void activate_out (); void restart_output ();
void zap_msg_available (); void zap_msg_available ();
// i_poll_events interface implementation. // i_poll_events interface implementation.
@ -179,10 +179,10 @@ namespace zmq
mechanism_t *mechanism; mechanism_t *mechanism;
// True iff the engine couldn't consume the last decoded message. // 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. // True iff the engine doesn't have any message to encode.
bool output_paused; bool output_stopped;
// Socket // Socket
zmq::socket_base_t *socket; zmq::socket_base_t *socket;