Skip to content

Commit

Permalink
Add remote endpoint peer name to dup connection check
Browse files Browse the repository at this point in the history
  • Loading branch information
heifner committed Feb 22, 2019
1 parent 8442569 commit 797f194
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion plugins/net_plugin/net_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1124,7 +1124,8 @@ namespace eosio {
connection_ptr conn = weak_this.lock();
if (conn) {
if (close_after_send != no_reason) {
elog ("sent a go away message: ${r}, closing connection to ${p}",("r", reason_str(close_after_send))("p", conn->peer_name()));
fc_elog( logger, "sent a go away message: ${r}, closing connection to ${p}",
("r", reason_str(close_after_send))("p", conn->peer_name()) );
my_impl->close(conn);
return;
}
Expand Down Expand Up @@ -1190,6 +1191,13 @@ namespace eosio {
if( !peer_addr.empty() ) {
return peer_addr;
}
if( socket != nullptr ) {
boost::system::error_code ec;
auto rep = socket->remote_endpoint(ec);
if( !ec ) {
return rep.address().to_string() + ':' + std::to_string( rep.port() );
}
}
return "connecting client";
}

Expand Down

0 comments on commit 797f194

Please sign in to comment.