Browse Source

IT WORKS, floodfill confirmed working on test network

pull/574/head
Jeff Becker 8 years ago
parent
commit
d37482ada1
No known key found for this signature in database
GPG Key ID: AB950234D6EA286B
  1. 7
      I2NPProtocol.cpp
  2. 15
      NetDb.cpp

7
I2NPProtocol.cpp

@ -166,8 +166,9 @@ namespace i2p @@ -166,8 +166,9 @@ namespace i2p
memcpy (buf, replyTunnel->GetNextIdentHash (), 32); // reply tunnel GW
buf += 32;
*buf = DATABASE_LOOKUP_DELIVERY_FLAG | DATABASE_LOOKUP_ENCRYPTION_FLAG | DATABASE_LOOKUP_TYPE_LEASESET_LOOKUP; // flags
htobe32buf (buf + 1, replyTunnel->GetNextTunnelID ()); // reply tunnel ID
buf += 5;
buf ++;
htobe32buf (buf, replyTunnel->GetNextTunnelID ()); // reply tunnel ID
buf += 4;
// excluded
htobe16buf (buf, cnt);
@ -182,7 +183,7 @@ namespace i2p @@ -182,7 +183,7 @@ namespace i2p
}
// encryption
memcpy (buf, replyKey, 32);
buf[32] = (uint8_t) 1; // 1 tag
buf[32] = uint8_t( 1 ); // 1 tag
memcpy (buf + 33, replyTag, 32);
buf += 65;

15
NetDb.cpp

@ -724,22 +724,21 @@ namespace data @@ -724,22 +724,21 @@ namespace data
}
if (!found)
{
std::set<IdentHash> excludedRouters;
std::set<IdentHash> excLudedrouters;
const uint8_t * exclude_ident = excluded;
for (int i = 0; i < numExcluded; i++)
{
excludedRouters.insert (excluded);
excluded += 32;
excludedRouters.insert (exclude_ident);
exclude_ident += 32;
}
closestFloodfills = GetClosestFloodfills (ident, 3, excludedRouters, true);
if (!numExcluded) // save if no excluded
m_LookupResponses[ident] = std::make_pair(closestFloodfills, i2p::util::GetSecondsSinceEpoch ());
}
else
excluded += numExcluded * 32;
replyMsg = CreateDatabaseSearchReply (ident, closestFloodfills);
}
}
}
excluded += numExcluded * 32;
if (replyMsg)
{
if (replyTunnelID)
@ -751,7 +750,7 @@ namespace data @@ -751,7 +750,7 @@ namespace data
const uint8_t numTags = excluded[32];
if (numTags)
{
const i2p::garlic::SessionTag sessionTag(excluded + 33); // take first tag
const i2p::garlic::SessionTag sessionTag(excluded + 33); // take first tag
i2p::garlic::GarlicRoutingSession garlic (sessionKey, sessionTag);
replyMsg = garlic.WrapSingleMessage (replyMsg);
if(replyMsg == nullptr) LogPrint(eLogError, "NetDb: failed to wrap message");

Loading…
Cancel
Save