I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 7165dc78 authored by zzz's avatar zzz
Browse files

NetDB: Don't flood an RI back to itself. While Java ffs self-flood,

other implementations may not.
parent 54912879
No related branches found
No related tags found
No related merge requests found
...@@ -191,6 +191,11 @@ public class FloodfillNetworkDatabaseFacade extends KademliaNetworkDatabaseFacad ...@@ -191,6 +191,11 @@ public class FloodfillNetworkDatabaseFacade extends KademliaNetworkDatabaseFacad
List<Hash> nextPeers = sel.selectFloodfillParticipants(nkey, NEXT_FLOOD_QTY, getKBuckets()); List<Hash> nextPeers = sel.selectFloodfillParticipants(nkey, NEXT_FLOOD_QTY, getKBuckets());
int i = 0; int i = 0;
for (Hash h : nextPeers) { for (Hash h : nextPeers) {
// Don't flood an RI back to itself
// Not necessary, a ff will do its own flooding (reply token == 0)
// But other implementations may not...
if (h.equals(key))
continue;
// todo key cert skip? // todo key cert skip?
if (!peers.contains(h)) { if (!peers.contains(h)) {
peers.add(h); peers.add(h);
...@@ -206,10 +211,11 @@ public class FloodfillNetworkDatabaseFacade extends KademliaNetworkDatabaseFacad ...@@ -206,10 +211,11 @@ public class FloodfillNetworkDatabaseFacade extends KademliaNetworkDatabaseFacad
RouterInfo target = lookupRouterInfoLocally(peer); RouterInfo target = lookupRouterInfoLocally(peer);
if ( (target == null) || (_context.banlist().isBanlisted(peer)) ) if ( (target == null) || (_context.banlist().isBanlisted(peer)) )
continue; continue;
// Don't flood a RI back to itself // Don't flood an RI back to itself
// Not necessary, a ff will do its own flooding (reply token == 0) // Not necessary, a ff will do its own flooding (reply token == 0)
//if (peer.equals(target.getIdentity().getHash())) // But other implementations may not...
// continue; if (ds.getType() == DatabaseEntry.KEY_TYPE_ROUTERINFO && peer.equals(key))
continue;
if (peer.equals(_context.routerHash())) if (peer.equals(_context.routerHash()))
continue; continue;
DatabaseStoreMessage msg = new DatabaseStoreMessage(_context); DatabaseStoreMessage msg = new DatabaseStoreMessage(_context);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment