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(); 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 exit
} // namespace llarp } // namespace llarp

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

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

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

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

@ -76,7 +76,7 @@ namespace llarp
RemovePath(Path* path); RemovePath(Path* path);
virtual void virtual void
HandlePathBuilt(__attribute__((unused)) Path* path); HandlePathBuilt(Path* path) = 0;
virtual void virtual void
HandlePathBuildTimeout(__attribute__((unused)) Path* path); HandlePathBuildTimeout(__attribute__((unused)) Path* path);
@ -113,6 +113,10 @@ namespace llarp
virtual bool virtual bool
IsStopped() const = 0; 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 /// return true if we can and should remove this pathset and underlying
/// resources from its parent context /// resources from its parent context
virtual bool virtual bool

Loading…
Cancel
Save