Пример #1
0
        public Task HandleCall(IPacketSession session, InternalPacket packet)
        {
            var rpc = new RpcTunnel <TResponse, TRequest>(session, m_MethodInv, packet.MsgId);

            rpc.Start();

            return(Task.Factory.StartNew(() =>
            {
                using (rpc)
                {
                    m_Handler
                    .Invoke(rpc.GetReceiver(), rpc.GetSender(), new ServerCallContext())
                    .ContinueWith((taskResult) => rpc.Close(taskResult))
                    .Wait();
                }
            }));
        }