NTCP: Route RI block of another router to InNetMessagePool

This commit is contained in:
zzz
2023-02-08 09:05:29 -05:00
parent 6ac08e0929
commit 8b7f68e6f9

View File

@@ -1653,8 +1653,19 @@ public class NTCPConnection implements Closeable {
if (_log.shouldDebug())
_log.debug("Got updated RI");
_messagesRead.incrementAndGet();
Hash h = ri.getHash();
Hash ph = _remotePeer.calculateHash();
if (!h.equals(ph)) {
if (h.equals(_context.routerHash()))
return;
// make a fake DBSM message and send it to the InNetMessagePool
DatabaseStoreMessage dbsm = new DatabaseStoreMessage(_context);
dbsm.setEntry(ri);
dbsm.setMessageExpiration(_context.clock().now() + 10*1000);
_transport.messageReceived(dbsm, null, ph, 0, 1000); // fake size
return;
}
try {
Hash h = ri.getHash();
if (h.equals(_context.routerHash()))
return;
RouterInfo old = _context.netDb().store(h, ri);