Exemple #1
0
 public void ProcessCall(RPCData.Call call)
 {
     var processCall = processors[call.MethodId].Call;
     if (processCall != null)
     {
         processCall(call);
     }
     else
     {
         SerializerUtil.Skip(call.Data.Serializer, TType.DataObject);
         var response = new RPCData(call.Data, RPCDataType.Exception);
         RPCException x = new RPCException(RPCException.ExceptionType.UnknownMethod, "Invalid method id: '" + call.MethodId + "'");
         response.Serializer.WriteI32(call.Id);
         x.Write(response.Serializer);
         response.Dispatch();
     }
 }
Exemple #2
0
        public unsafe void DispatchChanges()
        {
            foreach (var reference in referencesChanged)
            {
                var bitFieldsCount = reference.DataObject.BaseDataObjectCount + 1;
                var bitFields = stackalloc BitField[bitFieldsCount];

                reference.DataObject.GetResetChanges(bitFields);

                foreach (var peer in reference.Subscribers)
                {
                    var peerData = new RPCData(peer, RPCManager, reference.LocalId, 0, RPCDataType.ReferenceChanges);
                    // TODO: Optimize this. Dont't serialize again for each peer.
                    reference.DataObject.Write(peerData, bitFields, bitFieldsCount);
                    peerData.Dispatch();
                }
            }
        }
Exemple #3
0
        public void Subscribe(IObservableDataObject dataObject, RPCPeer peer, int remoteId)
        {
            Reference reference;
            if (!dataObjectToReference.TryGetValue(dataObject, out reference))
                reference = CreateReference(dataObject);

            reference.Subscription = new Subscription(peer, remoteId);

            subscriptionToReference.Add(reference.Subscription, reference);

            var data = new RPCData(peer, RPCManager, reference.LocalId, remoteId, RPCDataType.ReferenceSubscribe);
            data.Dispatch();
        }