コード例 #1
0
ファイル: Processor.cs プロジェクト: tritao/flood
 public bool Process(Serializer iprot, Serializer oprot)
 {
     try
     {
         Message msg = iprot.ReadMessageBegin();
         ProcessFunction fn;
         processMap_.TryGetValue(msg.Name, out fn);
         if (fn == null)
         {
             ProtocolUtil.Skip(iprot, TType.Struct);
             iprot.ReadMessageEnd();
             RPCException x = new RPCException(RPCException.ExceptionType.UnknownMethod, "Invalid method name: '" + msg.Name + "'");
             oprot.WriteMessageBegin(new Message(msg.Name, MessageType.Exception, msg.SeqID));
             x.Write(oprot);
             oprot.WriteMessageEnd();
             oprot.Transport.Flush();
             return true;
         }
         fn(msg.SeqID, iprot, oprot);
     }
     catch (IOException)
     {
         return false;
     }
     return true;
 }
コード例 #2
0
ファイル: RPCImpl.cs プロジェクト: chartly/flood
 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();
     }
 }
コード例 #3
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 = 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();
            }
        }