Skip to content

Commit

Permalink
[Refactor] Rename member variables (#174)
Browse files Browse the repository at this point in the history
  • Loading branch information
greensky00 authored Jan 31, 2021
1 parent 1deb0f2 commit f8fff26
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions src/asio_service.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ class rpc_session : public std::enable_shared_from_this<rpc_session> {
, callback_(callback)
, src_id_(-1)
, is_leader_(false)
, cached_port(0)
, cached_port_(0)
{
p_tr("asio rpc session created: %p", this);
}
Expand All @@ -239,12 +239,12 @@ class rpc_session : public std::enable_shared_from_this<rpc_session> {
// this is safe since we only expose ctor to cs_new
ptr<rpc_session> self = this->shared_from_this();

cached_address = socket_.remote_endpoint().address().to_string();
cached_port = socket_.remote_endpoint().port();
cached_address_ = socket_.remote_endpoint().address().to_string();
cached_port_ = socket_.remote_endpoint().port();
p_in( "session %zu got connection from %s:%u (as a server)",
session_id_,
cached_address.c_str(),
cached_port );
cached_address_.c_str(),
cached_port_ );

if (ssl_enabled_) {
#ifdef SSL_LIBRARY_NOT_FOUND
Expand All @@ -267,15 +267,15 @@ class rpc_session : public std::enable_shared_from_this<rpc_session> {
if (!err) {
p_in( "session %zu handshake with %s:%u succeeded (as a server)",
session_id_,
cached_address.c_str(),
cached_port );
cached_address_.c_str(),
cached_port_ );
this->start(self);

} else {
p_er( "session %zu handshake with %s:%u failed: error %d",
session_id_,
cached_address.c_str(),
cached_port,
cached_address_.c_str(),
cached_port_,
err.value() );

// Lazy stop.
Expand Down Expand Up @@ -309,8 +309,8 @@ class rpc_session : public std::enable_shared_from_this<rpc_session> {
p_er( "session %zu failed to read rpc header from socket %s:%u "
"due to error %d",
session_id_,
cached_address.c_str(),
cached_port,
cached_address_.c_str(),
cached_port_,
err.value() );
this->stop();
return;
Expand Down Expand Up @@ -399,8 +399,8 @@ class rpc_session : public std::enable_shared_from_this<rpc_session> {

cb_func::ConnectionArgs
args( session_id_,
cached_address,
cached_port,
cached_address_,
cached_port_,
src_id_,
is_leader_ );
cb_func::Param cb_param( handler_->get_id(),
Expand Down Expand Up @@ -478,8 +478,8 @@ class rpc_session : public std::enable_shared_from_this<rpc_session> {
is_leader_ = true;
cb_func::ConnectionArgs
args( session_id_,
cached_address,
cached_port,
cached_address_,
cached_port_,
src_id_,
is_leader_ );
cb_func::Param cb_param( handler_->get_id(),
Expand Down Expand Up @@ -676,8 +676,8 @@ class rpc_session : public std::enable_shared_from_this<rpc_session> {
*/
bool is_leader_;

std::string cached_address;
uint32_t cached_port;
std::string cached_address_;
uint32_t cached_port_;
};

// rpc listener implementation
Expand Down

0 comments on commit f8fff26

Please sign in to comment.