ban zero id for pathid; clarity and cleanup

pull/873/head
Thomas Winget 5 years ago
parent 9d3e7d349c
commit 75512b1b58

@ -322,6 +322,9 @@ namespace llarp
self->hop = nullptr;
}
// TODO: If decryption has succeeded here but we otherwise don't
// want to or can't accept the path build request, send
// a status message saying as much.
static void
HandleDecrypted(llarp_buffer_t* buf,
std::shared_ptr< LRCMFrameDecrypt > self)
@ -344,8 +347,16 @@ namespace llarp
return;
}
info.txID = self->record.txid;
info.rxID = self->record.rxid;
info.txID = self->record.txid;
info.rxID = self->record.rxid;
if(info.txID.IsZero() || info.rxID.IsZero())
{
llarp::LogError("LRCM refusing zero pathid");
self->decrypter = nullptr;
return;
}
info.upstream = self->record.nextHop;
// generate path key as we are in a worker thread

@ -31,8 +31,14 @@ namespace llarp
for(size_t idx = 0; idx < hsz; ++idx)
{
hops[idx].rc = h[idx];
hops[idx].txID.Randomize();
hops[idx].rxID.Randomize();
while(hops[idx].txID.IsZero())
{
hops[idx].txID.Randomize();
}
while(hops[idx].rxID.IsZero())
{
hops[idx].rxID.Randomize();
}
}
for(size_t idx = 0; idx < hsz - 1; ++idx)

@ -263,14 +263,7 @@ namespace llarp
void
OutboundMessageHandler::RemoveEmptyPathQueues()
{
if(not removedPaths.empty())
{
removedSomePaths = true;
}
else
{
removedSomePaths = false;
}
removedSomePaths = (not removedPaths.empty());
while(not removedPaths.empty())
{

@ -123,7 +123,9 @@ namespace llarp
ILinkManager *_linkManager;
std::shared_ptr< Logic > _logic;
const PathID_t zeroID;
// paths cannot have pathid "0", so it can be used as the "pathid"
// for non-traffic (control) messages, so they can be prioritized.
static const PathID_t zeroID;
};
} // namespace llarp

Loading…
Cancel
Save