From b35c08beb4e6a8b72e05265cb5f49af22f2663d7 Mon Sep 17 00:00:00 2001 From: Martin Hurton Date: Thu, 26 Sep 2013 09:37:04 +0200 Subject: [PATCH] Rename engine's methods to improve code readability --- src/i_engine.hpp | 4 ++-- src/pgm_receiver.cpp | 4 ++-- src/pgm_receiver.hpp | 4 ++-- src/pgm_sender.cpp | 4 ++-- src/pgm_sender.hpp | 4 ++-- src/session_base.cpp | 4 ++-- src/stream_engine.cpp | 34 +++++++++++++++++----------------- src/stream_engine.hpp | 8 ++++---- 8 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/i_engine.hpp b/src/i_engine.hpp index ba87913f..39266c41 100644 --- a/src/i_engine.hpp +++ b/src/i_engine.hpp @@ -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; }; diff --git a/src/pgm_receiver.cpp b/src/pgm_receiver.cpp index 89311350..40689692 100644 --- a/src/pgm_receiver.cpp +++ b/src/pgm_receiver.cpp @@ -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); diff --git a/src/pgm_receiver.hpp b/src/pgm_receiver.hpp index e247bc12..1f5d2d4e 100644 --- a/src/pgm_receiver.hpp +++ b/src/pgm_receiver.hpp @@ -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. diff --git a/src/pgm_sender.cpp b/src/pgm_sender.cpp index a0f2d0a2..0be7c6dd 100644 --- a/src/pgm_sender.cpp +++ b/src/pgm_sender.cpp @@ -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); } diff --git a/src/pgm_sender.hpp b/src/pgm_sender.hpp index 981bc0de..045cd474 100644 --- a/src/pgm_sender.hpp +++ b/src/pgm_sender.hpp @@ -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. diff --git a/src/session_base.cpp b/src/session_base.cpp index 40b9a821..7e27e31d 100644 --- a/src/session_base.cpp +++ b/src/session_base.cpp @@ -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 *) diff --git a/src/stream_engine.cpp b/src/stream_engine.cpp index 87efc31a..0d875816 100644 --- a/src/stream_engine.cpp +++ b/src/stream_engine.cpp @@ -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 () diff --git a/src/stream_engine.hpp b/src/stream_engine.hpp index 8dfff7b2..583a8608 100644 --- a/src/stream_engine.hpp +++ b/src/stream_engine.hpp @@ -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;