Rename EventLoop::udp to EventLoop::make_udp

Makes it consistent with the make_waker, etc.

Also removes some debugging.
pull/1557/head
Jason Rhinelander 3 years ago
parent afd856bca0
commit 36edabd9b0

@ -14,8 +14,8 @@ namespace llarp::dns
Proxy::Proxy(EventLoop_ptr loop, IQueryHandler* h)
: PacketHandler{loop, h}, m_Loop(std::move(loop))
{
m_Server =
m_Loop->udp([this](UDPHandle&, SockAddr a, OwnedBuffer buf) { HandlePacket(a, a, buf); });
m_Server = m_Loop->make_udp(
[this](UDPHandle&, SockAddr a, OwnedBuffer buf) { HandlePacket(a, a, buf); });
}
void

@ -175,13 +175,13 @@ namespace llarp
virtual void
stop() = 0;
virtual ~EventLoop() = default;
using UDPReceiveFunc = std::function<void(UDPHandle&, SockAddr src, llarp::OwnedBuffer buf)>;
// Constructs a UDP socket that can be used for sending and/or receiving
virtual std::shared_ptr<UDPHandle>
udp(UDPReceiveFunc on_recv) = 0;
virtual ~EventLoop() = default;
make_udp(UDPReceiveFunc on_recv) = 0;
/// set the function that is called once per cycle the flush all the queues
virtual void

@ -146,7 +146,7 @@ namespace llarp::uv
}
std::shared_ptr<llarp::UDPHandle>
Loop::udp(UDPReceiveFunc on_recv)
Loop::make_udp(UDPReceiveFunc on_recv)
{
return std::static_pointer_cast<llarp::UDPHandle>(
std::make_shared<llarp::uv::UDPHandle>(*m_Impl, std::move(on_recv)));

@ -62,7 +62,7 @@ namespace llarp::uv
make_repeater() override;
std::shared_ptr<llarp::UDPHandle>
udp(UDPReceiveFunc on_recv) override;
make_udp(UDPReceiveFunc on_recv) override;
void
FlushLogic();

@ -3,7 +3,7 @@
namespace llarp
{
// Base type for UDP handling; constructed via EventLoop::udp().
// Base type for UDP handling; constructed via EventLoop::make_udp().
struct UDPHandle
{
using ReceiveFunc = EventLoop::UDPReceiveFunc;

@ -128,10 +128,8 @@ namespace llarp
bool
ILinkLayer::Configure(EventLoop_ptr loop, const std::string& ifname, int af, uint16_t port)
{
LogError("omg wtf");
m_Loop = std::move(loop);
// using UDPReceiveFunc = std::function<void(UDPHandle&, SockAddr src, llarp::OwnedBuffer buf)>;
m_udp = m_Loop->udp(
m_udp = m_Loop->make_udp(
[this]([[maybe_unused]] UDPHandle& udp, const SockAddr& from, llarp_buffer_t buf) {
ILinkSession::Packet_t pkt;
pkt.resize(buf.sz);

Loading…
Cancel
Save