mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 12:24:19 +00:00
correct excluded routers size for exploratory request
This commit is contained in:
parent
0e6d888ed3
commit
fc63ca6982
@ -945,9 +945,9 @@ namespace data
|
|||||||
}
|
}
|
||||||
uint16_t numExcluded = bufbe16toh (excluded);
|
uint16_t numExcluded = bufbe16toh (excluded);
|
||||||
excluded += 2;
|
excluded += 2;
|
||||||
if (numExcluded > 512)
|
if (numExcluded > 512 || (excluded - buf) + numExcluded*32 > (int)msg->GetPayloadLength ())
|
||||||
{
|
{
|
||||||
LogPrint (eLogWarning, "NetDb: Number of excluded peers", numExcluded, " exceeds 512");
|
LogPrint (eLogWarning, "NetDb: Number of excluded peers", numExcluded, " is too much");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -956,10 +956,11 @@ namespace data
|
|||||||
{
|
{
|
||||||
LogPrint (eLogInfo, "NetDb: Exploratory close to ", key, " ", numExcluded, " excluded");
|
LogPrint (eLogInfo, "NetDb: Exploratory close to ", key, " ", numExcluded, " excluded");
|
||||||
std::set<IdentHash> excludedRouters;
|
std::set<IdentHash> excludedRouters;
|
||||||
|
const uint8_t * excluded_ident = excluded;
|
||||||
for (int i = 0; i < numExcluded; i++)
|
for (int i = 0; i < numExcluded; i++)
|
||||||
{
|
{
|
||||||
excludedRouters.insert (excluded);
|
excludedRouters.insert (excluded_ident);
|
||||||
excluded += 32;
|
excluded_ident += 32;
|
||||||
}
|
}
|
||||||
std::vector<IdentHash> routers;
|
std::vector<IdentHash> routers;
|
||||||
for (int i = 0; i < 3; i++)
|
for (int i = 0; i < 3; i++)
|
||||||
@ -1017,7 +1018,7 @@ namespace data
|
|||||||
if (closestFloodfills.empty ())
|
if (closestFloodfills.empty ())
|
||||||
LogPrint (eLogWarning, "NetDb: Requested ", key, " not found, ", numExcluded, " peers excluded");
|
LogPrint (eLogWarning, "NetDb: Requested ", key, " not found, ", numExcluded, " peers excluded");
|
||||||
replyMsg = CreateDatabaseSearchReply (ident, closestFloodfills);
|
replyMsg = CreateDatabaseSearchReply (ident, closestFloodfills);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
excluded += numExcluded * 32;
|
excluded += numExcluded * 32;
|
||||||
if (replyMsg)
|
if (replyMsg)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user