From 60351f267715d0a3e15963c6e3f5283af5f36ba4 Mon Sep 17 00:00:00 2001 From: orignal Date: Tue, 17 Mar 2015 20:56:51 -0400 Subject: [PATCH] send exporatory message directly if connected to a floodfill --- NetDb.cpp | 2 ++ Transports.cpp | 6 ++++++ Transports.h | 3 ++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/NetDb.cpp b/NetDb.cpp index fbddb57f..061fe1e2 100644 --- a/NetDb.cpp +++ b/NetDb.cpp @@ -828,6 +828,8 @@ namespace data if (floodfill && !floodfills.count (floodfill.get ())) // request floodfill only once { floodfills.insert (floodfill.get ()); + if (i2p::transport::transports.IsConnected (floodfill->GetIdentHash ())) + throughTunnels = false; if (throughTunnels) { msgs.push_back (i2p::tunnel::TunnelMessageBlock diff --git a/Transports.cpp b/Transports.cpp index 00fd6bf0..c8d413e7 100644 --- a/Transports.cpp +++ b/Transports.cpp @@ -474,6 +474,12 @@ namespace transport }); } + bool Transports::IsConnected (const i2p::data::IdentHash& ident) const + { + auto it = m_Peers.find (ident); + return it != m_Peers.end (); + } + void Transports::HandlePeerCleanupTimer (const boost::system::error_code& ecode) { if (ecode != boost::asio::error::operation_aborted) diff --git a/Transports.h b/Transports.h index 173ff87d..bcec3daa 100644 --- a/Transports.h +++ b/Transports.h @@ -88,7 +88,8 @@ namespace transport void PeerConnected (std::shared_ptr session); void PeerDisconnected (std::shared_ptr session); - + bool IsConnected (const i2p::data::IdentHash& ident) const; + void UpdateSentBytes (uint64_t numBytes) { m_TotalSentBytes += numBytes; }; void UpdateReceivedBytes (uint64_t numBytes) { m_TotalReceivedBytes += numBytes; }; uint64_t GetTotalSentBytes () const { return m_TotalSentBytes; };