diff --git a/parity/dapps.rs b/parity/dapps.rs index 46ac1ec60..6ef64c2fd 100644 --- a/parity/dapps.rs +++ b/parity/dapps.rs @@ -102,6 +102,7 @@ mod server { use super::Dependencies; use std::sync::Arc; use std::net::SocketAddr; + use std::io; use util::{Bytes, Address, U256}; use ethcore::transaction::{Transaction, Action}; @@ -143,7 +144,10 @@ mod server { }; match start_result { - Err(dapps::ServerError::IoError(err)) => Err(format!("WebApps io error: {}", err)), + Err(dapps::ServerError::IoError(err)) => match err.kind() { + io::ErrorKind::AddrInUse => Err(format!("WebApps address {} is already in use, make sure that another instance of an Ethereum client is not running or change the address using the --dapps-port and --dapps-interface options.", url)), + _ => Err(format!("WebApps io error: {}", err)), + }, Err(e) => Err(format!("WebApps error: {:?}", e)), Ok(server) => { server.set_panic_handler(move || { diff --git a/parity/rpc.rs b/parity/rpc.rs index 5600a7f06..c5a4df18a 100644 --- a/parity/rpc.rs +++ b/parity/rpc.rs @@ -17,6 +17,7 @@ use std::fmt; use std::sync::Arc; use std::net::SocketAddr; +use std::io; use io::PanicHandler; use ethcore_rpc::{RpcServerError, RpcServer as Server}; use jsonipc; @@ -108,7 +109,10 @@ pub fn setup_http_rpc_server( let ph = dependencies.panic_handler.clone(); let start_result = server.start_http(url, cors_domains, allowed_hosts, ph); match start_result { - Err(RpcServerError::IoError(err)) => Err(format!("RPC io error: {}", err)), + Err(RpcServerError::IoError(err)) => match err.kind() { + io::ErrorKind::AddrInUse => Err(format!("RPC address {} is already in use, make sure that another instance of an Ethereum client is not running or change the address using the --jsonrpc-port and --jsonrpc-interface options.", url)), + _ => Err(format!("RPC io error: {}", err)), + }, Err(e) => Err(format!("RPC error: {:?}", e)), Ok(server) => Ok(server), } diff --git a/parity/signer.rs b/parity/signer.rs index 869c7fab5..5097192ad 100644 --- a/parity/signer.rs +++ b/parity/signer.rs @@ -103,7 +103,10 @@ fn do_start(conf: Configuration, deps: Dependencies) -> Result Err(format!("Trusted Signer Error: {}", err)), + Err(signer::ServerError::IoError(err)) => match err.kind() { + io::ErrorKind::AddrInUse => Err(format!("Trusted Signer address {} is already in use, make sure that another instance of an Ethereum client is not running or change the address using the --signer-port and --signer-interface options.", addr)), + _ => Err(format!("Trusted Signer io error: {}", err)), + }, Err(e) => Err(format!("Trusted Signer Error: {:?}", e)), Ok(server) => { deps.panic_handler.forward_from(&server); diff --git a/sync/src/api.rs b/sync/src/api.rs index fb8fdc691..b227dcd60 100644 --- a/sync/src/api.rs +++ b/sync/src/api.rs @@ -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