mirror of
https://github.com/oxen-io/lokinet.git
synced 2024-11-05 21:20:38 +00:00
baf8019fe5
This commit refactors functionality from the Router class into separate, dedicated classes. There are a few behavior changes that came as a result of discussion on what the correct behavior should be. In addition, many things Router was previously doing can now be provided callback functions to alert the calling point when the asynchronous action completes, successfully or otherwise.
16 lines
343 B
C++
16 lines
343 B
C++
#include <router/abstractrouter.hpp>
|
|
#include <nodedb.hpp>
|
|
|
|
namespace llarp
|
|
{
|
|
void
|
|
AbstractRouter::EnsureRouter(RouterID router, RouterLookupHandler handler)
|
|
{
|
|
std::vector< RouterContact > found(1);
|
|
if(nodedb()->Get(router, found[0]))
|
|
handler(found);
|
|
else
|
|
LookupRouter(router, handler);
|
|
}
|
|
} // namespace llarp
|