Browse Source

keep sending through first successive routing path

pull/1542/head
orignal 5 years ago
parent
commit
1e609acb03
  1. 20
      libi2pd/Datagram.cpp
  2. 1
      libi2pd/Datagram.h

20
libi2pd/Datagram.cpp

@ -296,7 +296,23 @@ namespace datagram
} }
if (!m_RoutingSession || !m_RoutingSession->GetOwner ()) if (!m_RoutingSession || !m_RoutingSession->GetOwner ())
m_RoutingSession = m_LocalDestination->GetRoutingSession(m_RemoteLeaseSet, true); {
bool found = false;
for (auto& it: m_PendingRoutingSessions)
if (it->GetOwner ()) // found established session
{
m_RoutingSession = it;
m_PendingRoutingSessions.clear ();
found = true;
break;
}
if (!found)
{
m_RoutingSession = m_LocalDestination->GetRoutingSession(m_RemoteLeaseSet, true);
if (!m_RoutingSession->GetOwner ())
m_PendingRoutingSessions.push_back (m_RoutingSession);
}
}
auto path = m_RoutingSession->GetSharedRoutingPath(); auto path = m_RoutingSession->GetSharedRoutingPath();
if (path) if (path)
@ -345,8 +361,6 @@ namespace datagram
auto idx = rand() % sz; auto idx = rand() % sz;
path->remoteLease = ls[idx]; path->remoteLease = ls[idx];
} }
} }
else else
{ {

1
libi2pd/Datagram.h

@ -95,6 +95,7 @@ namespace datagram
i2p::data::IdentHash m_RemoteIdent; i2p::data::IdentHash m_RemoteIdent;
std::shared_ptr<const i2p::data::LeaseSet> m_RemoteLeaseSet; std::shared_ptr<const i2p::data::LeaseSet> m_RemoteLeaseSet;
std::shared_ptr<i2p::garlic::GarlicRoutingSession> m_RoutingSession; std::shared_ptr<i2p::garlic::GarlicRoutingSession> m_RoutingSession;
std::vector<std::shared_ptr<i2p::garlic::GarlicRoutingSession> > m_PendingRoutingSessions;
std::vector<std::shared_ptr<I2NPMessage> > m_SendQueue; std::vector<std::shared_ptr<I2NPMessage> > m_SendQueue;
uint64_t m_LastUse; uint64_t m_LastUse;
bool m_RequestingLS; bool m_RequestingLS;

Loading…
Cancel
Save