|
|
@ -105,7 +105,9 @@ public class DefaultSynchronizer<C> implements Synchronizer { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void start() { |
|
|
|
public void start() { |
|
|
|
if (running.compareAndSet(false, true)) { |
|
|
|
if (running.compareAndSet(false, true)) { |
|
|
|
|
|
|
|
LOG.info("Starting synchronizer."); |
|
|
|
syncState.addSyncStatusListener(this::syncStatusCallback); |
|
|
|
syncState.addSyncStatusListener(this::syncStatusCallback); |
|
|
|
|
|
|
|
blockPropagationManager.start(); |
|
|
|
if (fastSyncDownloader.isPresent()) { |
|
|
|
if (fastSyncDownloader.isPresent()) { |
|
|
|
fastSyncDownloader.get().start().whenComplete(this::handleFastSyncResult); |
|
|
|
fastSyncDownloader.get().start().whenComplete(this::handleFastSyncResult); |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -118,8 +120,8 @@ public class DefaultSynchronizer<C> implements Synchronizer { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void stop() { |
|
|
|
public void stop() { |
|
|
|
LOG.info("Stopping synchronizer"); |
|
|
|
|
|
|
|
if (running.compareAndSet(true, false)) { |
|
|
|
if (running.compareAndSet(true, false)) { |
|
|
|
|
|
|
|
LOG.info("Stopping synchronizer"); |
|
|
|
fastSyncDownloader.ifPresent(FastSyncDownloader::stop); |
|
|
|
fastSyncDownloader.ifPresent(FastSyncDownloader::stop); |
|
|
|
fullSyncDownloader.stop(); |
|
|
|
fullSyncDownloader.stop(); |
|
|
|
} |
|
|
|
} |
|
|
@ -148,8 +150,6 @@ public class DefaultSynchronizer<C> implements Synchronizer { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void startFullSync() { |
|
|
|
private void startFullSync() { |
|
|
|
LOG.info("Starting synchronizer."); |
|
|
|
|
|
|
|
blockPropagationManager.start(); |
|
|
|
|
|
|
|
fullSyncDownloader.start(); |
|
|
|
fullSyncDownloader.start(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|