handover should be fixed now

pull/834/head
jeff 5 years ago
parent 993e4c2637
commit 7c691cf334

@ -434,6 +434,16 @@ namespace llarp
itr->second.lastUsed = Now();
}
void
Endpoint::MarkConvoTagActive(const ConvoTag& tag)
{
auto itr = Sessions().find(tag);
if(itr != Sessions().end())
{
itr->second.lastUsed = Now();
}
}
bool
Endpoint::LoadKeyFile()
{
@ -1048,7 +1058,10 @@ namespace llarp
util::Lock lock(&m_state->m_SendQueueMutex);
// send outbound traffic
for(const auto& item : m_state->m_SendQueue)
{
item.second->SendRoutingMessage(*item.first, router);
MarkConvoTagActive(item.first->T.T);
}
m_state->m_SendQueue.clear();
}

@ -317,6 +317,9 @@ namespace llarp
void
RemoveConvoTag(const ConvoTag& remote) override;
void
MarkConvoTagActive(const ConvoTag& remote) override;
void
PutReplyIntroFor(const ConvoTag& remote,
const Introduction& intro) override;

@ -96,6 +96,7 @@ namespace llarp
itr->second->Tick(now);
if(itr->second->Pump(now))
{
LogInfo("marking session as dead T=", itr->first);
itr->second->Stop();
deadSessions.emplace(std::move(*itr));
itr = remoteSessions.erase(itr);

@ -29,6 +29,9 @@ namespace llarp
PutCachedSessionKeyFor(const ConvoTag& remote,
const SharedSecret& secret) = 0;
virtual void
MarkConvoTagActive(const ConvoTag& tag) = 0;
virtual void
RemoveConvoTag(const ConvoTag& remote) = 0;

@ -259,6 +259,10 @@ namespace llarp
else
++itr;
}
if(currentIntroSet.HasExpiredIntros(now))
{
UpdateIntroSet(true);
}
// send control message if we look too quiet
if(lastGoodSend)
{
@ -275,7 +279,6 @@ namespace llarp
tmp.Randomize();
llarp_buffer_t buf(tmp.data(), tmp.size());
AsyncEncryptAndSendTo(buf, eProtocolControl);
return !m_DataHandler->HasConvoTag(currentConvoTag);
}
}
}
@ -316,10 +319,7 @@ namespace llarp
{
if(markedBad)
return false;
const bool should =
(!(path::Builder::BuildCooldownHit(now)
|| path::Builder::NumInStatus(path::ePathBuilding) >= numPaths))
&& path::Builder::ShouldBuildMore(now);
const bool should = path::Builder::BuildCooldownHit(now);
if(!ReadyToSend())
{

@ -43,6 +43,7 @@ namespace llarp
if(item.second->SendRoutingMessage(*item.first, r))
{
lastGoodSend = r->Now();
m_Endpoint->MarkConvoTagActive(item.first->T.T);
}
else
LogError(m_Endpoint->Name(), " failed to send frame on path");

@ -18,9 +18,8 @@ namespace llarp
bool
Session::IsExpired(llarp_time_t now, llarp_time_t lifetime) const
{
if(now <= lastUsed)
return intro.IsExpired(now);
return now - lastUsed > lifetime || intro.IsExpired(now);
return now > lastUsed
&& (now - lastUsed > lifetime || intro.IsExpired(now));
}
} // namespace service

Loading…
Cancel
Save