Always have a key early (even if no key file set) so you don't regen keys twice

pull/230/head
Ryan Tharp 5 years ago
parent c4c9197586
commit 332336060c

@ -298,14 +298,17 @@ namespace llarp
// construct
service.reset(itr->second(conf.first, m_Router));
// if ephemeral, then we need to regen key
// if privkey file, then set it and load it
if(keyfile != "")
{
llarp::LogInfo("Found keyfile, prestarting endpoint");
service->SetOption("keyfile", keyfile);
// load keyfile, so we have the correct name for logging
service->LoadKeyFile(); // only start endpoint not tun
llarp::LogInfo("Endpoint prestarted");
}
llarp::LogInfo("Establishing endpoint identity");
service->LoadKeyFile(); // only start endpoint not tun
// now Name() will be correct
}
// configure
for(const auto &option : conf.second)

@ -507,7 +507,8 @@ namespace llarp
bool
Endpoint::Start()
{
this->LoadKeyFile();
// how can I tell if a m_Identity isn't loaded?
//this->LoadKeyFile();
if(!m_DataHandler)
{
m_DataHandler = this;

Loading…
Cancel
Save