Exemple #1
0
        public void Add(ActorMessage message)
        {
            this.ActorMessages.Enqueue(message);
            if (this.Tcs == null)
            {
                return;
            }

            var t = this.Tcs;

            this.Tcs = null;
            t.SetResult(this.ActorMessages.Dequeue());
        }
Exemple #2
0
        public async void Start()
        {
            while (true)
            {
                try
                {
                    ActorMessage msg = await GetAsync();

                    if (msg.message == null)
                    {
                        return;
                    }

                    await ActorHandler.Handle(msg.session, new MessageInfo(msg.opcode, msg.rpcId, (this.Parent as Entity), msg.message));
                }
                catch (Exception e)
                {
                    Log.Error(e);
                }
            }
        }