From 73572b317b6ae4534ba2b5e7a637c1de8ce5e8eb Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Tue, 30 Mar 2021 10:16:25 -0400 Subject: [PATCH] stuff --- llarp/exit/endpoint.cpp | 2 +- llarp/handlers/null.hpp | 1 - llarp/rpc/rpc_server.cpp | 20 ++++++++++++++------ 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/llarp/exit/endpoint.cpp b/llarp/exit/endpoint.cpp index 9a442090a..b2e479108 100644 --- a/llarp/exit/endpoint.cpp +++ b/llarp/exit/endpoint.cpp @@ -119,7 +119,7 @@ namespace llarp if (not quic) return false; quic->receive_packet(tag, buf.underlying); - return false; + return true; } // queue overflow if (m_UpstreamQueue.size() > MaxUpstreamQueueSize) diff --git a/llarp/handlers/null.hpp b/llarp/handlers/null.hpp index 34dbafb35..20f17a855 100644 --- a/llarp/handlers/null.hpp +++ b/llarp/handlers/null.hpp @@ -26,7 +26,6 @@ namespace llarp service::ProtocolType t, uint64_t) override { - if (t == service::ProtocolType::Control) return true; diff --git a/llarp/rpc/rpc_server.cpp b/llarp/rpc/rpc_server.cpp index 21a3a9bbf..74a5372fb 100644 --- a/llarp/rpc/rpc_server.cpp +++ b/llarp/rpc/rpc_server.cpp @@ -170,7 +170,7 @@ namespace llarp::rpc SockAddr laddr{}; laddr.fromString(bindAddr); - r->loop()->call([reply, endpoint, r, remoteHost, port, closeID]() { + r->loop()->call([reply, endpoint, r, remoteHost, port, closeID, laddr]() { auto ep = GetEndpointByName(r, endpoint); if (not ep) { @@ -190,11 +190,19 @@ namespace llarp::rpc return; } - auto [addr, id] = quic->open(remoteHost, port); - util::StatusObject status; - status["addr"] = addr.toString(); - status["id"] = id; - reply(CreateJSONResponse(status)); + try + { + auto [addr, id] = quic->open( + remoteHost, port, [](auto&&) {}, laddr); + util::StatusObject status; + status["addr"] = addr.toString(); + status["id"] = id; + reply(CreateJSONResponse(status)); + } + catch (std::exception& ex) + { + reply(CreateJSONError(ex.what())); + } }); }); })