make it compile

This commit is contained in:
Jeff Becker 2020-02-26 16:54:16 -05:00 committed by Thomas Winget
parent fc0dfb6e3d
commit 26c1670af7
5 changed files with 10 additions and 47 deletions

View File

@ -291,7 +291,7 @@ abyss: debug
$(ABYSS_EXE)
format:
$(FORMAT) -i $$(find jni daemon llarp include libabyss | grep -E '\.[h,c](pp)?$$')
$(FORMAT) -i $$(find jni daemon llarp include libabyss pybind | grep -E '\.[h,c](pp)?$$')
format-verify: format
(type $(FORMAT))

View File

@ -21,8 +21,6 @@
namespace llarp
{
<<<<<<< HEAD
bool
Context::CallSafe(std::function< void(void) > f)
{
@ -97,21 +95,14 @@ namespace llarp
{
llarp::LogInfo(llarp::VERSION_FULL, " ", llarp::RELEASE_MOTTO);
llarp::LogInfo("starting up");
if(m_Simulation == nullptr)
{
mainloop = m_Simulation->m_NetLoop;
}
if(mainloop == nullptr)
mainloop = llarp_make_ev_loop();
logic->set_event_loop(mainloop.get());
mainloop->set_logic(logic);
if(m_Simulation == nullptr)
{
crypto = std::make_unique< sodium::CryptoLibSodium >();
cryptoManager = std::make_unique< CryptoManager >(crypto.get());
}
crypto = std::make_unique< sodium::CryptoLibSodium >();
cryptoManager = std::make_unique< CryptoManager >(crypto.get());
router = std::make_unique< Router >(worker, mainloop, logic);
@ -155,18 +146,12 @@ namespace llarp
// run net io thread
llarp::LogInfo("running mainloop");
if(m_Simulation == nullptr)
llarp_ev_loop_run_single_process(mainloop, logic);
if(closeWaiter)
{
llarp_ev_loop_run_single_process(mainloop, logic);
if(closeWaiter)
{
// inform promise if called by CloseAsync
closeWaiter->set_value();
}
}
else
{
m_Simulation->NodeUp(this);
// inform promise if called by CloseAsync
closeWaiter->set_value();
}
return 0;
}

View File

@ -5,8 +5,7 @@ set(LLARP_PYBIND_SRC
module.cpp
llarp/context.cpp
llarp/router_contact.cpp
llarp/crypto/types.cpp
llarp/simulation/sim_context.cpp)
llarp/crypto/types.cpp)
pybind11_add_module(pyllarp MODULE ${LLARP_PYBIND_SRC})
target_include_directories(pyllarp PRIVATE ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/crypto/libntrup/include ${CMAKE_SOURCE_DIR}/llarp ${CMAKE_CURRENT_SOURCE_DIR})

View File

@ -1,6 +1,6 @@
#include "common.hpp"
#include <llarp.hpp>
#include <router/router.cpp>
namespace llarp
{
void
@ -8,7 +8,6 @@ namespace llarp
{
using Context_ptr = std::shared_ptr< Context >;
py::class_< Context, Context_ptr >(mod, "Context")
.def(py::init< simulate::Sim_ptr >())
.def("Setup",
[](Context_ptr self) -> bool { return self->Setup() == 0; })
.def("Run",

View File

@ -1,20 +0,0 @@
#include "common.hpp"
#include <llarp.hpp>
namespace llarp
{
namespace simulate
{
void
SimContext_Init(py::module& mod)
{
py::class_< Simulation, Sim_ptr >(mod, "Simulation")
.def(py::init<>())
.def("AddNode", &Simulation::AddNode)
.def("DelNode", &Simulation::DelNode);
py::object context = py::cast(std::make_shared< Simulation >());
mod.attr("context") = context;
}
} // namespace simulate
} // namespace llarp