2021-03-09 22:24:35 +00:00
|
|
|
#include "ihophandler.hpp"
|
|
|
|
#include <llarp/router/abstractrouter.hpp>
|
2019-09-16 16:21:21 +00:00
|
|
|
|
|
|
|
namespace llarp
|
|
|
|
{
|
|
|
|
namespace path
|
|
|
|
{
|
|
|
|
// handle data in upstream direction
|
|
|
|
bool
|
2021-03-03 19:35:20 +00:00
|
|
|
IHopHandler::HandleUpstream(const llarp_buffer_t& X, const TunnelNonce& Y, AbstractRouter* r)
|
2019-09-16 16:21:21 +00:00
|
|
|
{
|
2021-11-15 14:20:57 +00:00
|
|
|
auto& pkt = m_UpstreamQueue.emplace_back();
|
2019-09-16 16:21:21 +00:00
|
|
|
pkt.first.resize(X.sz);
|
|
|
|
std::copy_n(X.base, X.sz, pkt.first.begin());
|
|
|
|
pkt.second = Y;
|
2021-11-12 13:51:39 +00:00
|
|
|
r->TriggerPump();
|
2019-09-16 16:21:21 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// handle data in downstream direction
|
|
|
|
bool
|
2021-03-03 19:35:20 +00:00
|
|
|
IHopHandler::HandleDownstream(const llarp_buffer_t& X, const TunnelNonce& Y, AbstractRouter* r)
|
2019-09-16 16:21:21 +00:00
|
|
|
{
|
2021-11-15 14:20:57 +00:00
|
|
|
auto& pkt = m_DownstreamQueue.emplace_back();
|
2019-09-16 16:21:21 +00:00
|
|
|
pkt.first.resize(X.sz);
|
|
|
|
std::copy_n(X.base, X.sz, pkt.first.begin());
|
|
|
|
pkt.second = Y;
|
2021-11-12 13:51:39 +00:00
|
|
|
r->TriggerPump();
|
2019-09-16 16:21:21 +00:00
|
|
|
return true;
|
|
|
|
}
|
2020-05-21 14:23:54 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
IHopHandler::DecayFilters(llarp_time_t now)
|
|
|
|
{
|
|
|
|
m_UpstreamReplayFilter.Decay(now);
|
|
|
|
m_DownstreamReplayFilter.Decay(now);
|
|
|
|
}
|
2019-09-16 16:21:21 +00:00
|
|
|
} // namespace path
|
2020-01-03 11:04:47 +00:00
|
|
|
} // namespace llarp
|