Skip to content

Commit

Permalink
BlockingClient.writeBytes() error handling improvement.
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarguindzberg committed Apr 2, 2019
1 parent 465a9ea commit d3a5616
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions core/src/main/java/org/bitcoinj/net/BlockingClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,11 @@ public synchronized void writeBytes(byte[] message) throws IOException {
OutputStream stream = socket.getOutputStream();
stream.write(message);
stream.flush();
} else {
log.warn("Attempted to write to a closed socket.");
}
} catch (IOException e) {
if(!(e instanceof SocketException && e.toString().equals("Socket is closed")))
log.error("Error writing message to connection, closing connection", e);
log.error("Error writing message to connection, closing connection", e);
closeConnection();
throw e;
}
Expand Down

0 comments on commit d3a5616

Please sign in to comment.