dispatch_buf
This commit is contained in:
parent
0a60da622f
commit
b04d8196c7
@ -531,6 +531,15 @@ fn implement_interface(
|
||||
_ => vec![]
|
||||
}
|
||||
}
|
||||
|
||||
fn dispatch_buf<R>(&self, method_num: u16, r: &mut R) -> Vec<u8>
|
||||
where R: ::std::io::Read
|
||||
{
|
||||
match method_num {
|
||||
$dispatch_arms
|
||||
_ => vec![]
|
||||
}
|
||||
}
|
||||
}
|
||||
).unwrap(), dispatch_table))
|
||||
}
|
||||
|
@ -14,7 +14,29 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Ethcore implementation of IPC over nanomsg transport
|
||||
//! IPC over nanomsg transport
|
||||
|
||||
extern crate ethcore_ipc as ipc;
|
||||
extern crate nanomsg;
|
||||
|
||||
pub use ipc::*;
|
||||
|
||||
use std::sync::*;
|
||||
use nanomsg::{Socket, Protocol};
|
||||
|
||||
pub struct Worker<S> where S: IpcInterface<S> {
|
||||
service: Arc<S>,
|
||||
sockets: Vec<Socket>,
|
||||
}
|
||||
|
||||
impl<S> Worker<S> where S: IpcInterface<S> {
|
||||
pub fn new(service: Arc<S>, socket_addr: &str) -> Worker<S> {
|
||||
Worker::<S> {
|
||||
service: service.clone(),
|
||||
sockets: Vec::new(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn work_loop(&mut self) {
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,10 @@ use std::sync::atomic::*;
|
||||
pub trait IpcInterface<T> {
|
||||
/// reads the message from io, dispatches the call and returns result
|
||||
fn dispatch<R>(&self, r: &mut R) -> Vec<u8> where R: Read;
|
||||
|
||||
/// deserialize the payload from the io `r` and invokes method specified by `method_num`
|
||||
/// (for non-blocking io)
|
||||
fn dispatch_buf<R>(&self, method_num: u16, r: &mut R) -> Vec<u8> where R: Read;
|
||||
}
|
||||
|
||||
/// serializes method invocation (method_num and parameters) to the stream specified by `w`
|
||||
|
Loading…
Reference in New Issue
Block a user