Add better handling for port conflict error (#232)

Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
pull/2/head
mbaxter 6 years ago committed by GitHub
parent aa9ae97aa4
commit 8a8ce73926
  1. 7
      ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/netty/NettyP2PNetwork.java

@ -12,6 +12,8 @@
*/
package tech.pegasys.pantheon.ethereum.p2p.netty;
import static com.google.common.base.Preconditions.checkState;
import tech.pegasys.pantheon.crypto.SECP256K1;
import tech.pegasys.pantheon.ethereum.p2p.api.DisconnectCallback;
import tech.pegasys.pantheon.ethereum.p2p.api.Message;
@ -178,6 +180,11 @@ public final class NettyP2PNetwork implements P2PNetwork {
future -> {
final InetSocketAddress socketAddress =
(InetSocketAddress) server.channel().localAddress();
String message =
String.format(
"Unable start up P2P network on %s:%s. Check for port conflicts.",
config.getRlpx().getBindHost(), config.getRlpx().getBindPort());
checkState(socketAddress != null, message);
ourPeerInfo =
new PeerInfo(
5,

Loading…
Cancel
Save