mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-03-07 06:09:42 +00:00
Merge branch 'upstream-openssl' into meshnet
This commit is contained in:
28
Tunnel.cpp
28
Tunnel.cpp
@@ -769,6 +769,22 @@ namespace tunnel
|
||||
return newTunnel;
|
||||
}
|
||||
|
||||
std::shared_ptr<InboundTunnel> Tunnels::CreateInboundTunnel (std::shared_ptr<TunnelConfig> config, std::shared_ptr<OutboundTunnel> outboundTunnel)
|
||||
{
|
||||
if (config->IsEmpty ())
|
||||
return CreateZeroHopsInboundTunnel ();
|
||||
else
|
||||
return CreateTunnel<InboundTunnel>(config, outboundTunnel);
|
||||
}
|
||||
|
||||
std::shared_ptr<OutboundTunnel> Tunnels::CreateOutboundTunnel (std::shared_ptr<TunnelConfig> config)
|
||||
{
|
||||
if (config->IsEmpty ())
|
||||
return CreateZeroHopsOutboundTunnel ();
|
||||
else
|
||||
return CreateTunnel<OutboundTunnel>(config);
|
||||
}
|
||||
|
||||
void Tunnels::AddPendingTunnel (uint32_t replyMsgID, std::shared_ptr<InboundTunnel> tunnel)
|
||||
{
|
||||
m_PendingInboundTunnels[replyMsgID] = tunnel;
|
||||
@@ -816,20 +832,22 @@ namespace tunnel
|
||||
}
|
||||
|
||||
|
||||
void Tunnels::CreateZeroHopsInboundTunnel ()
|
||||
std::shared_ptr<ZeroHopsInboundTunnel> Tunnels::CreateZeroHopsInboundTunnel ()
|
||||
{
|
||||
auto inboundTunnel = std::make_shared<ZeroHopsInboundTunnel> ();
|
||||
inboundTunnel->SetState (eTunnelStateEstablished);
|
||||
m_InboundTunnels.push_back (inboundTunnel);
|
||||
m_Tunnels[inboundTunnel->GetTunnelID ()] = inboundTunnel;
|
||||
return inboundTunnel;
|
||||
}
|
||||
|
||||
void Tunnels::CreateZeroHopsOutboundTunnel ()
|
||||
std::shared_ptr<ZeroHopsOutboundTunnel> Tunnels::CreateZeroHopsOutboundTunnel ()
|
||||
{
|
||||
auto outboundTunnel = std::make_shared<ZeroHopsOutboundTunnel> ();
|
||||
outboundTunnel->SetState (eTunnelStateEstablished);
|
||||
m_OutboundTunnels.push_back (outboundTunnel);
|
||||
// we don't insert into m_Tunnels
|
||||
return outboundTunnel;
|
||||
}
|
||||
|
||||
int Tunnels::GetTransitTunnelsExpirationTimeout ()
|
||||
@@ -862,12 +880,6 @@ namespace tunnel
|
||||
// TODO: locking
|
||||
return m_OutboundTunnels.size();
|
||||
}
|
||||
|
||||
#ifdef ANDROID_ARM7A
|
||||
template std::shared_ptr<InboundTunnel> Tunnels::CreateTunnel<InboundTunnel>(std::shared_ptr<TunnelConfig>, std::shared_ptr<OutboundTunnel>);
|
||||
template std::shared_ptr<OutboundTunnel> Tunnels::CreateTunnel<OutboundTunnel>(std::shared_ptr<TunnelConfig>, std::shared_ptr<OutboundTunnel>);
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user