diff options
| author | Riccardo Spagni <ric@spagni.net> | 2016-04-02 12:02:33 +0900 |
|---|---|---|
| committer | Riccardo Spagni <ric@spagni.net> | 2016-04-02 12:02:33 +0900 |
| commit | 2572706c2c9c5eadf9487fff62bf3cea25aefc19 (patch) | |
| tree | 173f5300d2176fb1b851ca4bbdd021af2403e704 | |
| parent | a38ad63f8f0c9941ea964519f8e9d25db5e594b2 (diff) | |
| parent | 43962f41031d85778e4ae5949ec1a6141a1bcac2 (diff) | |
| download | monzero-core-2572706c2c9c5eadf9487fff62bf3cea25aefc19.tar.gz monzero-core-2572706c2c9c5eadf9487fff62bf3cea25aefc19.tar.xz monzero-core-2572706c2c9c5eadf9487fff62bf3cea25aefc19.zip | |
Merge pull request #768
43962f4 abstract_tcp_server2: possible fix for exception in handle_accept (moneromooo-monero)
| -rw-r--r-- | contrib/epee/include/net/abstract_tcp_server2.inl | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/contrib/epee/include/net/abstract_tcp_server2.inl b/contrib/epee/include/net/abstract_tcp_server2.inl index 1c854dfb7..b3d4e5fdb 100644 --- a/contrib/epee/include/net/abstract_tcp_server2.inl +++ b/contrib/epee/include/net/abstract_tcp_server2.inl @@ -252,11 +252,24 @@ PRAGMA_WARNING_DISABLE_VS(4355) template<class t_protocol_handler> void connection<t_protocol_handler>::save_dbg_log() { + std::string address, port; + boost::system::error_code e; + + boost::asio::ip::tcp::endpoint endpoint = socket_.remote_endpoint(e); + if (e) + { + address = "<not connected>"; + port = "<not connected>"; + } + else + { + address = endpoint.address().to_string(); + port = boost::lexical_cast<std::string>(endpoint.port()); + } _mark_c("net/kind" , - " connection type " << to_string( m_connection_type ) << " " - << socket_.local_endpoint().address().to_string() << ":" << socket_.local_endpoint().port() - << " <--> " << socket_.remote_endpoint().address().to_string() << ":" << socket_.remote_endpoint().port() - ); + " connection type " << to_string( m_connection_type ) << " " + << socket_.local_endpoint().address().to_string() << ":" << socket_.local_endpoint().port() + << " <--> " << address << ":" << port); } //--------------------------------------------------------------------------------- template<class t_protocol_handler> |
