Remove unused arguments (and ants)

pull/1557/head
Jason Rhinelander 3 years ago
parent 2c827870c9
commit 6e05dc693f

@ -49,7 +49,7 @@ namespace llarp
AddLink(LinkLayer_ptr link, bool inbound = false) = 0; AddLink(LinkLayer_ptr link, bool inbound = false) = 0;
virtual bool virtual bool
StartLinks(const EventLoop_ptr& loop) = 0; StartLinks() = 0;
virtual void virtual void
Stop() = 0; Stop() = 0;

@ -121,12 +121,12 @@ namespace llarp
} }
bool bool
LinkManager::StartLinks(const EventLoop_ptr& loop) LinkManager::StartLinks()
{ {
LogInfo("starting ", outboundLinks.size(), " outbound links"); LogInfo("starting ", outboundLinks.size(), " outbound links");
for (const auto& link : outboundLinks) for (const auto& link : outboundLinks)
{ {
if (!link->Start(loop)) if (!link->Start())
{ {
LogWarn("outbound link '", link->Name(), "' failed to start"); LogWarn("outbound link '", link->Name(), "' failed to start");
return false; return false;
@ -139,7 +139,7 @@ namespace llarp
LogInfo("starting ", inboundLinks.size(), " inbound links"); LogInfo("starting ", inboundLinks.size(), " inbound links");
for (const auto& link : inboundLinks) for (const auto& link : inboundLinks)
{ {
if (!link->Start(loop)) if (!link->Start())
{ {
LogWarn("Link ", link->Name(), " failed to start"); LogWarn("Link ", link->Name(), " failed to start");
return false; return false;

@ -47,7 +47,7 @@ namespace llarp
AddLink(LinkLayer_ptr link, bool inbound = false) override; AddLink(LinkLayer_ptr link, bool inbound = false) override;
bool bool
StartLinks(const EventLoop_ptr& loop) override; StartLinks() override;
void void
Stop() override; Stop() override;

@ -339,11 +339,11 @@ namespace llarp
} }
bool bool
ILinkLayer::Start(const EventLoop_ptr& loop) ILinkLayer::Start()
{ {
// Tie the lifetime of this repeater to this arbitrary shared_ptr: // Tie the lifetime of this repeater to this arbitrary shared_ptr:
m_repeater_keepalive = std::make_shared<int>(0); m_repeater_keepalive = std::make_shared<int>(0);
loop->call_every(LINK_LAYER_TICK_INTERVAL, m_repeater_keepalive, [this] { Tick(Now()); }); m_Loop->call_every(LINK_LAYER_TICK_INTERVAL, m_repeater_keepalive, [this] { Tick(Now()); });
return true; return true;
} }

@ -131,7 +131,7 @@ namespace llarp
TryEstablishTo(RouterContact rc); TryEstablishTo(RouterContact rc);
bool bool
Start(const EventLoop_ptr& loop); Start();
virtual void virtual void
Stop(); Stop();

@ -156,7 +156,6 @@ namespace llarp
if (rc.IsPublicRouter()) if (rc.IsPublicRouter())
{ {
LogDebug("Adding or updating RC for ", RouterID(rc.pubkey), " to nodedb and dht."); LogDebug("Adding or updating RC for ", RouterID(rc.pubkey), " to nodedb and dht.");
const RouterContact copy{rc};
_loop->call([rc, n = _nodedb] { n->PutIfNewer(rc); }); _loop->call([rc, n = _nodedb] { n->PutIfNewer(rc); });
_dht->impl->PutRCNodeAsync(rc); _dht->impl->PutRCNodeAsync(rc);
} }

@ -1057,7 +1057,7 @@ namespace llarp
} }
} }
_outboundSessionMaker.SetOurRouter(pubkey()); _outboundSessionMaker.SetOurRouter(pubkey());
if (!_linkManager.StartLinks(_loop)) if (!_linkManager.StartLinks())
{ {
LogWarn("One or more links failed to start."); LogWarn("One or more links failed to start.");
return false; return false;

@ -117,7 +117,7 @@ struct IWPLinkContext
if (inbound) if (inbound)
{ {
// only add address info on the recipiant's rc // only add address info on the recipient's rc
rc.addrs.emplace_back(); rc.addrs.emplace_back();
REQUIRE(link->GetOurAddressInfo(rc.addrs.back())); REQUIRE(link->GetOurAddressInfo(rc.addrs.back()));
} }
@ -166,19 +166,19 @@ RunIWPTest(Func_t test, Duration_t timeout = 10s)
// set up client // set up client
auto initiator = std::make_shared<IWPLinkContext>("127.0.0.1:3001", loop); auto initiator = std::make_shared<IWPLinkContext>("127.0.0.1:3001", loop);
// set up server // set up server
auto recipiant = std::make_shared<IWPLinkContext>("127.0.0.1:3002", loop); auto recipient = std::make_shared<IWPLinkContext>("127.0.0.1:3002", loop);
// function for ending unit test on success // function for ending unit test on success
auto endIfDone = [initiator, recipiant, loop]() { auto endIfDone = [initiator, recipient, loop]() {
if (initiator->gucci and recipiant->gucci) if (initiator->gucci and recipient->gucci)
{ {
loop->stop(); loop->stop();
} }
}; };
// function to start test and give loop to unit test // function to start test and give loop to unit test
auto start = [initiator, recipiant, loop]() { auto start = [initiator, recipient, loop]() {
REQUIRE(initiator->link->Start(loop)); REQUIRE(initiator->link->Start());
REQUIRE(recipiant->link->Start(loop)); REQUIRE(recipient->link->Start());
return loop; return loop;
}; };
@ -186,7 +186,7 @@ RunIWPTest(Func_t test, Duration_t timeout = 10s)
auto endTest = [loop] { loop->stop(); }; auto endTest = [loop] { loop->stop(); };
loop->call_later(timeout, [] { FAIL("test timeout"); }); loop->call_later(timeout, [] { FAIL("test timeout"); });
test(start, endIfDone, endTest, initiator, recipiant); test(start, endIfDone, endTest, initiator, recipient);
loop->run(); loop->run();
llarp::RouterContact::BlockBogons = oldBlockBogons; llarp::RouterContact::BlockBogons = oldBlockBogons;
} }
@ -205,7 +205,7 @@ TEST_CASE("IWP handshake", "[iwp]")
alice->gucci = true; alice->gucci = true;
endIfDone(); endIfDone();
}); });
// set up recipiant // set up recipient
bob->InitLink<true>([=](auto remote) { bob->InitLink<true>([=](auto remote) {
REQUIRE(remote->GetRemoteRC() == alice->rc); REQUIRE(remote->GetRemoteRC() == alice->rc);
bob->gucci = true; bob->gucci = true;

Loading…
Cancel
Save