Skip to content

Commit

Permalink
fix error on shut down updating p2p connections table
Browse files Browse the repository at this point in the history
  • Loading branch information
woodser committed Jul 1, 2024
1 parent c01d634 commit 8ce91aa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ public final class XmrConnectionService {
private MoneroDaemonInfo lastInfo;
private Long syncStartHeight = null;
private TaskLooper daemonPollLooper;
@Getter
private boolean isShutDownStarted;
private List<MoneroConnectionManagerListener> listeners = new ArrayList<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public class NetworkSettingsView extends ActivatableView<GridPane, Void> {
private final ClockWatcher clockWatcher;
private final WalletsSetup walletsSetup;
private final P2PService p2PService;
private final XmrConnectionService connectionManager;
private final XmrConnectionService connectionService;

private final ObservableList<P2pNetworkListItem> p2pNetworkListItems = FXCollections.observableArrayList();
private final SortedList<P2pNetworkListItem> p2pSortedList = new SortedList<>(p2pNetworkListItems);
Expand All @@ -131,7 +131,7 @@ public class NetworkSettingsView extends ActivatableView<GridPane, Void> {
@Inject
public NetworkSettingsView(WalletsSetup walletsSetup,
P2PService p2PService,
XmrConnectionService connectionManager,
XmrConnectionService connectionService,
Preferences preferences,
XmrNodes xmrNodes,
FilterManager filterManager,
Expand All @@ -141,7 +141,7 @@ public NetworkSettingsView(WalletsSetup walletsSetup,
super();
this.walletsSetup = walletsSetup;
this.p2PService = p2PService;
this.connectionManager = connectionManager;
this.connectionService = connectionService;
this.preferences = preferences;
this.xmrNodes = xmrNodes;
this.filterManager = filterManager;
Expand Down Expand Up @@ -303,10 +303,10 @@ public void activate() {

rescanOutputsButton.setOnAction(event -> GUIUtil.rescanOutputs(preferences));

moneroPeersSubscription = EasyBind.subscribe(connectionManager.peerConnectionsProperty(),
moneroPeersSubscription = EasyBind.subscribe(connectionService.peerConnectionsProperty(),
this::updateMoneroPeersTable);

moneroBlockHeightSubscription = EasyBind.subscribe(connectionManager.chainHeightProperty(),
moneroBlockHeightSubscription = EasyBind.subscribe(connectionService.chainHeightProperty(),
this::updateChainHeightTextField);

nodeAddressSubscription = EasyBind.subscribe(p2PService.getNetworkNode().nodeAddressProperty(),
Expand Down Expand Up @@ -503,6 +503,7 @@ private void applyPreventPublicXmrNetwork() {
}

private void updateP2PTable() {
if (connectionService.isShutDownStarted()) return; // ignore if shutting down
p2pPeersTableView.getItems().forEach(P2pNetworkListItem::cleanup);
p2pNetworkListItems.clear();
p2pNetworkListItems.setAll(p2PService.getNetworkNode().getAllConnections().stream()
Expand Down

0 comments on commit 8ce91aa

Please sign in to comment.