|
|
@ -45,22 +45,17 @@ namespace garlic
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!m_SharedRoutingPath) return nullptr;
|
|
|
|
if (!m_SharedRoutingPath) return nullptr;
|
|
|
|
uint32_t ts = i2p::util::GetSecondsSinceEpoch ();
|
|
|
|
uint32_t ts = i2p::util::GetSecondsSinceEpoch ();
|
|
|
|
if (m_SharedRoutingPath->numTimesUsed >= ROUTING_PATH_MAX_NUM_TIMES_USED ||
|
|
|
|
if (!m_SharedRoutingPath->outboundTunnel->IsEstablished () ||
|
|
|
|
!m_SharedRoutingPath->outboundTunnel->IsEstablished () ||
|
|
|
|
|
|
|
|
ts*1000LL > m_SharedRoutingPath->remoteLease->endDate ||
|
|
|
|
ts*1000LL > m_SharedRoutingPath->remoteLease->endDate ||
|
|
|
|
ts > m_SharedRoutingPath->updateTime + ROUTING_PATH_EXPIRATION_TIMEOUT)
|
|
|
|
ts > m_SharedRoutingPath->updateTime + ROUTING_PATH_EXPIRATION_TIMEOUT)
|
|
|
|
m_SharedRoutingPath = nullptr;
|
|
|
|
m_SharedRoutingPath = nullptr;
|
|
|
|
if (m_SharedRoutingPath) m_SharedRoutingPath->numTimesUsed++;
|
|
|
|
|
|
|
|
return m_SharedRoutingPath;
|
|
|
|
return m_SharedRoutingPath;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GarlicRoutingSession::SetSharedRoutingPath (std::shared_ptr<GarlicRoutingPath> path)
|
|
|
|
void GarlicRoutingSession::SetSharedRoutingPath (std::shared_ptr<GarlicRoutingPath> path)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (path && path->outboundTunnel && path->remoteLease)
|
|
|
|
if (path && path->outboundTunnel && path->remoteLease)
|
|
|
|
{
|
|
|
|
|
|
|
|
path->updateTime = i2p::util::GetSecondsSinceEpoch ();
|
|
|
|
path->updateTime = i2p::util::GetSecondsSinceEpoch ();
|
|
|
|
path->numTimesUsed = 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
else
|
|
|
|
path = nullptr;
|
|
|
|
path = nullptr;
|
|
|
|
m_SharedRoutingPath = path;
|
|
|
|
m_SharedRoutingPath = path;
|
|
|
|