|
|
@ -82,6 +82,7 @@ public class Synchronizer extends Thread { |
|
|
|
private volatile int syncPercent = 0; |
|
|
|
private volatile int syncPercent = 0; |
|
|
|
|
|
|
|
|
|
|
|
private static volatile boolean requestSync = false; |
|
|
|
private static volatile boolean requestSync = false; |
|
|
|
|
|
|
|
private boolean syncRequestPending = false; |
|
|
|
|
|
|
|
|
|
|
|
// Keep track of invalid blocks so that we don't keep trying to sync them
|
|
|
|
// Keep track of invalid blocks so that we don't keep trying to sync them
|
|
|
|
private Map<String, Long> invalidBlockSignatures = Collections.synchronizedMap(new HashMap<>()); |
|
|
|
private Map<String, Long> invalidBlockSignatures = Collections.synchronizedMap(new HashMap<>()); |
|
|
@ -123,6 +124,8 @@ public class Synchronizer extends Thread { |
|
|
|
// Something went wrong, so try again next time
|
|
|
|
// Something went wrong, so try again next time
|
|
|
|
requestSync = true; |
|
|
|
requestSync = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// Remember that we have a pending sync request if this attempt failed
|
|
|
|
|
|
|
|
syncRequestPending = !success; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (InterruptedException e) { |
|
|
|
} catch (InterruptedException e) { |
|
|
@ -143,6 +146,10 @@ public class Synchronizer extends Thread { |
|
|
|
return this.isSynchronizing; |
|
|
|
return this.isSynchronizing; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public boolean isSyncRequestPending() { |
|
|
|
|
|
|
|
return this.syncRequestPending; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public Integer getSyncPercent() { |
|
|
|
public Integer getSyncPercent() { |
|
|
|
synchronized (this.syncLock) { |
|
|
|
synchronized (this.syncLock) { |
|
|
|
return this.isSynchronizing ? this.syncPercent : null; |
|
|
|
return this.isSynchronizing ? this.syncPercent : null; |
|
|
|