Remove redundant closing of connection

Fixes #4052, as the peer.close() already calls closeConnection if
a writeTarget is established successfully.
This commit is contained in:
Christoph Atteneder 2020-03-12 17:52:27 +01:00
parent 066614f966
commit c306781252
No known key found for this signature in database
GPG Key ID: CD5DC1C529CDFD3B

View File

@ -229,11 +229,10 @@ public class LocalBitcoinNode {
var originalNioClientLoggerLevel = silence(NioClient.class);
var originalNioClientManagerLoggerLevel = silence(NioClientManager.class);
NioClient client;
try {
log.info("Initiating attempt to connect to and handshake with a local " +
"Bitcoin node (which may or may not be running) on port {}.", port);
client = createClient(peer, port, CONNECTION_TIMEOUT);
createClient(peer, port, CONNECTION_TIMEOUT);
} catch (IOException ex) {
log.error("Local bitcoin node handshake attempt was unexpectedly interrupted", ex);
return Optional.empty();
@ -251,7 +250,6 @@ public class LocalBitcoinNode {
}
peer.close();
client.closeConnection();
restoreLoggerLevel(NioClient.class, originalNioClientLoggerLevel);
restoreLoggerLevel(NioClientManager.class, originalNioClientManagerLoggerLevel);