Only log errors if shutdown is not in progress.

I want to avoid to risk changes with not calling error handlers/listeners in those cases
as not 100% sure if that could have unintended effects.

Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
This commit is contained in:
HenrikJannsen 2022-12-11 17:08:40 -05:00
parent 6addd27a33
commit 1e32d86b23
No known key found for this signature in database
GPG Key ID: 02AA2BAE387C8307

View File

@ -162,7 +162,9 @@ public abstract class NetworkNode implements MessageListener {
try {
socket.close();
} catch (Throwable throwable) {
log.error("Error at closing socket " + throwable);
if (!shutDownInProgress) {
log.error("Error at closing socket " + throwable);
}
}
existingConnection.sendMessage(networkEnvelope);
return existingConnection;
@ -188,7 +190,9 @@ public abstract class NetworkNode implements MessageListener {
@Override
public void onError(Throwable throwable) {
log.error("new OutboundConnection.ConnectionListener.onError " + throwable.getMessage());
if (!shutDownInProgress) {
log.error("new OutboundConnection.ConnectionListener.onError " + throwable.getMessage());
}
connectionListeners.forEach(e -> e.onError(throwable));
}
};