mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 04:04:16 +00:00
fixed broken re-created tunnels
This commit is contained in:
parent
1a72292b8f
commit
6e70c04516
@ -89,7 +89,7 @@ namespace tunnel
|
|||||||
|
|
||||||
|
|
||||||
TunnelConfig (std::vector<const i2p::data::RouterInfo *> peers,
|
TunnelConfig (std::vector<const i2p::data::RouterInfo *> peers,
|
||||||
const TunnelConfig * replyTunnelConfig = nullptr) // replyTunnelConfig=0 means inbound
|
const TunnelConfig * replyTunnelConfig = nullptr) // replyTunnelConfig=nullptr means inbound
|
||||||
{
|
{
|
||||||
TunnelHopConfig * prev = nullptr;
|
TunnelHopConfig * prev = nullptr;
|
||||||
for (auto it: peers)
|
for (auto it: peers)
|
||||||
@ -195,23 +195,14 @@ namespace tunnel
|
|||||||
|
|
||||||
TunnelConfig * Clone (const TunnelConfig * replyTunnelConfig = nullptr) const
|
TunnelConfig * Clone (const TunnelConfig * replyTunnelConfig = nullptr) const
|
||||||
{
|
{
|
||||||
TunnelConfig * newConfig = new TunnelConfig ();
|
std::vector<const i2p::data::RouterInfo *> peers;
|
||||||
TunnelHopConfig * hop = m_FirstHop, * prev = nullptr;
|
TunnelHopConfig * hop = m_FirstHop;
|
||||||
while (hop)
|
while (hop)
|
||||||
{
|
{
|
||||||
TunnelHopConfig * newHop = new TunnelHopConfig (hop->router);
|
peers.push_back (hop->router);
|
||||||
newHop->SetPrev (prev);
|
|
||||||
newHop->SetNextRouter (hop->nextRouter);
|
|
||||||
newHop->isGateway = hop->isGateway;
|
|
||||||
newHop->isEndpoint = hop->isEndpoint;
|
|
||||||
prev = newHop;
|
|
||||||
if (!newConfig->m_FirstHop) newConfig->m_FirstHop = newHop;
|
|
||||||
hop = hop->next;
|
hop = hop->next;
|
||||||
}
|
}
|
||||||
newConfig->m_LastHop = prev;
|
return new TunnelConfig (peers, replyTunnelConfig);
|
||||||
if (replyTunnelConfig && newConfig->m_LastHop)
|
|
||||||
newConfig->m_LastHop->SetReplyHop (replyTunnelConfig->GetFirstHop ());
|
|
||||||
return newConfig;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user