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:
parent
ed47ba998f
commit
343252c48d
5 changed files with 22 additions and 3 deletions
|
@ -74,4 +74,10 @@ namespace tooling
|
||||||
|
|
||||||
void
|
void
|
||||||
RouterEvent_Init(py::module& mod);
|
RouterEvent_Init(py::module& mod);
|
||||||
|
|
||||||
|
void
|
||||||
|
HiveContext_Init(py::module& mod);
|
||||||
|
|
||||||
|
void
|
||||||
|
HiveRouter_Init(py::module& mod);
|
||||||
} // namespace tooling
|
} // namespace tooling
|
||||||
|
|
|
@ -37,4 +37,15 @@ namespace llarp
|
||||||
})
|
})
|
||||||
.def("CallSafe", &Context::CallSafe);
|
.def("CallSafe", &Context::CallSafe);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace llarp
|
} // namespace llarp
|
||||||
|
|
||||||
|
namespace tooling
|
||||||
|
{
|
||||||
|
void
|
||||||
|
HiveContext_Init(py::module& mod)
|
||||||
|
{
|
||||||
|
py::class_<tooling::HiveContext>(mod, "HiveContext")
|
||||||
|
.def("getRouterAsHiveRouter", &tooling::HiveContext::getRouterAsHiveRouter);
|
||||||
|
}
|
||||||
|
} // namespace tooling
|
||||||
|
|
|
@ -21,7 +21,7 @@ namespace tooling
|
||||||
void
|
void
|
||||||
HiveRouter_Init(py::module& mod)
|
HiveRouter_Init(py::module& mod)
|
||||||
{
|
{
|
||||||
py::class_<HiveRouter>(mod, "HiveRouter")
|
py::class_<HiveRouter, llarp::AbstractRouter>(mod, "HiveRouter")
|
||||||
.def("disableGossiping", &HiveRouter::disableGossiping)
|
.def("disableGossiping", &HiveRouter::disableGossiping)
|
||||||
.def("enableGossiping", &HiveRouter::enableGossiping);
|
.def("enableGossiping", &HiveRouter::enableGossiping);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,12 +6,14 @@ PYBIND11_MODULE(pyllarp, m)
|
||||||
tooling::RouterHive_Init(m);
|
tooling::RouterHive_Init(m);
|
||||||
tooling::RouterEvent_Init(m);
|
tooling::RouterEvent_Init(m);
|
||||||
llarp::AbstractRouter_Init(m);
|
llarp::AbstractRouter_Init(m);
|
||||||
|
tooling::HiveRouter_Init(m);
|
||||||
llarp::PeerDb_Init(m);
|
llarp::PeerDb_Init(m);
|
||||||
llarp::PeerStats_Init(m);
|
llarp::PeerStats_Init(m);
|
||||||
llarp::RouterID_Init(m);
|
llarp::RouterID_Init(m);
|
||||||
llarp::RouterContact_Init(m);
|
llarp::RouterContact_Init(m);
|
||||||
llarp::CryptoTypes_Init(m);
|
llarp::CryptoTypes_Init(m);
|
||||||
llarp::Context_Init(m);
|
llarp::Context_Init(m);
|
||||||
|
tooling::HiveContext_Init(m);
|
||||||
llarp::Config_Init(m);
|
llarp::Config_Init(m);
|
||||||
llarp::dht::DHTTypes_Init(m);
|
llarp::dht::DHTTypes_Init(m);
|
||||||
llarp::PathTypes_Init(m);
|
llarp::PathTypes_Init(m);
|
||||||
|
|
|
@ -77,10 +77,10 @@ def tally_rc_received_for_peer(hive, routerId):
|
||||||
|
|
||||||
numFound = 0
|
numFound = 0
|
||||||
|
|
||||||
def visit(relay):
|
def visit(context):
|
||||||
nonlocal numFound
|
nonlocal numFound
|
||||||
|
|
||||||
peerDb = relay.peerDb()
|
peerDb = context.getRouterAsHiveRouter().peerDb()
|
||||||
stats = peerDb.getCurrentPeerStats(routerId);
|
stats = peerDb.getCurrentPeerStats(routerId);
|
||||||
|
|
||||||
assert(stats.routerId == routerId)
|
assert(stats.routerId == routerId)
|
||||||
|
|
Loading…
Reference in a new issue