Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

Commit

Permalink
PAN-2286 - quieter exceptions when network is unreachable (#1133)
Browse files Browse the repository at this point in the history
Lower the log level of discovery connections to unreachable networks,
such as a box without IPv6 enabled connecting to an IPv6 peer.
  • Loading branch information
shemnon authored Mar 19, 2019
1 parent 171928d commit a9b3f34
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import tech.pegasys.pantheon.util.bytes.BytesValue;

import java.net.InetSocketAddress;
import java.net.SocketException;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
Expand Down Expand Up @@ -204,11 +205,16 @@ protected void handleOutgoingPacket(final DiscoveryPeer peer, final Packet packe
.whenComplete(
(res, err) -> {
if (err != null) {
LOG.warn(
"Sending to peer {} failed, packet: {}",
peer,
wrapBuffer(packet.encode()),
err);
if (err instanceof SocketException && err.getMessage().contains("unreachable")) {
LOG.debug(
"Peer {} is unreachable, packet: {}", peer, wrapBuffer(packet.encode()), err);
} else {
LOG.warn(
"Sending to peer {} failed, packet: {}",
peer,
wrapBuffer(packet.encode()),
err);
}
return;
}
peer.setLastContacted(System.currentTimeMillis());
Expand Down

0 comments on commit a9b3f34

Please sign in to comment.