mirror of
https://github.com/oxen-io/lokinet.git
synced 2024-11-11 07:10:36 +00:00
273270916e
This commit reflects changes to clang-format rules. Unfortunately, these rule changes create a massive change to the codebase, which causes an apparent rewrite of git history. Git blame's --ignore-rev flag can be used to ignore this commit when attempting to `git blame` some code.
36 lines
1.0 KiB
C++
36 lines
1.0 KiB
C++
#include <path/ihophandler.hpp>
|
|
|
|
namespace llarp
|
|
{
|
|
namespace path
|
|
{
|
|
// handle data in upstream direction
|
|
bool
|
|
IHopHandler::HandleUpstream(const llarp_buffer_t& X, const TunnelNonce& Y, AbstractRouter*)
|
|
{
|
|
if (m_UpstreamQueue == nullptr)
|
|
m_UpstreamQueue = std::make_shared<TrafficQueue_t>();
|
|
m_UpstreamQueue->emplace_back();
|
|
auto& pkt = m_UpstreamQueue->back();
|
|
pkt.first.resize(X.sz);
|
|
std::copy_n(X.base, X.sz, pkt.first.begin());
|
|
pkt.second = Y;
|
|
return true;
|
|
}
|
|
|
|
// handle data in downstream direction
|
|
bool
|
|
IHopHandler::HandleDownstream(const llarp_buffer_t& X, const TunnelNonce& Y, AbstractRouter*)
|
|
{
|
|
if (m_DownstreamQueue == nullptr)
|
|
m_DownstreamQueue = std::make_shared<TrafficQueue_t>();
|
|
m_DownstreamQueue->emplace_back();
|
|
auto& pkt = m_DownstreamQueue->back();
|
|
pkt.first.resize(X.sz);
|
|
std::copy_n(X.base, X.sz, pkt.first.begin());
|
|
pkt.second = Y;
|
|
return true;
|
|
}
|
|
} // namespace path
|
|
} // namespace llarp
|