diff --git a/ipc/codegen/src/codegen.rs b/ipc/codegen/src/codegen.rs index 85ea86f16..c20514097 100644 --- a/ipc/codegen/src/codegen.rs +++ b/ipc/codegen/src/codegen.rs @@ -188,7 +188,6 @@ fn implement_dispatch_arm_invoke_stmt( ) -> ast::Stmt { let function_name = builder.id(dispatch.function_name.as_str()); - let output_type_id = builder.id(dispatch.return_type_name.clone().unwrap().as_str()); let input_args_exprs = dispatch.input_arg_names.iter().enumerate().map(|(arg_index, arg_name)| { let arg_ident = builder.id(arg_name); @@ -216,10 +215,6 @@ fn implement_dispatch_arm_invoke_stmt( tt.push(::syntax::ast::TokenTree::Token(_sp, ::syntax::parse::token::Ident(ext_cx.ident_of("serialize"), ::syntax::parse::token::Plain))); tt.push(::syntax::ast::TokenTree::Token(_sp, ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren))); tt.push(::syntax::ast::TokenTree::Token(_sp, ::syntax::parse::token::BinOp(::syntax::parse::token::And))); - tt.extend(::quasi::ToTokens::to_tokens(&output_type_id, ext_cx).into_iter()); - tt.push(::syntax::ast::TokenTree::Token(_sp, ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace))); - tt.push(::syntax::ast::TokenTree::Token(_sp, ::syntax::parse::token::Ident(ext_cx.ident_of("payload"), ::syntax::parse::token::Plain))); - tt.push(::syntax::ast::TokenTree::Token(_sp, ::syntax::parse::token::Colon)); tt.push(::syntax::ast::TokenTree::Token(_sp, ::syntax::parse::token::Ident(ext_cx.ident_of("self"), ::syntax::parse::token::Plain))); tt.push(::syntax::ast::TokenTree::Token(_sp, ::syntax::parse::token::Dot)); tt.extend(::quasi::ToTokens::to_tokens(&function_name, ext_cx).into_iter()); @@ -231,7 +226,6 @@ fn implement_dispatch_arm_invoke_stmt( } tt.push(::syntax::ast::TokenTree::Token(_sp, ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren))); - tt.push(::syntax::ast::TokenTree::Token(_sp, ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace))); tt.push(::syntax::ast::TokenTree::Token(_sp, ::syntax::parse::token::Comma)); tt.push(::syntax::ast::TokenTree::Token(_sp, ::syntax::parse::token::ModSep)); tt.push(::syntax::ast::TokenTree::Token(_sp, ::syntax::parse::token::Ident(ext_cx.ident_of("bincode"), ::syntax::parse::token::ModName))); @@ -729,6 +723,7 @@ fn implement_interface( Err(e) => { panic!("ipc read error: {:?}, aborting", e); } _ => { } } + // method_num is a 16-bit little-endian unsigned number match method_num[1] as u16 + (method_num[0] as u16)*256 { // handshake diff --git a/ipc/nano/src/lib.rs b/ipc/nano/src/lib.rs index 5c00faa50..624de776b 100644 --- a/ipc/nano/src/lib.rs +++ b/ipc/nano/src/lib.rs @@ -125,7 +125,7 @@ impl Worker where S: IpcInterface { if method_sign_len >= 2 { // method_num - let method_num = self.buf[1] as u16 * 256 + self.buf[0] as u16; + let method_num = self.buf[0] as u16 * 256 + self.buf[1] as u16; // payload let payload = &self.buf[2..]; diff --git a/ipc/tests/over_nano.rs b/ipc/tests/over_nano.rs index 0c93aba07..0c0d40372 100644 --- a/ipc/tests/over_nano.rs +++ b/ipc/tests/over_nano.rs @@ -32,7 +32,7 @@ mod tests { fn init_worker(addr: &str) -> nanoipc::Worker { - let mut worker = nanoipc::Worker::::new(Arc::new(Service::new())); + let mut worker = nanoipc::Worker::::new(&Arc::new(Service::new())); worker.add_duplex(addr).unwrap(); worker } @@ -105,5 +105,4 @@ mod tests { worker_should_exit.store(true, Ordering::Relaxed); } - } diff --git a/parity/hypervisor/mod.rs b/parity/hypervisor/mod.rs index 0716dc70c..d22585334 100644 --- a/parity/hypervisor/mod.rs +++ b/parity/hypervisor/mod.rs @@ -72,7 +72,7 @@ mod tests { #[test] fn can_init() { - let url = "ipc:///tmp/test-parity-hypervisor-10"; + let url = "ipc:///tmp/test-parity-hypervisor-10.ipc"; let hypervisor = Hypervisor::with_url(url); assert_eq!(false, hypervisor.modules_ready()); @@ -80,7 +80,7 @@ mod tests { #[test] fn can_wait_for_startup() { - let url = "ipc:///tmp/test-parity-hypervisor-20"; + let url = "ipc:///tmp/test-parity-hypervisor-20.ipc"; let test_module_id = 8080u64; let hypervisor_ready = Arc::new(AtomicBool::new(false)); @@ -90,6 +90,7 @@ mod tests { while !hypervisor_ready.load(Ordering::Relaxed) { } let client = nanoipc::init_client::>(url).unwrap(); + client.handshake().unwrap(); client.module_ready(test_module_id); });