mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-24 12:46:45 +00:00
cancel whirlpool startup service when disconnecting
This commit is contained in:
parent
16755e3140
commit
5aea538f09
2 changed files with 6 additions and 2 deletions
|
@ -33,7 +33,6 @@ import com.sparrowwallet.sparrow.AppServices;
|
|||
import com.sparrowwallet.sparrow.EventManager;
|
||||
import com.sparrowwallet.sparrow.event.WhirlpoolMixEvent;
|
||||
import com.sparrowwallet.sparrow.event.WhirlpoolMixSuccessEvent;
|
||||
import com.sparrowwallet.sparrow.io.Config;
|
||||
import com.sparrowwallet.sparrow.wallet.UtxoEntry;
|
||||
import com.sparrowwallet.sparrow.whirlpool.dataPersister.SparrowDataPersister;
|
||||
import com.sparrowwallet.sparrow.whirlpool.dataSource.SparrowDataSource;
|
||||
|
@ -46,7 +45,6 @@ import javafx.beans.property.SimpleBooleanProperty;
|
|||
import javafx.concurrent.ScheduledService;
|
||||
import javafx.concurrent.Service;
|
||||
import javafx.concurrent.Task;
|
||||
import javafx.util.Duration;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -363,6 +361,10 @@ public class Whirlpool {
|
|||
return startupService;
|
||||
}
|
||||
|
||||
public StartupService getStartupService() {
|
||||
return startupService;
|
||||
}
|
||||
|
||||
private WalletUtxo getUtxo(WhirlpoolUtxo whirlpoolUtxo) {
|
||||
Wallet wallet = AppServices.get().getWallet(walletId);
|
||||
if(wallet != null) {
|
||||
|
|
|
@ -195,6 +195,8 @@ public class WhirlpoolServices {
|
|||
|
||||
@Subscribe
|
||||
public void disconnection(DisconnectionEvent event) {
|
||||
//Cancel any scheduled attempts to try reconnect
|
||||
whirlpoolMap.values().stream().filter(whirlpool -> whirlpool.getStartupService() != null).forEach(whirlpool -> whirlpool.getStartupService().cancel());
|
||||
stopAllWhirlpool();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue