From 05148a2579e1eb50b08bdbe75c2469bfb45543d8 Mon Sep 17 00:00:00 2001 From: orignal Date: Fri, 26 Sep 2014 19:22:13 -0400 Subject: [PATCH] request LeaseSet through destination's tunnels --- HTTPServer.cpp | 2 +- I2PTunnel.cpp | 4 ++-- NetDb.cpp | 10 +++++----- NetDb.h | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/HTTPServer.cpp b/HTTPServer.cpp index ef76cf6e..0834b4d2 100644 --- a/HTTPServer.cpp +++ b/HTTPServer.cpp @@ -742,7 +742,7 @@ namespace util auto leaseSet = i2p::data::netdb.FindLeaseSet (destination); if (!leaseSet || !leaseSet->HasNonExpiredLeases ()) { - i2p::data::netdb.Subscribe(destination); + i2p::data::netdb.Subscribe(destination, i2p::stream::GetSharedLocalDestination ()->GetTunnelPool ()); std::this_thread::sleep_for (std::chrono::seconds(10)); // wait for 10 seconds leaseSet = i2p::data::netdb.FindLeaseSet (destination); if (!leaseSet || !leaseSet->HasNonExpiredLeases ()) // still no LeaseSet diff --git a/I2PTunnel.cpp b/I2PTunnel.cpp index 8ade23bd..6095d1d0 100644 --- a/I2PTunnel.cpp +++ b/I2PTunnel.cpp @@ -170,7 +170,7 @@ namespace stream } if (m_DestinationIdentHash) { - i2p::data::netdb.Subscribe (*m_DestinationIdentHash); + i2p::data::netdb.Subscribe (*m_DestinationIdentHash, GetSharedLocalDestination ()->GetTunnelPool ()); m_RemoteLeaseSet = i2p::data::netdb.FindLeaseSet (*m_DestinationIdentHash); } else @@ -208,7 +208,7 @@ namespace stream if (identHash) { m_DestinationIdentHash = new i2p::data::IdentHash (*identHash); - i2p::data::netdb.Subscribe (*m_DestinationIdentHash); + i2p::data::netdb.Subscribe (*m_DestinationIdentHash, GetSharedLocalDestination ()->GetTunnelPool ()); } } } diff --git a/NetDb.cpp b/NetDb.cpp index 435e710b..53598411 100644 --- a/NetDb.cpp +++ b/NetDb.cpp @@ -368,7 +368,7 @@ namespace data i2p::tunnel::InboundTunnel * inbound = pool ? pool->GetNextInboundTunnel () :i2p::tunnel::tunnels.GetNextInboundTunnel (); if (inbound) { - RequestedDestination * dest = CreateRequestedDestination (destination, isLeaseSet, pool); + RequestedDestination * dest = CreateRequestedDestination (destination, true, false, pool); std::vector msgs; // request 3 closests floodfills for (int i = 0; i < 3; i++) @@ -401,7 +401,7 @@ namespace data } else // RouterInfo is requested directly { - RequestedDestination * dest = CreateRequestedDestination (destination, false, pool); + RequestedDestination * dest = CreateRequestedDestination (destination, false, false, pool); auto floodfill = GetClosestFloodfill (destination, dest->GetExcludedPeers ()); if (floodfill) i2p::transports.SendMessage (floodfill->GetIdentHash (), dest->CreateRequestMessage (floodfill->GetIdentHash ())); @@ -874,7 +874,7 @@ namespace data } else leaseSet->SetUnsolicited (false); - m_Subscriptions.insert (ident); + m_Subscriptions[ident] = pool; } void NetDb::Unsubscribe (const IdentHash& ident) @@ -886,11 +886,11 @@ namespace data { for (auto it : m_Subscriptions) { - LeaseSet * leaseSet = FindLeaseSet (it); + LeaseSet * leaseSet = FindLeaseSet (it.first); if (!leaseSet || leaseSet->HasExpiredLeases ()) { LogPrint ("LeaseSet re-requested"); - RequestDestination (it, true); + RequestDestination (it.first, true, it.second); } } } diff --git a/NetDb.h b/NetDb.h index 159644be..68e9e4ba 100644 --- a/NetDb.h +++ b/NetDb.h @@ -118,7 +118,7 @@ namespace data std::vector m_Floodfills; std::mutex m_RequestedDestinationsMutex; std::map m_RequestedDestinations; - std::set m_Subscriptions; + std::map m_Subscriptions; bool m_IsRunning; int m_ReseedRetries;