From 7f83d1b312fa6749230060fb7f21f11d49f4181c Mon Sep 17 00:00:00 2001 From: chimp1984 Date: Tue, 10 Nov 2020 14:37:23 -0500 Subject: [PATCH] Cleanup tor dir if all connections lost --- seednode/src/main/java/bisq/seednode/SeedNodeMain.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/seednode/src/main/java/bisq/seednode/SeedNodeMain.java b/seednode/src/main/java/bisq/seednode/SeedNodeMain.java index 2debfb6c21e..063369bd07e 100644 --- a/seednode/src/main/java/bisq/seednode/SeedNodeMain.java +++ b/seednode/src/main/java/bisq/seednode/SeedNodeMain.java @@ -17,6 +17,7 @@ package bisq.seednode; +import bisq.core.app.TorSetup; import bisq.core.app.misc.ExecutableForAppWithP2p; import bisq.core.app.misc.ModuleForAppWithP2p; @@ -152,7 +153,11 @@ private void setupConnectionLossCheck() { checkConnectionLossTime = UserThread.runPeriodically(() -> { if (injector.getInstance(PeerManager.class).getNumAllConnectionsLostEvents() > 1) { - shutDown(this); + // Removing cache files help in case the node got flagged from Tor's dos protection + injector.getInstance(TorSetup.class).cleanupTorFiles(() -> { + log.info("Tor directory reset"); + shutDown(this); + }, log::error); } }, CHECK_CONNECTION_LOSS_SEC);