fn call(&mut self, pid: usize, rpc_id: RPCType, data: Vec<u8>) -> Result<Vec<u8>, RPCError> {
        // Create request header
        let req_hdr = RPCHeader {
            client_id: 0, // dummy value, no real client ID
            pid: pid,
            req_id: 0, // dummy value, no real request ID
            msg_type: rpc_id,
            msg_len: data.len() as u64,
        };

        // Serialize request header then request body
        // We assume data is already serialized
        let mut req_data = Vec::new();
        unsafe { encode(&req_hdr, &mut req_data) }.unwrap();
        if data.len() > 0 {
            req_data.extend(data);
        }

        // send data and receive response
        self.send(req_data)?;
        let mut res_data = self.recv(0)?;

        // parse out rpc header from response data
        let (_res_hdr, payload_data) = unsafe { decode::<RPCHeader>(&mut res_data) }.unwrap();
        Ok(payload_data.to_vec())
    }
/// calls a remote RPC function with rpc_id
calls a remote RPC function with rpc_id
calls a remote RPC function with rpc_id
fn call(&mut self, pid: usize, rpc_id: RPCType, data: Vec<u8>) -> Result<Vec<u8>, RPCError> {
        // Create request header
        let req_hdr = RPCHeader {
            client_id: 0, // dummy value, no real client ID
            pid: pid,
            req_id: 0, // dummy value, no real request ID
            msg_type: rpc_id,
            msg_len: data.len() as u64,
        };
        // Serialize request header then request body
        // We assume data is already serialized
        let mut req_data = Vec::new();
        unsafe { encode(&req_hdr, &mut req_data) }.unwrap();
        if data.len() > 0 {
            req_data.extend(data);
        }
        // send data and receive response
        self.send(req_data)?;
        let mut res_data = self.recv(0)?;
        // parse out rpc header from response data
        let (_res_hdr, payload_data) = unsafe { decode::<RPCHeader>(&mut res_data) }.unwrap();
        Ok(payload_data.to_vec())
    }
fn call ( & mut self , pid : usize , rpc_id : RPCType , data : Vec < u8 > ) -> Result < Vec < u8 > , RPCError > { // Create request header let req_hdr = RPCHeader { client_id : 0 , // dummy value, no real client ID pid : pid , req_id : 0 , // dummy value, no real request ID msg_type : rpc_id , msg_len : data . len ( ) as u64 , } ; // Serialize request header then request body // We assume data is already serialized let mut req_data = Vec :: new ( ) ; unsafe { encode ( & req_hdr , & mut req_data ) } . unwrap ( ) ; if data . len ( ) > 0 { req_data . extend ( data ) ; } // send data and receive response self . send ( req_data ) ? ; let mut res_data = self . recv ( 0 ) ? ; // parse out rpc header from response data let ( _res_hdr , payload_data ) = unsafe { decode :: < RPCHeader > ( & mut res_data ) } . unwrap ( ) ; Ok ( payload_data . to_vec ( ) ) }
calls a remote RPC function with rpc_id
calls a remote RPC function with rpc_id
&mut self
pid
usize
rpc_id
RPCType
data
Vec<u8>
&mut self
pid
usize
rpc_id
RPCType
data
Vec<u8>