Esempio n. 1
0
        private void ReplyPong(IUserToken ut, QueueResult data)
        {
            var qcoder = (QUnpacker)ut.Unpacker;

            base.BeginSend(ut, qcoder.QueueCoder.Pong(data.Name));
        }
Esempio n. 2
0
 private void ReplyUnsubscribe(IUserToken ut, QueueResult data)
 {
     _exchange.Unsubscribe(data);
 }
Esempio n. 3
0
 private void ReplyPublish(IUserToken ut, QueueResult data)
 {
     _exchange.AcceptPublish(ut.ID, data);
 }
Esempio n. 4
0
        public override async Task <QueueResult> Queue(QueueAttempt request, ServerCallContext context)
        {
            var q_result = new QueueResult
            {
                Queued = false
            };

            Player player;

            try
            {
                player = auth.GetPlayer(context);
                if (player == null)
                {
                    return(q_result);
                }
            } catch (Exception e)
            {
                Log.Exception(e);
                return(q_result);
            }

            try
            {
                return(await in_memory_worker.Schedule(() =>
                {
                    if (player.arena_state != ArenaState.NotQueued)
                    {
                        q_result.Queued = player.arena_state == ArenaState.Queued ? true : false;
                        return q_result;
                    }

                    var group = player.group;
                    if (group != null)
                    {
                        if (group.leader != player)
                        {
                            q_result.Queued = false;
                            return q_result;
                        }

                        match_maker.AddPlayers(group.players);
                        var ev = new Event
                        {
                            GroupQueueStateChanged = new Event_GroupQueueStateChanged
                            {
                                Queued = true
                                         //Matchmode is currently unused
                            }
                        };
                        foreach (var group_player in group.players)
                        {
                            if (group_player == player)
                            {
                                continue;
                            }
                            group_player.event_stream.Enqueue(ev);
                        }
                    }
                    else
                    {
                        match_maker.AddPlayer(player);
                    }

                    q_result.Queued = true;
                    return q_result;
                }));
            } catch (Exception e)
            {
                Log.Exception(e);
                return(q_result);
            }
        }
Esempio n. 5
0
 /// <summary>
 /// Добавляет результат в коллекцию.
 /// Опосредованно вызывается потоком читающим из сокета.
 /// </summary>
 private void InnerAdd(QueueResult <T> result)
 {
     _channel.Writer.TryWrite(result);
 }
Esempio n. 6
0
        private void ReplyPong(IUserToken ut, QueueResult data)
        {
            var qcoder = (QUnpacker)ut.Unpacker;

            _serverSokcet.Send(ut.ID, qcoder.QueueCoder.Pong(data.Name));
        }