From 392dbb71da0d0f022344a3ced626113aab985168 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Thu, 23 Oct 2008 04:10:23 +0000 Subject: [PATCH] more fixes to avoid unwanted exceptions --- src/peer_connection.cpp | 12 +++++++----- src/policy.cpp | 3 ++- src/torrent.cpp | 3 ++- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/peer_connection.cpp b/src/peer_connection.cpp index e87412d16..47165a132 100644 --- a/src/peer_connection.cpp +++ b/src/peer_connection.cpp @@ -155,7 +155,8 @@ namespace libtorrent #endif #endif #if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_ERROR_LOGGING - m_logger = m_ses.create_log(m_remote.address().to_string() + "_" + error_code ec; + m_logger = m_ses.create_log(m_remote.address().to_string(ec) + "_" + boost::lexical_cast(m_remote.port()), m_ses.listen_port()); (*m_logger) << "*** OUTGOING CONNECTION\n"; #endif @@ -2423,7 +2424,8 @@ namespace libtorrent { TORRENT_ASSERT(m_connecting); #if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING || defined TORRENT_ERROR_LOGGING - (*m_ses.m_logger) << time_now_string() << " CONNECTION TIMED OUT: " << m_remote.address().to_string() + error_code ec; + (*m_ses.m_logger) << time_now_string() << " CONNECTION TIMED OUT: " << m_remote.address().to_string(ec) << "\n"; #endif disconnect("timed out: connect", 1); @@ -3709,10 +3711,11 @@ namespace libtorrent m_connecting = false; m_ses.m_half_open.done(m_connection_ticket); + error_code ec; if (e) { #if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING || defined TORRENT_ERROR_LOGGING - (*m_ses.m_logger) << time_now_string() << " CONNECTION FAILED: " << m_remote.address().to_string() + (*m_ses.m_logger) << time_now_string() << " CONNECTION FAILED: " << m_remote.address().to_string(ec) << ": " << e.message() << "\n"; #endif disconnect(e.message().c_str(), 1); @@ -3728,11 +3731,10 @@ namespace libtorrent TORRENT_ASSERT(m_socket); #if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING - (*m_ses.m_logger) << time_now_string() << " COMPLETED: " << m_remote.address().to_string() + (*m_ses.m_logger) << time_now_string() << " COMPLETED: " << m_remote.address().to_string(ec) << " rtt = " << m_rtt << "\n"; #endif - error_code ec; if (m_remote == m_socket->local_endpoint(ec)) { // if the remote endpoint is the same as the local endpoint, we're connected diff --git a/src/policy.cpp b/src/policy.cpp index db9861373..2c67d9f8a 100644 --- a/src/policy.cpp +++ b/src/policy.cpp @@ -825,7 +825,8 @@ namespace libtorrent // to this peer. don't connect to // it again. - m_torrent->debug_log("already connected to peer: " + remote.address().to_string() + ":" + error_code ec; + m_torrent->debug_log("already connected to peer: " + remote.address().to_string(ec) + ":" + boost::lexical_cast(remote.port()) + " " + boost::lexical_cast(i->second.connection->pid())); diff --git a/src/torrent.cpp b/src/torrent.cpp index 99839531d..670bc9c61 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -1088,7 +1088,8 @@ namespace libtorrent if (m_ses.m_ip_filter.access(host->endpoint().address()) & ip_filter::blocked) { #if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING || defined TORRENT_ERROR_LOGGING - debug_log("blocked ip from tracker: " + host->endpoint().address().to_string()); + error_code ec; + debug_log("blocked ip from tracker: " + host->endpoint().address().to_string(ec)); #endif if (m_ses.m_alerts.should_post()) {