private void ReplyPong(IUserToken ut, QueueResult data) { var qcoder = (QUnpacker)ut.Unpacker; base.BeginSend(ut, qcoder.QueueCoder.Pong(data.Name)); }
private void ReplyUnsubscribe(IUserToken ut, QueueResult data) { _exchange.Unsubscribe(data); }
private void ReplyPublish(IUserToken ut, QueueResult data) { _exchange.AcceptPublish(ut.ID, data); }
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); } }
/// <summary> /// Добавляет результат в коллекцию. /// Опосредованно вызывается потоком читающим из сокета. /// </summary> private void InnerAdd(QueueResult <T> result) { _channel.Writer.TryWrite(result); }
private void ReplyPong(IUserToken ut, QueueResult data) { var qcoder = (QUnpacker)ut.Unpacker; _serverSokcet.Send(ut.ID, qcoder.QueueCoder.Pong(data.Name)); }