From c3ef5c10a3c1befffd4020290e3c22d4d915d694 Mon Sep 17 00:00:00 2001 From: NikVolf Date: Sat, 16 Jul 2016 19:24:45 +0200 Subject: [PATCH] got rid of the generic parameter for ipc interface --- ethcore/src/client/chain_notify.rs | 2 +- ethcore/src/client/client.rs | 2 +- ipc/codegen/src/codegen.rs | 4 ++-- ipc/hypervisor/src/service.rs.in | 2 +- ipc/nano/src/lib.rs | 8 ++++---- ipc/rpc/src/interface.rs | 4 ++-- parity/sync/main.rs | 4 ++-- sync/src/api.rs | 4 ++-- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/ethcore/src/client/chain_notify.rs b/ethcore/src/client/chain_notify.rs index f23f3885b..71c076e4c 100644 --- a/ethcore/src/client/chain_notify.rs +++ b/ethcore/src/client/chain_notify.rs @@ -43,4 +43,4 @@ pub trait ChainNotify : Send + Sync { } } -impl IpcConfig for ChainNotify { } +impl IpcConfig for ChainNotify { } diff --git a/ethcore/src/client/client.rs b/ethcore/src/client/client.rs index 3183b0387..0a272e0a8 100644 --- a/ethcore/src/client/client.rs +++ b/ethcore/src/client/client.rs @@ -1015,4 +1015,4 @@ impl MayPanic for Client { } } -impl IpcConfig for BlockChainClient { } +impl IpcConfig for BlockChainClient { } diff --git a/ipc/codegen/src/codegen.rs b/ipc/codegen/src/codegen.rs index e6744ebb3..0849acc0a 100644 --- a/ipc/codegen/src/codegen.rs +++ b/ipc/codegen/src/codegen.rs @@ -768,7 +768,7 @@ fn ty_ident_map(original_ty: &P) -> IdentMap { ident_map } -/// implements `IpcInterface` for the given class `C` +/// implements `IpcInterface` for the given class `C` fn implement_interface( cx: &ExtCtxt, builder: &aster::AstBuilder, @@ -834,7 +834,7 @@ fn implement_interface( }; let ipc_item = quote_item!(cx, - impl $host_generics ::ipc::IpcInterface<$interface_endpoint> for $interface_endpoint $where_clause { + impl $host_generics ::ipc::IpcInterface for $interface_endpoint $where_clause { fn dispatch(&self, r: &mut R) -> Vec where R: ::std::io::Read { diff --git a/ipc/hypervisor/src/service.rs.in b/ipc/hypervisor/src/service.rs.in index f11950bdb..7beffe23f 100644 --- a/ipc/hypervisor/src/service.rs.in +++ b/ipc/hypervisor/src/service.rs.in @@ -75,4 +75,4 @@ impl HypervisorService { } } -impl ::ipc::IpcConfig for HypervisorService {} +impl ::ipc::IpcConfig for HypervisorService {} diff --git a/ipc/nano/src/lib.rs b/ipc/nano/src/lib.rs index aaa05555d..5fb2faaa7 100644 --- a/ipc/nano/src/lib.rs +++ b/ipc/nano/src/lib.rs @@ -33,7 +33,7 @@ const POLL_TIMEOUT: isize = 100; const CLIENT_CONNECTION_TIMEOUT: isize = 2500; /// Generic worker to handle service (binded) sockets -pub struct Worker where S: IpcInterface { +pub struct Worker where S: IpcInterface { service: Arc, sockets: Vec<(Socket, Endpoint)>, polls: Vec, @@ -54,9 +54,9 @@ impl GuardedSocket where S: WithSocket { } impl Deref for GuardedSocket where S: WithSocket { - type Target = Arc; + type Target = S; - fn deref(&self) -> &Arc { + fn deref(&self) -> &S { &self.client } } @@ -116,7 +116,7 @@ pub enum SocketError { RequestLink, } -impl Worker where S: IpcInterface { +impl Worker where S: IpcInterface { /// New worker over specified `service` pub fn new(service: &Arc) -> Worker { Worker:: { diff --git a/ipc/rpc/src/interface.rs b/ipc/rpc/src/interface.rs index a8d0eba2f..a3c170c2b 100644 --- a/ipc/rpc/src/interface.rs +++ b/ipc/rpc/src/interface.rs @@ -29,7 +29,7 @@ pub struct Handshake { /// Allows to configure custom version and custom handshake response for /// ipc host -pub trait IpcConfig { +pub trait IpcConfig { /// Current service api version /// Should be increased if any of the methods changes signature fn api_version() -> Version { @@ -60,7 +60,7 @@ pub enum Error { /// Allows implementor to be attached to generic worker and dispatch rpc requests /// over IPC -pub trait IpcInterface : IpcConfig { +pub trait IpcInterface : IpcConfig { /// reads the message from io, dispatches the call and returns serialized result fn dispatch(&self, r: &mut R) -> Vec where R: Read; diff --git a/parity/sync/main.rs b/parity/sync/main.rs index e91a8e403..c0d3e2031 100644 --- a/parity/sync/main.rs +++ b/parity/sync/main.rs @@ -92,7 +92,7 @@ impl Args { } } -fn run_service(addr: &str, stop_guard: Arc, service: Arc) where T: IpcInterface { +fn run_service(addr: &str, stop_guard: Arc, service: Arc) where T: IpcInterface { let socket_url = addr.to_owned(); std::thread::spawn(move || { let mut worker = nanoipc::Worker::::new(&service); @@ -114,7 +114,7 @@ fn main() { remote_client.handshake().unwrap(); let stop = Arc::new(AtomicBool::new(false)); - let sync = EthSync::new(sync_config, remote_client.clone(), network_config).unwrap(); + let sync = EthSync::new(sync_config, remote_client.service().clone(), network_config).unwrap(); run_service("ipc:///tmp/parity-sync.ipc", stop.clone(), sync.clone() as Arc); run_service("ipc:///tmp/parity-manage-net.ipc", stop.clone(), sync.clone() as Arc); diff --git a/sync/src/api.rs b/sync/src/api.rs index 4400714a6..79970a913 100644 --- a/sync/src/api.rs +++ b/sync/src/api.rs @@ -149,8 +149,8 @@ impl ChainNotify for EthSync { } } -impl IpcConfig for ManageNetwork { } -impl IpcConfig for SyncProvider { } +impl IpcConfig for ManageNetwork { } +impl IpcConfig for SyncProvider { } /// Trait for managing network pub trait ManageNetwork : Send + Sync {