void HandleRequest(RPCRequest Rpc, SerializableAdapter Adapter, TCPConnection Connection) { if (_Rpcs.ContainsKey(Rpc.GetType())) { RPCResponse response = _Rpcs[Rpc.GetType()](Rpc); response.RequestId = Rpc.Id; Adapter.Send(response, Connection); } }
public void Broadcast(RPCRequest Request) { if (MessageAdapter != null && RPCHandler != null) { lock (_Connections) { _Connections.ForEach(i => RPCHandler.Call(Request, MessageAdapter, i)); } } }
public Promise Call(RPCRequest Request, SerializableAdapter Adapter, TCPConnection Connection) { Promise p = new Promise(); _Promises.Add(_NextId, p); Request.Id = _NextId; _NextId++; Adapter.Send(Request, Connection); return(p); }
public Promise Call(RPCRequest Request) { if (RPCHandler != null && MessageAdapter != null) { return(RPCHandler.Call(Request, MessageAdapter, _Connection)); } else { throw new InvalidOperationException("No RPC or Message Adapter provided."); } }