NetDB: Don't publish non-ff RI on exit if we are coming right back

This commit is contained in:
zzz
2015-03-18 19:58:31 +00:00
parent cb4359cd0a
commit a2f027e136
2 changed files with 6 additions and 2 deletions

View File

@@ -34,7 +34,7 @@ class FloodfillMonitorJob extends JobImpl {
private static final int MIN_FF = 5000;
private static final int MAX_FF = 999999;
private static final String PROP_FLOODFILL_PARTICIPANT = "router.floodfillParticipant";
static final String PROP_FLOODFILL_PARTICIPANT = "router.floodfillParticipant";
public FloodfillMonitorJob(RouterContext context, FloodfillNetworkDatabaseFacade facade) {
super(context);

View File

@@ -94,7 +94,11 @@ public class FloodfillNetworkDatabaseFacade extends KademliaNetworkDatabaseFacad
*/
@Override
public synchronized void shutdown() {
if (_floodfillEnabled) {
// only if not forced ff or not restarting
if (_floodfillEnabled &&
(!_context.getBooleanProperty(FloodfillMonitorJob.PROP_FLOODFILL_PARTICIPANT) ||
!(_context.router().scheduledGracefulExitCode() == Router.EXIT_HARD_RESTART ||
_context.router().scheduledGracefulExitCode() == Router.EXIT_GRACEFUL_RESTART))) {
// turn off to build a new RI...
_floodfillEnabled = false;
// true -> publish inline