From cc42e8e623b44cf906ae0cae05f86352fa59c9b8 Mon Sep 17 00:00:00 2001 From: Ryan Tharp Date: Wed, 3 Oct 2018 04:00:47 -0700 Subject: [PATCH] guard, rename endpoint to context, main_router_endpoint_iterator() implementation --- llarp/context.cpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/llarp/context.cpp b/llarp/context.cpp index 1b3f3c5db..6ecd6f70e 100644 --- a/llarp/context.cpp +++ b/llarp/context.cpp @@ -318,6 +318,11 @@ extern "C" int llarp_main_run(struct llarp_main *ptr) { + if(!ptr) + { + llarp::LogError("No ptr passed in"); + return 0; + } return ptr->ctx->Run(); } @@ -470,15 +475,24 @@ extern "C" llarp::handlers::TunEndpoint * main_router_getFirstTunEndpoint(struct llarp_main *ptr) { - auto *endpoint = &ptr->ctx->router->hiddenServiceContext; - return endpoint->getFirstTun(); + auto *context = &ptr->ctx->router->hiddenServiceContext; + return context->getFirstTun(); + } + + //#include + bool + main_router_endpoint_iterator( + struct llarp_main *ptr, struct llarp::service::Context::endpoint_iter &i) + { + auto *context = &ptr->ctx->router->hiddenServiceContext; + return context->iterate(i); } llarp_tun_io * main_router_getRange(struct llarp_main *ptr) { - auto *endpoint = &ptr->ctx->router->hiddenServiceContext; - return endpoint->getRange(); + auto *context = &ptr->ctx->router->hiddenServiceContext; + return context->getRange(); } const char *