forked from I2P_Developers/i2p.i2p
* NetDB: Disable floodfill at shutdown time if enabled
This commit is contained in:
@ -79,6 +79,31 @@ public class FloodfillNetworkDatabaseFacade extends KademliaNetworkDatabaseFacad
|
|||||||
_context.inNetMessagePool().registerHandlerJobBuilder(DatabaseStoreMessage.MESSAGE_TYPE, new FloodfillDatabaseStoreMessageHandler(_context, this));
|
_context.inNetMessagePool().registerHandlerJobBuilder(DatabaseStoreMessage.MESSAGE_TYPE, new FloodfillDatabaseStoreMessageHandler(_context, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If we are floodfill, turn it off and tell everybody.
|
||||||
|
* @since 0.8.9
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void shutdown() {
|
||||||
|
if (_floodfillEnabled) {
|
||||||
|
// turn off to build a new RI...
|
||||||
|
_floodfillEnabled = false;
|
||||||
|
// true -> publish inline
|
||||||
|
// but job queue is already shut down, so sendStore() called by rebuildRouterInfo() won't work...
|
||||||
|
_context.router().rebuildRouterInfo(true);
|
||||||
|
// ...so force a flood here
|
||||||
|
RouterInfo local = _context.router().getRouterInfo();
|
||||||
|
if (local != null && _context.router().getUptime() > PUBLISH_JOB_DELAY) {
|
||||||
|
flood(local);
|
||||||
|
// let the messages get out...
|
||||||
|
try {
|
||||||
|
Thread.sleep(3000);
|
||||||
|
} catch (InterruptedException ie) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
super.shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This maybe could be shorter than RepublishLeaseSetJob.REPUBLISH_LEASESET_TIMEOUT,
|
* This maybe could be shorter than RepublishLeaseSetJob.REPUBLISH_LEASESET_TIMEOUT,
|
||||||
* because we are sending direct, but unresponsive floodfills may take a while due to timeouts.
|
* because we are sending direct, but unresponsive floodfills may take a while due to timeouts.
|
||||||
|
Reference in New Issue
Block a user