record reason for path fail and the full hops

pull/1658/head
Jeff Becker 3 years ago
parent 0096bd4e35
commit aa1c1bad0b
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

@ -273,4 +273,32 @@ namespace llarp
return status == other.status;
}
std::string
LRStatusCodeToString(uint64_t status)
{
std::map<uint64_t, std::string> codes = {
{LR_StatusRecord::SUCCESS, "success"},
{LR_StatusRecord::FAIL_TIMEOUT, "timeout"},
{LR_StatusRecord::FAIL_CONGESTION, "congestion"},
{LR_StatusRecord::FAIL_DEST_UNKNOWN, "destination unknown"},
{LR_StatusRecord::FAIL_DECRYPT_ERROR, "decrypt error"},
{LR_StatusRecord::FAIL_MALFORMED_RECORD, "malformed record"},
{LR_StatusRecord::FAIL_DEST_INVALID, "destination invalid"},
{LR_StatusRecord::FAIL_CANNOT_CONNECT, "cannot connect"},
{LR_StatusRecord::FAIL_DUPLICATE_HOP, "duplicate hop"}};
std::stringstream ss;
ss << "[";
bool found = false;
for (const auto& [val, message] : codes)
{
if ((status & val) == val)
{
ss << (found ? ", " : "") << message;
found = true;
}
}
ss << "]";
return ss.str();
}
} // namespace llarp

@ -49,6 +49,9 @@ namespace llarp
OnKey(llarp_buffer_t* buffer, llarp_buffer_t* key);
};
std::string
LRStatusCodeToString(uint64_t status);
struct LR_StatusMessage : public ILinkMessage
{
std::array<EncryptedFrame, 8> frames;

@ -199,7 +199,14 @@ namespace llarp
if (failedAt)
{
r->NotifyRouterEvent<tooling::PathBuildRejectedEvent>(Endpoint(), RXID(), *failedAt);
LogWarn(Name(), " build failed at ", *failedAt);
LogWarn(
Name(),
" build failed at ",
*failedAt,
" status=",
LRStatusCodeToString(currentStatus),
" hops=",
HopsString());
r->routerProfiling().MarkHopFail(*failedAt);
}
else

Loading…
Cancel
Save