diff --git a/llarp/dns/server.cpp b/llarp/dns/server.cpp index 368f44a9c..2c7dae55a 100644 --- a/llarp/dns/server.cpp +++ b/llarp/dns/server.cpp @@ -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 diff --git a/llarp/ev/ev.hpp b/llarp/ev/ev.hpp index e68069761..737fc7774 100644 --- a/llarp/ev/ev.hpp +++ b/llarp/ev/ev.hpp @@ -175,13 +175,13 @@ namespace llarp virtual void stop() = 0; + virtual ~EventLoop() = default; + using UDPReceiveFunc = std::function; // Constructs a UDP socket that can be used for sending and/or receiving virtual std::shared_ptr - 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 diff --git a/llarp/ev/ev_libuv.cpp b/llarp/ev/ev_libuv.cpp index 6fc66fcae..c4b758515 100644 --- a/llarp/ev/ev_libuv.cpp +++ b/llarp/ev/ev_libuv.cpp @@ -146,7 +146,7 @@ namespace llarp::uv } std::shared_ptr - Loop::udp(UDPReceiveFunc on_recv) + Loop::make_udp(UDPReceiveFunc on_recv) { return std::static_pointer_cast( std::make_shared(*m_Impl, std::move(on_recv))); diff --git a/llarp/ev/ev_libuv.hpp b/llarp/ev/ev_libuv.hpp index dc1a82a35..cfd19cf3b 100644 --- a/llarp/ev/ev_libuv.hpp +++ b/llarp/ev/ev_libuv.hpp @@ -62,7 +62,7 @@ namespace llarp::uv make_repeater() override; std::shared_ptr - udp(UDPReceiveFunc on_recv) override; + make_udp(UDPReceiveFunc on_recv) override; void FlushLogic(); diff --git a/llarp/ev/udp_handle.hpp b/llarp/ev/udp_handle.hpp index 40a92dfe6..94d24c950 100644 --- a/llarp/ev/udp_handle.hpp +++ b/llarp/ev/udp_handle.hpp @@ -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; diff --git a/llarp/link/server.cpp b/llarp/link/server.cpp index a806e709c..9c8a1fdc1 100644 --- a/llarp/link/server.cpp +++ b/llarp/link/server.cpp @@ -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; - 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);