aboutsummaryrefslogtreecommitdiff
path: root/src/p2p
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2016-03-28 18:59:09 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2016-03-28 18:59:09 +0100
commitef4ff4252ac9c04f8c028f5518fa7088dc3b4f98 (patch)
tree3924ef14d27b3885dfe54ca00d6ab59971be74db /src/p2p
parentMerge pull request #765 (diff)
downloadmonero-ef4ff4252ac9c04f8c028f5518fa7088dc3b4f98.tar.xz
connection_basic: avoid gratuitous exception
The remote endpoint is usually invalid, so use a version of the call that returns an error code instead.
Diffstat (limited to 'src/p2p')
-rw-r--r--src/p2p/connection_basic.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/p2p/connection_basic.cpp b/src/p2p/connection_basic.cpp
index c0b73bc3e..df702134e 100644
--- a/src/p2p/connection_basic.cpp
+++ b/src/p2p/connection_basic.cpp
@@ -161,7 +161,7 @@ connection_basic::connection_basic(boost::asio::io_service& io_service, std::ato
mI->m_peer_number = sock_number.fetch_add(1); // use, and increase the generated number
string remote_addr_str = "?";
- try { remote_addr_str = socket_.remote_endpoint().address().to_string(); } catch(...){} ;
+ try { boost::system::error_code e; remote_addr_str = socket_.remote_endpoint(e).address().to_string(); } catch(...){} ;
_note("Spawned connection p2p#"<<mI->m_peer_number<<" to " << remote_addr_str << " currently we have sockets count:" << m_ref_sock_count);
//boost::filesystem::create_directories("log/dr-monero/net/");
@@ -170,7 +170,7 @@ connection_basic::connection_basic(boost::asio::io_service& io_service, std::ato
connection_basic::~connection_basic() {
string remote_addr_str = "?";
m_ref_sock_count--;
- try { remote_addr_str = socket_.remote_endpoint().address().to_string(); } catch(...){} ;
+ try { boost::system::error_code e; remote_addr_str = socket_.remote_endpoint(e).address().to_string(); } catch(...){} ;
_note("Destructing connection p2p#"<<mI->m_peer_number << " to " << remote_addr_str);
}