mirror of
https://github.com/boldsuck/haveno.git
synced 2024-12-22 20:19:21 +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();
|
getDataRequestType = getDataRequest.getClass().getSimpleName();
|
||||||
log.info("\n\n>> We send a {} to peer {}\n", getDataRequestType, nodeAddress);
|
log.info("\n\n>> We send a {} to peer {}\n", getDataRequestType, nodeAddress);
|
||||||
networkNode.addMessageListener(this);
|
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
|
try {
|
||||||
public void onFailure(@NotNull Throwable throwable) {
|
SettableFuture<Connection> future = networkNode.sendMessage(nodeAddress, getDataRequest);
|
||||||
if (!stopped) {
|
//noinspection UnstableApiUsage
|
||||||
String errorMessage = "Sending getDataRequest to " + nodeAddress +
|
Futures.addCallback(future, new FutureCallback<>() {
|
||||||
" failed. That is expected if the peer is offline.\n\t" +
|
@Override
|
||||||
"getDataRequest=" + getDataRequest + "." +
|
public void onSuccess(Connection connection) {
|
||||||
"\n\tException=" + throwable.getMessage();
|
if (!stopped) {
|
||||||
handleFault(errorMessage, nodeAddress, CloseConnectionReason.SEND_MSG_FAILURE);
|
log.trace("Send {} to {} succeeded.", getDataRequest, nodeAddress);
|
||||||
} else {
|
} else {
|
||||||
log.trace("We have stopped already. We ignore that networkNode.sendMessage.onFailure call. " +
|
log.trace("We have stopped already. We ignore that networkNode.sendMessage.onSuccess call." +
|
||||||
"Might be caused by a previous timeout.");
|
"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 {
|
} else {
|
||||||
log.warn("We have stopped already. We ignore that requestData call.");
|
log.warn("We have stopped already. We ignore that requestData call.");
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,35 +115,39 @@ class PeerExchangeHandler implements MessageListener {
|
||||||
TIMEOUT, TimeUnit.SECONDS);
|
TIMEOUT, TimeUnit.SECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
SettableFuture<Connection> future = networkNode.sendMessage(nodeAddress, getPeersRequest);
|
try {
|
||||||
Futures.addCallback(future, new FutureCallback<Connection>() {
|
SettableFuture<Connection> future = networkNode.sendMessage(nodeAddress, getPeersRequest);
|
||||||
@Override
|
Futures.addCallback(future, new FutureCallback<Connection>() {
|
||||||
public void onSuccess(Connection connection) {
|
@Override
|
||||||
if (!stopped) {
|
public void onSuccess(Connection connection) {
|
||||||
//TODO
|
if (!stopped) {
|
||||||
/*if (!connection.getPeersNodeAddressOptional().isPresent()) {
|
//TODO
|
||||||
connection.setPeersNodeAddress(nodeAddress);
|
/*if (!connection.getPeersNodeAddressOptional().isPresent()) {
|
||||||
log.warn("sendGetPeersRequest: !connection.getPeersNodeAddressOptional().isPresent()");
|
connection.setPeersNodeAddress(nodeAddress);
|
||||||
}*/
|
log.warn("sendGetPeersRequest: !connection.getPeersNodeAddressOptional().isPresent()");
|
||||||
|
}*/
|
||||||
PeerExchangeHandler.this.connection = connection;
|
|
||||||
connection.addMessageListener(PeerExchangeHandler.this);
|
PeerExchangeHandler.this.connection = connection;
|
||||||
} else {
|
connection.addMessageListener(PeerExchangeHandler.this);
|
||||||
log.trace("We have stopped that handler already. We ignore that sendGetPeersRequest.onSuccess call.");
|
} else {
|
||||||
|
log.trace("We have stopped that handler already. We ignore that sendGetPeersRequest.onSuccess call.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
@Override
|
public void onFailure(@NotNull Throwable throwable) {
|
||||||
public void onFailure(@NotNull Throwable throwable) {
|
if (!stopped) {
|
||||||
if (!stopped) {
|
String errorMessage = "Sending getPeersRequest to " + nodeAddress +
|
||||||
String errorMessage = "Sending getPeersRequest to " + nodeAddress +
|
" failed. That is expected if the peer is offline. Exception=" + throwable.getMessage();
|
||||||
" failed. That is expected if the peer is offline. Exception=" + throwable.getMessage();
|
handleFault(errorMessage, CloseConnectionReason.SEND_MSG_FAILURE, nodeAddress);
|
||||||
handleFault(errorMessage, CloseConnectionReason.SEND_MSG_FAILURE, nodeAddress);
|
} else {
|
||||||
} else {
|
log.trace("We have stopped that handler already. We ignore that sendGetPeersRequest.onFailure call.");
|
||||||
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 {
|
} else {
|
||||||
log.debug("My node address is still null at sendGetPeersRequest. We ignore that call.");
|
log.debug("My node address is still null at sendGetPeersRequest. We ignore that call.");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue