more logging info

pull/427/head
Jeff Becker 5 years ago
parent 0369e42d5e
commit ce126166af
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

@ -273,5 +273,17 @@ namespace llarp
m_ExitIdentity = r->identity();
}
}
std::string
SNodeSession::Name() const
{
return "SNode::" + m_ExitRouter.ToString();
}
std::string
ExitSession::Name() const
{
return "Exit::" + m_ExitRouter.ToString();
}
} // namespace exit
} // namespace llarp

@ -136,6 +136,9 @@ namespace llarp
~ExitSession(){};
std::string
Name() const override;
protected:
virtual void
PopulateRequest(llarp::routing::ObtainExitMessage& msg) const override
@ -155,6 +158,9 @@ namespace llarp
~SNodeSession(){};
std::string
Name() const override;
protected:
void
PopulateRequest(llarp::routing::ObtainExitMessage& msg) const override

@ -635,6 +635,8 @@ namespace llarp
{
std::stringstream ss;
ss << "TX=" << TXID() << " RX=" << RXID();
if(m_PathSet)
ss << " on " << m_PathSet->Name();
return ss.str();
}

@ -61,7 +61,8 @@ namespace llarp
if(!ctx->crypto->dh_client(hop.shared, hop.rc.enckey, hop.commkey,
hop.nonce))
{
LogError("Failed to generate shared key for path build");
LogError(ctx->pathset->Name(),
" Failed to generate shared key for path build");
delete ctx;
return;
}
@ -95,7 +96,7 @@ namespace llarp
if(!record.BEncode(&buf))
{
// failed to encode?
LogError("Failed to generate Commit Record");
LogError(ctx->pathset->Name(), " Failed to generate Commit Record");
DumpBuffer(buf);
delete ctx;
return;
@ -106,7 +107,7 @@ namespace llarp
ctx->crypto->encryption_keygen(framekey);
if(!frame.EncryptInPlace(framekey, hop.rc.enckey, ctx->crypto))
{
LogError("Failed to encrypt LRCR");
LogError(ctx->pathset->Name(), " Failed to encrypt LRCR");
delete ctx;
return;
}
@ -162,7 +163,7 @@ namespace llarp
ctx->path = nullptr;
}
else
LogError("failed to send LRCM to ", remote);
LogError(ctx->pathset->Name(), " failed to send LRCM to ", remote);
}
// decrement keygen counter
ctx->pathset->keygens--;
@ -295,7 +296,7 @@ namespace llarp
}
if(tries == 0)
{
LogWarn("failed to select hop ", idx);
LogWarn(Name(), " failed to select hop ", idx);
return false;
}
++idx;
@ -321,8 +322,7 @@ namespace llarp
ctx->router = router;
ctx->pathset = this;
auto path = new path::Path(hops, this, roles);
path->SetBuildResultHook(std::bind(&path::Builder::HandlePathBuilt, this,
std::placeholders::_1));
path->SetBuildResultHook([this](Path* p) { this->HandlePathBuilt(p); });
++keygens;
ctx->AsyncGenerateKeys(path, router->logic(), router->threadpool(), this,
&PathBuilderKeysGenerated);
@ -333,7 +333,7 @@ namespace llarp
{
buildIntervalLimit = MIN_PATH_BUILD_INTERVAL;
router->routerProfiling().MarkPathSuccess(p);
PathSet::HandlePathBuilt(p);
LogInfo(p->Name(), " built latency=", p->intro.latency);
}
void
@ -350,7 +350,7 @@ namespace llarp
void
Builder::ManualRebuild(size_t num, PathRole roles)
{
LogDebug("manual rebuild ", num);
LogDebug(Name(), " manual rebuild ", num);
while(num--)
BuildOne(roles);
}

@ -243,11 +243,6 @@ namespace llarp
return itr->second;
}
void
PathSet::HandlePathBuilt(Path*)
{
}
bool
PathSet::GetCurrentIntroductionsWithFilter(
std::set< service::Introduction >& intros,
@ -292,7 +287,7 @@ namespace llarp
void
PathSet::HandlePathBuildTimeout(Path* p)
{
LogInfo("path build ", p->HopsString(), " timed out");
LogInfo(Name(), " path build ", p->HopsString(), " timed out");
}
bool

@ -76,7 +76,7 @@ namespace llarp
RemovePath(Path* path);
virtual void
HandlePathBuilt(__attribute__((unused)) Path* path);
HandlePathBuilt(Path* path) = 0;
virtual void
HandlePathBuildTimeout(__attribute__((unused)) Path* path);
@ -113,6 +113,10 @@ namespace llarp
virtual bool
IsStopped() const = 0;
/// get the "name" of this pathset
virtual std::string
Name() const = 0;
/// return true if we can and should remove this pathset and underlying
/// resources from its parent context
virtual bool

Loading…
Cancel
Save