示例#1
0
文件: Server.cs 项目: zhangf911/grpc
        private void HandleNewServerRpc(GRPCOpError error, IntPtr batchContextPtr)
        {
            try {
                var ctx = new BatchContextSafeHandleNotOwned(batchContextPtr);

                if (error != GRPCOpError.GRPC_OP_OK)
                {
                    // TODO: handle error
                }

                var rpcInfo = new NewRpcInfo(ctx.GetServerRpcNewCall(), ctx.GetServerRpcNewMethod());

                // after server shutdown, the callback returns with null call
                if (!rpcInfo.Call.IsInvalid)
                {
                    newRpcQueue.Add(rpcInfo);
                }
            } catch (Exception e) {
                Console.WriteLine("Caught exception in a native handler: " + e);
            }
        }
示例#2
0
文件: Server.cs 项目: jwatt/kythe
        private void HandleNewServerRpc(GRPCOpError error, IntPtr batchContextPtr)
        {
            try
            {
                var ctx = new BatchContextSafeHandleNotOwned(batchContextPtr);

                if (error != GRPCOpError.GRPC_OP_OK)
                {
                    // TODO: handle error
                }

                var rpcInfo = new NewRpcInfo(ctx.GetServerRpcNewCall(), ctx.GetServerRpcNewMethod());

                // after server shutdown, the callback returns with null call
                if (!rpcInfo.Call.IsInvalid)
                {
                    newRpcQueue.Add(rpcInfo);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Caught exception in a native handler: " + e);
            }
        }