Nicer port in use errors (#2859)

* dapps port

* rpc port

* signer port

* different instance as possible cause

* network port
This commit is contained in:
keorn
2016-10-25 14:55:53 +01:00
committed by Gav Wood
parent 4fc1c5f42e
commit 8d0cff3599
4 changed files with 20 additions and 4 deletions

View File

@@ -16,6 +16,7 @@
use std::sync::Arc;
use std::collections::HashMap;
use std::io;
use util::Bytes;
use network::{NetworkProtocolHandler, NetworkService, NetworkContext, PeerId, ProtocolId,
NetworkConfiguration as BasicNetworkConfiguration, NonReservedPeerMode, NetworkError,
@@ -210,7 +211,11 @@ impl ChainNotify for EthSync {
}
fn start(&self) {
self.network.start().unwrap_or_else(|e| warn!("Error starting network: {:?}", e));
match self.network.start() {
Err(NetworkError::StdIo(ref e)) if e.kind() == io::ErrorKind::AddrInUse => warn!("Network port {:?} is already in use, make sure that another instance of an Ethereum client is not running or change the port using the --port option.", self.network.config().listen_address.expect("Listen address is not set.")),
Err(err) => warn!("Error starting network: {}", err),
_ => {},
}
self.network.register_protocol(self.handler.clone(), self.subprotocol_name, ETH_PACKET_COUNT, &[62u8, 63u8])
.unwrap_or_else(|e| warn!("Error registering ethereum protocol: {:?}", e));
// register the warp sync subprotocol