mirror of
https://github.com/haveno-dex/haveno.git
synced 2024-10-01 01:35:48 -04:00
shutting down TorNetworkNode invokes callback handler if already complete
This commit is contained in:
parent
c39c5cf387
commit
c548fdaf29
9
Makefile
9
Makefile
@ -333,4 +333,11 @@ user3-desktop-stagenet:
|
||||
--nodePort=3103 \
|
||||
--appName=haveno-XMR_STAGENET_user3 \
|
||||
--apiPassword=apitest \
|
||||
--apiPort=3203
|
||||
--apiPort=3203
|
||||
|
||||
# Mainnet network
|
||||
|
||||
monerod:
|
||||
./.localnet/monerod \
|
||||
--bootstrap-daemon-address auto \
|
||||
--rpc-access-control-origins http://localhost:8080 \
|
@ -1137,7 +1137,7 @@ public abstract class Trade implements Tradable, Model {
|
||||
}
|
||||
|
||||
public void shutDown() {
|
||||
if (wallet != null) log.info("{} {} shutting down", getClass().getSimpleName(), getId());
|
||||
if (!isPayoutUnlocked()) log.info("{} {} shutting down", getClass().getSimpleName(), getId());
|
||||
synchronized (this) {
|
||||
isInitialized = false;
|
||||
isShutDown = true;
|
||||
|
@ -322,10 +322,7 @@ public class TradeManager implements PersistedDataHost, DecryptedDirectMessageLi
|
||||
private void closeAllTrades() {
|
||||
|
||||
// collect trades to shutdown
|
||||
Set<Trade> trades = new HashSet<Trade>();
|
||||
trades.addAll(tradableList.getList());
|
||||
trades.addAll(closedTradableManager.getClosedTrades());
|
||||
trades.addAll(failedTradesManager.getObservableList());
|
||||
List<Trade> trades = getAllTrades();
|
||||
|
||||
// shut down trades in parallel
|
||||
Set<Runnable> tasks = new HashSet<Runnable>();
|
||||
|
@ -85,7 +85,6 @@ public final class DepositsConfirmedMessage extends TradeMailboxMessage {
|
||||
public String toString() {
|
||||
return "DepositsConfirmedMessage {" +
|
||||
"\n senderNodeAddress=" + senderNodeAddress +
|
||||
",\n pubKeyRing=" + pubKeyRing +
|
||||
",\n sellerPaymentAccountKey=" + Utilities.bytesAsHexString(sellerPaymentAccountKey) +
|
||||
",\n updatedMultisigHex=" + (updatedMultisigHex == null ? null : updatedMultisigHex.substring(0, Math.max(updatedMultisigHex.length(), 1000))) +
|
||||
"\n} " + super.toString();
|
||||
|
@ -45,13 +45,13 @@ Follow [instructions](https://github.com/haveno-dex/haveno-ts#run-tests) to run
|
||||
|
||||
## Release portable Monero binaries for each platform
|
||||
|
||||
1. Update the release-v0.18 branch on Haveno's [monero repo](https://github.com/haveno-dex/monero) to the latest release from upstream + any customizations (e.g. a commit to speed up testnet hardforks for local development (b509b1)).
|
||||
2. git tag testing12 && git push haveno testing12
|
||||
1. Update the release-v0.18 branch on Haveno's [monero repo](https://github.com/haveno-dex/monero) to the latest release from upstream + any customizations (e.g. a commit to speed up testnet hardforks for local development).
|
||||
2. `git tag <tag> && git push haveno <tag>`
|
||||
3. Follow instructions to [build portable binaries for each platform](#build-portable-monero-binaries-for-each-platform).
|
||||
4. Publish a new release at https://github.com/haveno-dex/monero/releases with the updated binaries and hashes.
|
||||
5. Update the paths and hashes in build.gradle and PR.
|
||||
|
||||
## Build portable Monero binaries for each platform
|
||||
### Build portable Monero binaries for each platform
|
||||
|
||||
Based on these instructions: https://github.com/monero-project/monero#cross-compiling
|
||||
|
||||
@ -60,8 +60,8 @@ Based on these instructions: https://github.com/monero-project/monero#cross-comp
|
||||
3. `sudo apt install cmake imagemagick libcap-dev librsvg2-bin libz-dev libbz2-dev libtiff-tools python-dev libtinfo5 autoconf libtool libtool-bin gperf`
|
||||
4. `git clone https://github.com/haveno-dex/monero.git`
|
||||
5. `cd ./monero (or rename this folder)`
|
||||
6. `git submodule update --init --force`
|
||||
|
||||
6. `git fetch origin && git reset --hard origin/release-v0.18`
|
||||
7. `git submodule update --init --force`
|
||||
|
||||
> Note:
|
||||
> If you get the prompt "Reversed (or previously applied) patch detected! Assume -R? [n]" then confirm 'y'.
|
||||
|
@ -58,6 +58,7 @@ public class TorNetworkNode extends NetworkNode {
|
||||
private boolean streamIsolation;
|
||||
private Socks5Proxy socksProxy;
|
||||
private boolean shutDownInProgress;
|
||||
private boolean shutDownComplete;
|
||||
private final ExecutorService executor;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -121,17 +122,21 @@ public class TorNetworkNode extends NetworkNode {
|
||||
|
||||
public void shutDown(@Nullable Runnable shutDownCompleteHandler) {
|
||||
log.info("TorNetworkNode shutdown started");
|
||||
if (shutDownComplete) {
|
||||
log.info("TorNetworkNode shutdown already completed");
|
||||
if (shutDownCompleteHandler != null) shutDownCompleteHandler.run();
|
||||
return;
|
||||
}
|
||||
if (shutDownInProgress) {
|
||||
log.warn("We got shutDown already called");
|
||||
log.warn("Ignoring request to shut down because shut down is in progress");
|
||||
return;
|
||||
}
|
||||
shutDownInProgress = true;
|
||||
|
||||
shutDownTimeoutTimer = UserThread.runAfter(() -> {
|
||||
log.error("A timeout occurred at shutDown");
|
||||
if (shutDownCompleteHandler != null)
|
||||
shutDownCompleteHandler.run();
|
||||
|
||||
shutDownComplete = true;
|
||||
if (shutDownCompleteHandler != null) shutDownCompleteHandler.run();
|
||||
executor.shutdownNow();
|
||||
}, SHUT_DOWN_TIMEOUT);
|
||||
|
||||
@ -148,8 +153,8 @@ public class TorNetworkNode extends NetworkNode {
|
||||
log.error("Shutdown torNetworkNode failed with exception", e);
|
||||
} finally {
|
||||
shutDownTimeoutTimer.stop();
|
||||
if (shutDownCompleteHandler != null)
|
||||
shutDownCompleteHandler.run();
|
||||
shutDownComplete = true;
|
||||
if (shutDownCompleteHandler != null) shutDownCompleteHandler.run();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user