mirror of
https://github.com/haveno-dex/haveno.git
synced 2024-11-16 15:58:08 +00:00
fix error popup on delete outdated tor files
This commit is contained in:
parent
9c359b5e29
commit
ff0ccc21e2
2 changed files with 61 additions and 52 deletions
|
@ -140,33 +140,38 @@ class RequestDataHandler implements MessageListener {
|
|||
getDataRequestType = getDataRequest.getClass().getSimpleName();
|
||||
log.info("\n\n>> We send a {} to peer {}\n", getDataRequestType, nodeAddress);
|
||||
networkNode.addMessageListener(this);
|
||||
SettableFuture<Connection> future = networkNode.sendMessage(nodeAddress, getDataRequest);
|
||||
//noinspection UnstableApiUsage
|
||||
Futures.addCallback(future, new FutureCallback<>() {
|
||||
@Override
|
||||
public void onSuccess(Connection connection) {
|
||||
if (!stopped) {
|
||||
log.trace("Send {} to {} succeeded.", getDataRequest, nodeAddress);
|
||||
} else {
|
||||
log.trace("We have stopped already. We ignore that networkNode.sendMessage.onSuccess call." +
|
||||
"Might be caused by a previous timeout.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NotNull Throwable throwable) {
|
||||
if (!stopped) {
|
||||
String errorMessage = "Sending getDataRequest to " + nodeAddress +
|
||||
" failed. That is expected if the peer is offline.\n\t" +
|
||||
"getDataRequest=" + getDataRequest + "." +
|
||||
"\n\tException=" + throwable.getMessage();
|
||||
handleFault(errorMessage, nodeAddress, CloseConnectionReason.SEND_MSG_FAILURE);
|
||||
} else {
|
||||
log.trace("We have stopped already. We ignore that networkNode.sendMessage.onFailure call. " +
|
||||
"Might be caused by a previous timeout.");
|
||||
try {
|
||||
SettableFuture<Connection> future = networkNode.sendMessage(nodeAddress, getDataRequest);
|
||||
//noinspection UnstableApiUsage
|
||||
Futures.addCallback(future, new FutureCallback<>() {
|
||||
@Override
|
||||
public void onSuccess(Connection connection) {
|
||||
if (!stopped) {
|
||||
log.trace("Send {} to {} succeeded.", getDataRequest, nodeAddress);
|
||||
} else {
|
||||
log.trace("We have stopped already. We ignore that networkNode.sendMessage.onSuccess call." +
|
||||
"Might be caused by a previous timeout.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}, MoreExecutors.directExecutor());
|
||||
|
||||
@Override
|
||||
public void onFailure(@NotNull Throwable throwable) {
|
||||
if (!stopped) {
|
||||
String errorMessage = "Sending getDataRequest to " + nodeAddress +
|
||||
" failed. That is expected if the peer is offline.\n\t" +
|
||||
"getDataRequest=" + getDataRequest + "." +
|
||||
"\n\tException=" + throwable.getMessage();
|
||||
handleFault(errorMessage, nodeAddress, CloseConnectionReason.SEND_MSG_FAILURE);
|
||||
} else {
|
||||
log.trace("We have stopped already. We ignore that networkNode.sendMessage.onFailure call. " +
|
||||
"Might be caused by a previous timeout.");
|
||||
}
|
||||
}
|
||||
}, MoreExecutors.directExecutor());
|
||||
} catch (Exception e) {
|
||||
if (!networkNode.isShutDownStarted()) throw e;
|
||||
}
|
||||
} else {
|
||||
log.warn("We have stopped already. We ignore that requestData call.");
|
||||
}
|
||||
|
|
|
@ -115,35 +115,39 @@ class PeerExchangeHandler implements MessageListener {
|
|||
TIMEOUT, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
SettableFuture<Connection> future = networkNode.sendMessage(nodeAddress, getPeersRequest);
|
||||
Futures.addCallback(future, new FutureCallback<Connection>() {
|
||||
@Override
|
||||
public void onSuccess(Connection connection) {
|
||||
if (!stopped) {
|
||||
//TODO
|
||||
/*if (!connection.getPeersNodeAddressOptional().isPresent()) {
|
||||
connection.setPeersNodeAddress(nodeAddress);
|
||||
log.warn("sendGetPeersRequest: !connection.getPeersNodeAddressOptional().isPresent()");
|
||||
}*/
|
||||
|
||||
PeerExchangeHandler.this.connection = connection;
|
||||
connection.addMessageListener(PeerExchangeHandler.this);
|
||||
} else {
|
||||
log.trace("We have stopped that handler already. We ignore that sendGetPeersRequest.onSuccess call.");
|
||||
try {
|
||||
SettableFuture<Connection> future = networkNode.sendMessage(nodeAddress, getPeersRequest);
|
||||
Futures.addCallback(future, new FutureCallback<Connection>() {
|
||||
@Override
|
||||
public void onSuccess(Connection connection) {
|
||||
if (!stopped) {
|
||||
//TODO
|
||||
/*if (!connection.getPeersNodeAddressOptional().isPresent()) {
|
||||
connection.setPeersNodeAddress(nodeAddress);
|
||||
log.warn("sendGetPeersRequest: !connection.getPeersNodeAddressOptional().isPresent()");
|
||||
}*/
|
||||
|
||||
PeerExchangeHandler.this.connection = connection;
|
||||
connection.addMessageListener(PeerExchangeHandler.this);
|
||||
} else {
|
||||
log.trace("We have stopped that handler already. We ignore that sendGetPeersRequest.onSuccess call.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NotNull Throwable throwable) {
|
||||
if (!stopped) {
|
||||
String errorMessage = "Sending getPeersRequest to " + nodeAddress +
|
||||
" failed. That is expected if the peer is offline. Exception=" + throwable.getMessage();
|
||||
handleFault(errorMessage, CloseConnectionReason.SEND_MSG_FAILURE, nodeAddress);
|
||||
} else {
|
||||
log.trace("We have stopped that handler already. We ignore that sendGetPeersRequest.onFailure call.");
|
||||
|
||||
@Override
|
||||
public void onFailure(@NotNull Throwable throwable) {
|
||||
if (!stopped) {
|
||||
String errorMessage = "Sending getPeersRequest to " + nodeAddress +
|
||||
" failed. That is expected if the peer is offline. Exception=" + throwable.getMessage();
|
||||
handleFault(errorMessage, CloseConnectionReason.SEND_MSG_FAILURE, nodeAddress);
|
||||
} else {
|
||||
log.trace("We have stopped that handler already. We ignore that sendGetPeersRequest.onFailure call.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}, MoreExecutors.directExecutor());
|
||||
}, MoreExecutors.directExecutor());
|
||||
} catch (Exception e) {
|
||||
if (!networkNode.isShutDownStarted()) throw e;
|
||||
}
|
||||
} else {
|
||||
log.debug("My node address is still null at sendGetPeersRequest. We ignore that call.");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue