working on more pybinds

pull/1184/head
Thomas Winget 4 years ago
parent 0f34a950a9
commit 5e498e962f

@ -1,16 +1,29 @@
#!/usr/bin/env python3
import pyllarp
from time import sleep
from signal import signal, SIGINT
def main():
running = True
def handle_sigint(sig, frame):
nonlocal running
running = False
signal(SIGINT, handle_signal)
hive = pyllarp.RouterHive()
config = pyllarp.Config()
config.router.netid = "gamma"
config.netdb.nodedbDir = "/home/tom/.lokinet/netdb"
hive.AddRouter(config)
hive.StartAll()
sleep(10)
while running:
event = hive.GetNextEvent()
print(event.ToString())
hive.StopAll()
if __name__ == '__main__':

@ -86,6 +86,12 @@ namespace tooling
}
}
RouterEventPtr
RouterHive::GetNextEvent()
{
return eventQueue.popFront();
}
void
RouterHive::ProcessPathBuildAttempt(const PathBuildAttemptEvent& event)
{

@ -36,6 +36,9 @@ namespace tooling
void
ProcessEventQueue();
RouterEventPtr
GetNextEvent();
/*
* Event processing function declarations

@ -8,6 +8,7 @@ set(LLARP_PYBIND_SRC
llarp/crypto/types.cpp
llarp/config.cpp
llarp/tooling/router_hive.cpp
llarp/tooling/router_event.cpp
)
pybind11_add_module(pyllarp MODULE ${LLARP_PYBIND_SRC})

@ -1,8 +1,26 @@
#pragma once
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
namespace py = pybind11;
/*
namespace pybind11
{
namespace detail
{
template<typename T>
struct type_caster<nonstd::optional<T>>
: public optional_caster<nonstd::optional<T>> {};
template <typename CharT, class Traits>
struct type_caster<simple_string_view>
: string_caster<simple_string_view, true> {};
} // namespace pybind11::detail
} // namespace pybind11
*/
namespace llarp
{
void
@ -23,4 +41,7 @@ namespace tooling
{
void
RouterHive_Init(py::module & mod);
}
void
RouterEvent_Init(py::module & mod);
}

@ -1,9 +1,9 @@
#include "common.hpp"
PYBIND11_MODULE(pyllarp, m)
{
tooling::RouterHive_Init(m);
tooling::RouterEvent_Init(m);
llarp::RouterContact_Init(m);
llarp::CryptoTypes_Init(m);
llarp::Context_Init(m);

Loading…
Cancel
Save