From c641644bb200dab1a95202959e6b8964210c75bb Mon Sep 17 00:00:00 2001 From: Simon Giesecke Date: Wed, 30 May 2018 22:46:29 +0200 Subject: [PATCH] Problem: inconsistent parameter names Solution: harmonize --- src/socket_base.cpp | 29 +++++++++++++++-------------- src/socket_base.hpp | 20 ++++++++++---------- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/src/socket_base.cpp b/src/socket_base.cpp index a0884930..bf933213 100644 --- a/src/socket_base.cpp +++ b/src/socket_base.cpp @@ -1577,7 +1577,7 @@ void zmq::socket_base_t::extract_flags (msg_t *msg_) _rcvmore = (msg_->flags () & msg_t::more) != 0; } -int zmq::socket_base_t::monitor (const char *addr_, int events_) +int zmq::socket_base_t::monitor (const char *endpoint_, int events_) { scoped_lock_t lock (_monitor_sync); @@ -1587,14 +1587,14 @@ int zmq::socket_base_t::monitor (const char *addr_, int events_) } // Support deregistering monitoring endpoints as well - if (addr_ == NULL) { + if (endpoint_ == NULL) { stop_monitor (); return 0; } // Parse addr_ string. std::string protocol; std::string address; - if (parse_uri (addr_, protocol, address) || check_protocol (protocol)) + if (parse_uri (endpoint_, protocol, address) || check_protocol (protocol)) return -1; // Event notification only supported over inproc:// @@ -1620,7 +1620,7 @@ int zmq::socket_base_t::monitor (const char *addr_, int events_) stop_monitor (false); // Spawn the monitor socket endpoint - rc = zmq_bind (_monitor_socket, addr_); + rc = zmq_bind (_monitor_socket, endpoint_); if (rc == -1) stop_monitor (false); return rc; @@ -1809,34 +1809,35 @@ std::string zmq::routing_socket_base_t::extract_connect_routing_id () return res; } -void zmq::routing_socket_base_t::add_out_pipe (blob_t routing_id, pipe_t *pipe_) +void zmq::routing_socket_base_t::add_out_pipe (blob_t routing_id_, + pipe_t *pipe_) { // Add the record into output pipes lookup table const out_pipe_t outpipe = {pipe_, true}; const bool ok = - _out_pipes.ZMQ_MAP_INSERT_OR_EMPLACE (ZMQ_MOVE (routing_id), outpipe) + _out_pipes.ZMQ_MAP_INSERT_OR_EMPLACE (ZMQ_MOVE (routing_id_), outpipe) .second; zmq_assert (ok); } -bool zmq::routing_socket_base_t::has_out_pipe (const blob_t &routing_id) const +bool zmq::routing_socket_base_t::has_out_pipe (const blob_t &routing_id_) const { - return 0 != _out_pipes.count (routing_id); + return 0 != _out_pipes.count (routing_id_); } zmq::routing_socket_base_t::out_pipe_t * -zmq::routing_socket_base_t::lookup_out_pipe (const blob_t &routing_id) +zmq::routing_socket_base_t::lookup_out_pipe (const blob_t &routing_id_) { // TODO we could probably avoid constructor a temporary blob_t to call this function - out_pipes_t::iterator it = _out_pipes.find (routing_id); + out_pipes_t::iterator it = _out_pipes.find (routing_id_); return it == _out_pipes.end () ? NULL : &it->second; } const zmq::routing_socket_base_t::out_pipe_t * -zmq::routing_socket_base_t::lookup_out_pipe (const blob_t &routing_id) const +zmq::routing_socket_base_t::lookup_out_pipe (const blob_t &routing_id_) const { // TODO we could probably avoid constructor a temporary blob_t to call this function - out_pipes_t::const_iterator it = _out_pipes.find (routing_id); + out_pipes_t::const_iterator it = _out_pipes.find (routing_id_); return it == _out_pipes.end () ? NULL : &it->second; } @@ -1847,9 +1848,9 @@ void zmq::routing_socket_base_t::erase_out_pipe (pipe_t *pipe_) } zmq::routing_socket_base_t::out_pipe_t -zmq::routing_socket_base_t::try_erase_out_pipe (const blob_t &routing_id) +zmq::routing_socket_base_t::try_erase_out_pipe (const blob_t &routing_id_) { - const out_pipes_t::iterator it = _out_pipes.find (routing_id); + const out_pipes_t::iterator it = _out_pipes.find (routing_id_); out_pipe_t res = {NULL, false}; if (it != _out_pipes.end ()) { res = it->second; diff --git a/src/socket_base.hpp b/src/socket_base.hpp index 0d5a188c..e3b6918d 100644 --- a/src/socket_base.hpp +++ b/src/socket_base.hpp @@ -137,8 +137,8 @@ class socket_base_t : public own_t, // Query the state of a specific peer. The default implementation // always returns an ENOTSUP error. - virtual int get_peer_state (const void *identity_, - size_t identity_size_) const; + virtual int get_peer_state (const void *routing_id_, + size_t routing_id_size_) const; protected: socket_base_t (zmq::ctx_t *parent_, @@ -186,7 +186,7 @@ class socket_base_t : public own_t, private: // test if event should be sent and then dispatch it - void event (const std::string &addr_, intptr_t fd_, int type_); + void event (const std::string &addr_, intptr_t value_, int type_); // Socket event data dispatch void monitor_event (int event_, intptr_t value_, const std::string &addr_); @@ -318,18 +318,18 @@ class routing_socket_base_t : public socket_base_t bool active; }; - void add_out_pipe (blob_t routing_id, pipe_t *pipe_); - bool has_out_pipe (const blob_t &routing_id) const; - out_pipe_t *lookup_out_pipe (const blob_t &routing_id); - const out_pipe_t *lookup_out_pipe (const blob_t &routing_id) const; + void add_out_pipe (blob_t routing_id_, pipe_t *pipe_); + bool has_out_pipe (const blob_t &routing_id_) const; + out_pipe_t *lookup_out_pipe (const blob_t &routing_id_); + const out_pipe_t *lookup_out_pipe (const blob_t &routing_id_) const; void erase_out_pipe (pipe_t *pipe_); - out_pipe_t try_erase_out_pipe (const blob_t &routing_id); - template bool any_of_out_pipes (Func func) + out_pipe_t try_erase_out_pipe (const blob_t &routing_id_); + template bool any_of_out_pipes (Func func_) { bool res = false; for (out_pipes_t::iterator it = _out_pipes.begin (); it != _out_pipes.end () && !res; ++it) { - res |= func (*it->second.pipe); + res |= func_ (*it->second.pipe); } return res;