Add better handling for port conflict error (#232)

mbaxter 6 years ago committed by GitHub
parent 94f6d4e1a3
commit 025d698d0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  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; 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.crypto.SECP256K1;
import tech.pegasys.pantheon.ethereum.p2p.api.DisconnectCallback; import tech.pegasys.pantheon.ethereum.p2p.api.DisconnectCallback;
import tech.pegasys.pantheon.ethereum.p2p.api.Message; import tech.pegasys.pantheon.ethereum.p2p.api.Message;
@ -178,6 +180,11 @@ public final class NettyP2PNetwork implements P2PNetwork {
future -> { future -> {
final InetSocketAddress socketAddress = final InetSocketAddress socketAddress =
(InetSocketAddress) server.channel().localAddress(); (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 = ourPeerInfo =
new PeerInfo( new PeerInfo(
5, 5,

Loading…
Cancel
Save