public Reply(Call call) { Id = call.Id; MethodId = call.MethodId; Data = RPCData.Create(call.Data, RPCDataType.Reply); Data.Serializer.WriteI32(Id); Data.Serializer.WriteI32(MethodId); }
internal Call(int id, int methodId, RPCPeer peer, int localId, int remoteId) { Id = id; MethodId = methodId; Data = RPCData.Create(peer, localId, remoteId, RPCDataType.Call); Data.Serializer.WriteI32(id); Data.Serializer.WriteI32(methodId); }
public DelegateReply(DelegateCall call) { Id = call.Id; LocalDelegateId = call.LocalDelegateId; RemoteDelegateId = call.RemoteDelegateId; Data = RPCData.Create(call.Data, RPCDataType.DelegateReply); Data.Serializer.WriteI32(Id); Data.Serializer.WriteI32(LocalDelegateId); Data.Serializer.WriteI32(RemoteDelegateId); }
internal DelegateCall(int id, int localDelegateId, int remoteDelegateId, RPCPeer peer, int localId, int remoteId) { Id = id; LocalDelegateId = localDelegateId; RemoteDelegateId = remoteDelegateId; Data = RPCData.Create(peer, localId, remoteId, RPCDataType.DelegateCall); Data.Serializer.WriteI32(Id); Data.Serializer.WriteI32(LocalDelegateId); Data.Serializer.WriteI32(RemoteDelegateId); }
protected void Subscribe <T>(int eventId, Delegate del) where T : RPCDelegateImpl, new() { var rpcDelegate = CreateDelegateImpl <T>(Peer, RemoteId, del); var data = RPCData.Create(this, RPCDataType.EventSubscribe); data.Serializer.WriteI32(eventId); data.Serializer.WriteI32(rpcDelegate.Id); data.Dispatch(); eventIdsDelegates.Add(eventId, rpcDelegate.Id); }
protected void Unsubscribe(int eventId) { var delegateId = eventIdsDelegates[eventId]; var data = RPCData.Create(this, RPCDataType.EventUnsubscribe); data.Serializer.WriteI32(eventId); data.Serializer.WriteI32(delegateId); data.Dispatch(); delegates.Remove(delegateId); eventIdsDelegates.Remove(eventId); }
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 = RPCData.Create(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(); } }