public override void Request(RequestLocalOptions opt, Message req, Action <Message> on_rpy) { string id; string is_closed; lock (state_lock) { id = (nextid++).ToString(); is_closed = closed_err; if (is_closed == null) { pending [id] = new RequestInfo { cb = on_rpy, timeout = new Timer((s) => { RequestTimedOut(id); }, null, (opt.Timeout + 5) * 1000, Timeout.Infinite), }; } } if (is_closed != null) { req.Discard(); Message.StreamToCallback(on_rpy, new RPCException("transport", "Connection is closed", RPCException.DispatchFailure()).AsHeader()); } else { req.Header ["request_id"] = id; req.Header ["type"] = "request"; p.SendMessage(req); } }
// the JS requestor uses a "forwardRequest" concept which is almost certainly a premature optimization and not duplicated here public static void MakeRequest(RequestLocalOptions opts, ActionName act, string envelope, Message req, Action<Message> on_rpy) { ServiceInfo si; ActionInfo ai; if (!discovery.FindService (act, envelope, opts.TargetIdent, out si, out ai)) { req.Discard (); Message.StreamToCallback (on_rpy, new RPCException ("transport", "Action {0} not found", act).AsHeader ()); return; } // important: aliases are processed here req.Header ["action"] = ai.Name.Namespace + '.' + ai.Name.Name; req.Header ["version"] = (double)ai.Name.Version; SOAClient client; try { client = GetConnection (si); } catch (Exception ex) { RPCException rpcex = RPCException.Wrap (ex); req.Discard (); Message.StreamToCallback (on_rpy, new RPCException ("transport", "Cannot establish connection", rpcex, RPCException.DispatchFailure ()).AsHeader ()); return; } if (opts.Timeout == 0) opts.Timeout = ai.Timeout; client.Request (opts, req, on_rpy); }
public override void Request(RequestLocalOptions opt, Message req, Action<Message> on_rpy) { string id; string is_closed; lock (state_lock) { id = (nextid++).ToString (); is_closed = closed_err; if (is_closed == null) { pending [id] = new RequestInfo { cb = on_rpy, timeout = new Timer ((s) => { RequestTimedOut (id); }, null, (opt.Timeout + 5) * 1000, Timeout.Infinite), }; } } if (is_closed != null) { req.Discard (); Message.StreamToCallback (on_rpy, new RPCException ("transport", "Connection is closed", RPCException.DispatchFailure ()).AsHeader ()); } else { req.Header ["request_id"] = id; req.Header ["type"] = "request"; p.SendMessage (req); } }
// the JS requestor uses a "forwardRequest" concept which is almost certainly a premature optimization and not duplicated here static public void MakeRequest(RequestLocalOptions opts, ActionName act, string envelope, Message req, Action <Message> on_rpy) { ServiceInfo si; ActionInfo ai; if (!discovery.FindService(act, envelope, opts.TargetIdent, out si, out ai)) { req.Discard(); Message.StreamToCallback(on_rpy, new RPCException("transport", "Action {0} not found", act).AsHeader()); return; } // important: aliases are processed here req.Header ["action"] = ai.Name.Namespace + '.' + ai.Name.Name; req.Header ["version"] = (double)ai.Name.Version; SOAClient client; try { client = GetConnection(si); } catch (Exception ex) { RPCException rpcex = RPCException.Wrap(ex); req.Discard(); Message.StreamToCallback(on_rpy, new RPCException("transport", "Cannot establish connection", rpcex, RPCException.DispatchFailure()).AsHeader()); return; } if (opts.Timeout == 0) { opts.Timeout = ai.Timeout; } client.Request(opts, req, on_rpy); }
public abstract void Request(RequestLocalOptions opts, Message req, Action<Message> rpy);
public abstract void Request(RequestLocalOptions opts, Message req, Action <Message> rpy);