mirror of
https://github.com/oxen-io/lokinet.git
synced 2024-11-11 07:10:36 +00:00
* lessen replay filter window
* dont have transit hops use a replay filter * formatting
This commit is contained in:
parent
9c742b36eb
commit
7a1ffc2df4
@ -180,7 +180,7 @@ namespace llarp
|
|||||||
{
|
{
|
||||||
if (m_TXMsgs.size() >= MaxSendQueueSize)
|
if (m_TXMsgs.size() >= MaxSendQueueSize)
|
||||||
{
|
{
|
||||||
if(completed)
|
if (completed)
|
||||||
completed(ILinkSession::DeliveryStatus::eDeliveryDropped);
|
completed(ILinkSession::DeliveryStatus::eDeliveryDropped);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -9,8 +9,6 @@ namespace llarp
|
|||||||
bool
|
bool
|
||||||
IHopHandler::HandleUpstream(const llarp_buffer_t& X, const TunnelNonce& Y, AbstractRouter* r)
|
IHopHandler::HandleUpstream(const llarp_buffer_t& X, const TunnelNonce& Y, AbstractRouter* r)
|
||||||
{
|
{
|
||||||
if (not m_UpstreamReplayFilter.Insert(Y))
|
|
||||||
return false;
|
|
||||||
if (m_UpstreamQueue == nullptr)
|
if (m_UpstreamQueue == nullptr)
|
||||||
m_UpstreamQueue = std::make_shared<TrafficQueue_t>();
|
m_UpstreamQueue = std::make_shared<TrafficQueue_t>();
|
||||||
m_UpstreamQueue->emplace_back();
|
m_UpstreamQueue->emplace_back();
|
||||||
@ -26,8 +24,6 @@ namespace llarp
|
|||||||
bool
|
bool
|
||||||
IHopHandler::HandleDownstream(const llarp_buffer_t& X, const TunnelNonce& Y, AbstractRouter* r)
|
IHopHandler::HandleDownstream(const llarp_buffer_t& X, const TunnelNonce& Y, AbstractRouter* r)
|
||||||
{
|
{
|
||||||
if (not m_DownstreamReplayFilter.Insert(Y))
|
|
||||||
return false;
|
|
||||||
if (m_DownstreamQueue == nullptr)
|
if (m_DownstreamQueue == nullptr)
|
||||||
m_DownstreamQueue = std::make_shared<TrafficQueue_t>();
|
m_DownstreamQueue = std::make_shared<TrafficQueue_t>();
|
||||||
m_DownstreamQueue->emplace_back();
|
m_DownstreamQueue->emplace_back();
|
||||||
|
@ -63,6 +63,22 @@ namespace llarp
|
|||||||
m_BuiltHook = func;
|
m_BuiltHook = func;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
Path::HandleUpstream(const llarp_buffer_t& X, const TunnelNonce& Y, AbstractRouter* r)
|
||||||
|
{
|
||||||
|
if (not m_UpstreamReplayFilter.Insert(Y))
|
||||||
|
return false;
|
||||||
|
return IHopHandler::HandleUpstream(X, Y, r);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
Path::HandleDownstream(const llarp_buffer_t& X, const TunnelNonce& Y, AbstractRouter* r)
|
||||||
|
{
|
||||||
|
if (not m_DownstreamReplayFilter.Insert(Y))
|
||||||
|
return false;
|
||||||
|
return IHopHandler::HandleDownstream(X, Y, r);
|
||||||
|
}
|
||||||
|
|
||||||
RouterID
|
RouterID
|
||||||
Path::Endpoint() const
|
Path::Endpoint() const
|
||||||
{
|
{
|
||||||
@ -300,6 +316,8 @@ namespace llarp
|
|||||||
{"ready", IsReady()},
|
{"ready", IsReady()},
|
||||||
{"txRateCurrent", m_LastTXRate},
|
{"txRateCurrent", m_LastTXRate},
|
||||||
{"rxRateCurrent", m_LastRXRate},
|
{"rxRateCurrent", m_LastRXRate},
|
||||||
|
{"replayTX", m_UpstreamReplayFilter.Size()},
|
||||||
|
{"replayRX", m_DownstreamReplayFilter.Size()},
|
||||||
{"hasExit", SupportsAnyRoles(ePathRoleExit)}};
|
{"hasExit", SupportsAnyRoles(ePathRoleExit)}};
|
||||||
|
|
||||||
std::vector<util::StatusObject> hopsObj;
|
std::vector<util::StatusObject> hopsObj;
|
||||||
|
@ -200,6 +200,14 @@ namespace llarp
|
|||||||
return _status;
|
return _status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// handle data in upstream direction
|
||||||
|
bool
|
||||||
|
HandleUpstream(const llarp_buffer_t& X, const TunnelNonce& Y, AbstractRouter*) override;
|
||||||
|
// handle data in downstream direction
|
||||||
|
|
||||||
|
bool
|
||||||
|
HandleDownstream(const llarp_buffer_t& X, const TunnelNonce& Y, AbstractRouter*) override;
|
||||||
|
|
||||||
const std::string&
|
const std::string&
|
||||||
ShortName() const;
|
ShortName() const;
|
||||||
|
|
||||||
|
@ -12,8 +12,15 @@ namespace llarp
|
|||||||
{
|
{
|
||||||
using Time_t = std::chrono::milliseconds;
|
using Time_t = std::chrono::milliseconds;
|
||||||
|
|
||||||
DecayingHashSet(Time_t cacheInterval = 5s) : m_CacheInterval(cacheInterval)
|
DecayingHashSet(Time_t cacheInterval = 1s) : m_CacheInterval(cacheInterval)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
size_t
|
||||||
|
Size() const
|
||||||
|
{
|
||||||
|
return m_Values.size();
|
||||||
|
}
|
||||||
|
|
||||||
/// determine if we have v contained in our decaying hashset
|
/// determine if we have v contained in our decaying hashset
|
||||||
bool
|
bool
|
||||||
Contains(const Val_t& v) const
|
Contains(const Val_t& v) const
|
||||||
@ -38,6 +45,7 @@ namespace llarp
|
|||||||
if (now == 0s)
|
if (now == 0s)
|
||||||
now = llarp::time_now_ms();
|
now = llarp::time_now_ms();
|
||||||
EraseIf([&](const auto& item) { return (m_CacheInterval + item.second) <= now; });
|
EraseIf([&](const auto& item) { return (m_CacheInterval + item.second) <= now; });
|
||||||
|
m_Values.rehash(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
Time_t
|
Time_t
|
||||||
|
Loading…
Reference in New Issue
Block a user