public bool HandleReply(ReqrepManager man, ReqrepManager.ReqrepType rt, int mid, PType prot, MemBlock payload, ISender returnpath, ReqrepManager.Statistics statistics, object state) { DateTime reply_time = DateTime.UtcNow; ListDictionary res_dict = new ListDictionary(); AHSender ah_rp = returnpath as AHSender; if (ah_rp != null) { res_dict["target"] = ah_rp.Destination.ToString(); } //Here are the number of microseconds res_dict["musec"] = (int)(1000.0 * ((reply_time - _start_time).TotalMilliseconds)); //Send the RPC result now; RpcManager my_rpc = System.Threading.Interlocked.Exchange(ref _rpc, null); if (my_rpc != null) { //We have not sent any reply yet: my_rpc.SendResult(_req_state, res_dict); } return(false); }
/** * Implements the IReplyHandler (also provides some light-weight statistics) */ public bool HandleReply(ReqrepManager man, ReqrepManager.ReqrepType rt, int mid, PType prot, MemBlock payload, ISender ret_path, ReqrepManager.Statistics statistics, object state) { RpcRequestState rs = (RpcRequestState)state; //ISender target = rs.RpcTarget; Channel bq = rs.Results; if (bq != null) { object data = AdrConverter.Deserialize(payload); RpcResult res = new RpcResult(ret_path, data, statistics); //handle possible exception: try { bq.Enqueue(res); //Keep listening unless the queue is closed return(!bq.Closed); } catch (System.InvalidOperationException) { //The queue is closed, stop listening for more results: return(false); } } else { //If they didn't even pass us a queue, I guess they didn't want to //listen too long return(false); } }
public bool HandleReply(ReqrepManager man, ReqrepManager.ReqrepType rt, int mid, PType prot, MemBlock payload, ISender from, ReqrepManager.Statistics s, object state) { Console.WriteLine("{0} got our message", from); return(false); }
/// <summary>This better be a SecureControl message!</summary> public bool HandleReply(ReqrepManager man, ReqrepManager.ReqrepType rt, int mid, PType prot, MemBlock payload, ISender returnpath, ReqrepManager.Statistics statistics, object state) { if (!prot.Equals(SecureControl)) { return(true); } bool done = false; try { HandleControl(payload, returnpath); } catch (Exception e) { ProtocolLog.WriteIf(ProtocolLog.Security, e.ToString()); done = true; } return(done); }