mirror of https://github.com/oxen-io/lokinet
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
946 B
C++
37 lines
946 B
C++
#include "abstracthophandler.hpp"
|
|
#include <llarp/router/router.hpp>
|
|
|
|
namespace llarp::path
|
|
{
|
|
// handle data in upstream direction
|
|
bool
|
|
AbstractHopHandler::HandleUpstream(const llarp_buffer_t& X, const TunnelNonce& Y, Router* r)
|
|
{
|
|
auto& pkt = m_UpstreamQueue.emplace_back();
|
|
pkt.first.resize(X.sz);
|
|
std::copy_n(X.base, X.sz, pkt.first.begin());
|
|
pkt.second = Y;
|
|
r->TriggerPump();
|
|
return true;
|
|
}
|
|
|
|
// handle data in downstream direction
|
|
bool
|
|
AbstractHopHandler::HandleDownstream(const llarp_buffer_t& X, const TunnelNonce& Y, Router* r)
|
|
{
|
|
auto& pkt = m_DownstreamQueue.emplace_back();
|
|
pkt.first.resize(X.sz);
|
|
std::copy_n(X.base, X.sz, pkt.first.begin());
|
|
pkt.second = Y;
|
|
r->TriggerPump();
|
|
return true;
|
|
}
|
|
|
|
void
|
|
AbstractHopHandler::DecayFilters(llarp_time_t now)
|
|
{
|
|
m_UpstreamReplayFilter.Decay(now);
|
|
m_DownstreamReplayFilter.Decay(now);
|
|
}
|
|
} // namespace llarp::path
|