Пример #1
0
 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);
     }
 }
Пример #2
0
 public void Broadcast(RPCRequest Request)
 {
     if (MessageAdapter != null && RPCHandler != null)
     {
         lock (_Connections)
         {
             _Connections.ForEach(i => RPCHandler.Call(Request, MessageAdapter, i));
         }
     }
 }
Пример #3
0
        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);
        }
Пример #4
0
 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.");
     }
 }