1
1
Fork 0
mirror of https://github.com/oxen-io/lokinet synced 2023-12-14 06:53:00 +01:00

Use HiveContext and HiveRouter properly

This commit is contained in:
Stephen Shelton 2020-07-02 09:40:38 -06:00
parent ed47ba998f
commit 343252c48d
No known key found for this signature in database
GPG key ID: EE4BADACCE8B631C
5 changed files with 22 additions and 3 deletions

View file

@ -74,4 +74,10 @@ namespace tooling
void
RouterEvent_Init(py::module& mod);
void
HiveContext_Init(py::module& mod);
void
HiveRouter_Init(py::module& mod);
} // namespace tooling

View file

@ -37,4 +37,15 @@ namespace llarp
})
.def("CallSafe", &Context::CallSafe);
}
} // namespace llarp
namespace tooling
{
void
HiveContext_Init(py::module& mod)
{
py::class_<tooling::HiveContext>(mod, "HiveContext")
.def("getRouterAsHiveRouter", &tooling::HiveContext::getRouterAsHiveRouter);
}
} // namespace tooling

View file

@ -21,7 +21,7 @@ namespace tooling
void
HiveRouter_Init(py::module& mod)
{
py::class_<HiveRouter>(mod, "HiveRouter")
py::class_<HiveRouter, llarp::AbstractRouter>(mod, "HiveRouter")
.def("disableGossiping", &HiveRouter::disableGossiping)
.def("enableGossiping", &HiveRouter::enableGossiping);
}

View file

@ -6,12 +6,14 @@ PYBIND11_MODULE(pyllarp, m)
tooling::RouterHive_Init(m);
tooling::RouterEvent_Init(m);
llarp::AbstractRouter_Init(m);
tooling::HiveRouter_Init(m);
llarp::PeerDb_Init(m);
llarp::PeerStats_Init(m);
llarp::RouterID_Init(m);
llarp::RouterContact_Init(m);
llarp::CryptoTypes_Init(m);
llarp::Context_Init(m);
tooling::HiveContext_Init(m);
llarp::Config_Init(m);
llarp::dht::DHTTypes_Init(m);
llarp::PathTypes_Init(m);

View file

@ -77,10 +77,10 @@ def tally_rc_received_for_peer(hive, routerId):
numFound = 0
def visit(relay):
def visit(context):
nonlocal numFound
peerDb = relay.peerDb()
peerDb = context.getRouterAsHiveRouter().peerDb()
stats = peerDb.getCurrentPeerStats(routerId);
assert(stats.routerId == routerId)