protected BasicMetrics(IMetricsAgent metricsAgent, ITaskSchedulerFactory taskSchedulerFactory)
        {
            _metricsAgent = metricsAgent;

            _taskScheduler = taskSchedulerFactory.GetTaskScheduler();
            _taskScheduler.ScheduleOnInterval(CollectMemoryAndThreadsUsage, 0, 1000);
        }
Ejemplo n.º 2
0
        public Room(IShamanLogger logger, ITaskSchedulerFactory taskSchedulerFactory, IRoomManager roomManager,
                    IRoomPropertiesContainer roomPropertiesContainer,
                    IRoomControllerFactory roomControllerFactory, IPacketSender packetSender,
                    Guid roomId, IRoomStateUpdater roomStateUpdater)
        {
            _logger                  = logger;
            _roomId                  = roomId;
            _roomStateUpdater        = roomStateUpdater;
            _createdOn               = DateTime.UtcNow;
            _taskScheduler           = taskSchedulerFactory.GetTaskScheduler();
            _roomPropertiesContainer = roomPropertiesContainer;
            _packetSender            = packetSender;

            _roomStats = new RoomStats(GetRoomId(), roomPropertiesContainer.GetPlayersCount());

            _roomController =
                roomControllerFactory.GetGameModeController(
                    new RoomContext(this), _taskScheduler, roomPropertiesContainer);

            _ = _taskScheduler.ScheduleOnInterval(() =>
            {
                var maxQueueSIze = _packetSender.GetMaxQueueSIze();
                _roomStats.AddMaxQueueSize(maxQueueSIze);
                _roomStats.AddAvgQueueSize(_packetSender.GetAverageQueueSize());
            }, 0, 1000, true);

            _ = _taskScheduler.ScheduleOnInterval(async() => await SendRoomStateUpdate(), 0, 2000, true);
        }
        public MmApplication(
            IShamanLogger logger,
            IApplicationConfig config,
            ISerializer serializer,
            ISocketFactory socketFactory,
            IMatchMaker matchMaker,
            IRequestSender requestSender,
            ITaskSchedulerFactory taskSchedulerFactory,
            IPacketSender packetSender,
            IShamanMessageSenderFactory messageSenderFactory,
            IMatchMakerServerInfoProvider serverProvider,
            IRoomManager roomManager, IMatchMakingGroupsManager matchMakingGroupManager, IPlayersManager playersManager, IMmMetrics mmMetrics, IProtectionManager protectionManager) : base(logger, config, serializer,
                                                                                                                                                                                            socketFactory, taskSchedulerFactory, requestSender, mmMetrics, protectionManager)
        {
            _packetSender            = packetSender;
            _messageSenderFactory    = messageSenderFactory;
            _serverProvider          = serverProvider;
            _roomManager             = roomManager;
            _matchMakingGroupManager = matchMakingGroupManager;
            _playersManager          = playersManager;
            _matchMaker = matchMaker;
            _id         = Guid.NewGuid();

            Logger?.Debug($"MmApplication constructor called. Id = {_id}");
        }
Ejemplo n.º 4
0
 public RouterServerInfoProvider(IConfigurationRepository configRepo, ITaskSchedulerFactory taskSchedulerFactory, IOptions <RouterConfiguration> config, IShamanLogger logger)
 {
     _configRepo           = configRepo;
     _taskSchedulerFactory = taskSchedulerFactory;
     _config        = config;
     _logger        = logger;
     _taskScheduler = _taskSchedulerFactory.GetTaskScheduler();
 }
 public PacketBatchSender(ITaskSchedulerFactory taskSchedulerFactory, IPacketSenderConfig config,
                          IShamanLogger logger)
 {
     _config        = config;
     _logger        = logger;
     _taskScheduler = taskSchedulerFactory.GetTaskScheduler();
     _peerToPackets = new ConcurrentDictionary <IPeerSender, IPacketQueue>();
 }
Ejemplo n.º 6
0
 public QuadNodeFactory(IQuadMeshFactory meshFactory, ISplitMergeStrategy splitMergeStrategy, ITaskSchedulerFactory taskSchedulerFactory, IQuadNodeRendererFactory rendererFactory, Statistics statistics)
 {
     _meshFactory = meshFactory;
     _rendererFactory = rendererFactory;
     _splitMergeStrategy = splitMergeStrategy;
     _taskSchedulerFactory = taskSchedulerFactory;
     _statistics = statistics;
 }
 public RoomManager(IMatchMakerServerInfoProvider serverProvider, IShamanLogger logger,
                    ITaskSchedulerFactory taskSchedulerFactory, IRoomApiProvider roomApiProvider)
 {
     _serverProvider  = serverProvider;
     _logger          = logger;
     _roomApiProvider = roomApiProvider;
     _taskScheduler   = taskSchedulerFactory.GetTaskScheduler();
 }
Ejemplo n.º 8
0
 public QuadNodeFactory(IQuadMeshFactory meshFactory, ISplitMergeStrategy splitMergeStrategy, ITaskSchedulerFactory taskSchedulerFactory, IQuadNodeRendererFactory rendererFactory, Statistics statistics)
 {
     _meshFactory          = meshFactory;
     _rendererFactory      = rendererFactory;
     _splitMergeStrategy   = splitMergeStrategy;
     _taskSchedulerFactory = taskSchedulerFactory;
     _statistics           = statistics;
 }
 public ShamanClientFactory()
 {
     _logger = new ConsoleLogger("C", LogLevel.Error | LogLevel.Info);
     _taskSchedulerFactory = new TaskSchedulerFactory(_logger);
     _serializer           = new BinarySerializer();
     _requestSender        = new TestClientHttpSender(_logger, _serializer);
     _clientPeerListener   = new TestClientPeerListener(_logger);
     _clientPeerConfig     = new ClientPeerConfig();
 }
Ejemplo n.º 10
0
 public RouterServerActualizer(IStatisticsProvider statsProvider, ITaskSchedulerFactory taskSchedulerFactory, IRequestSender requestSender,
                               IRoutingConfig routingConfig, IShamanLogger logger)
 {
     _statsProvider = statsProvider;
     _requestSender = requestSender;
     _routingConfig = routingConfig;
     _logger        = logger;
     _taskScheduler = taskSchedulerFactory.GetTaskScheduler();
 }
 public ConnectDdosProtection(
     IProtectionManagerConfig config,
     ITaskSchedulerFactory taskSchedulerFactory,
     IShamanLogger logger)
 {
     _config        = config;
     _taskScheduler = taskSchedulerFactory.GetTaskScheduler();
     _logger        = logger;
 }
Ejemplo n.º 12
0
 public RouterMetaProvider(ITaskSchedulerFactory taskSchedulerFactory, IRouterClient routerClient,
                           IServerIdentityProvider serverIdentityProvider, IShamanLogger logger)
 {
     _serverIdentity = serverIdentityProvider.Get();
     _taskScheduler  = taskSchedulerFactory.GetTaskScheduler();
     _routerClient   = routerClient;
     _logger         = logger;
     Load().Wait();
 }
 public OpenFromWebViewModel(
     IDialogService dialogService,
     Func <string, IMetaWeblogService> getMetaWeblog,
     ITaskSchedulerFactory taskScheduler)
 {
     this.dialogService = dialogService;
     this.getMetaWeblog = getMetaWeblog;
     this.taskScheduler = taskScheduler;
 }
 public MatchMakerServerInfoProvider(ITaskSchedulerFactory taskSchedulerFactory,
                                     IRouterServerInfoProviderConfig config, IShamanLogger logger, IRouterClient routerClient)
 {
     _logger          = logger;
     _routerClient    = routerClient;
     _taskScheduler   = taskSchedulerFactory.GetTaskScheduler();
     _config          = config;
     _isRequestingNow = false;
 }
Ejemplo n.º 15
0
 public GameToMmServerActualizer(IRequestSender requestSender, ITaskSchedulerFactory taskSchedulerFactory, IStatisticsProvider statsProvider, IApplicationConfig config, IShamanLogger logger, IMatchMakerInfoProvider matchMakerInfoProvider)
 {
     _requestSender          = requestSender;
     _taskScheduler          = taskSchedulerFactory.GetTaskScheduler();
     _statsProvider          = statsProvider;
     _logger                 = logger;
     _matchMakerInfoProvider = matchMakerInfoProvider;
     _config                 = config;
 }
Ejemplo n.º 16
0
 public OpenFromWebViewModel(
     IDialogService dialogService, 
     Func<string, IMetaWeblogService> getMetaWeblog,
     ITaskSchedulerFactory taskScheduler )
 {
     this.dialogService = dialogService;
     this.getMetaWeblog = getMetaWeblog;
     this.taskScheduler = taskScheduler;
 }
Ejemplo n.º 17
0
 public QuadNode(IQuadMesh mesh, IQuadNodeFactory quadNodeFactory, ISplitMergeStrategy splitMergeStrategy, ITaskSchedulerFactory taskSchedulerFactory, IQuadNodeRenderer renderer, Statistics statistics)
 {
     _mesh                 = mesh;
     _quadNodeFactory      = quadNodeFactory;
     _splitMergeStrategy   = splitMergeStrategy;
     _taskSchedulerFactory = taskSchedulerFactory;
     _renderer             = renderer;
     _statistics           = statistics;
 }
Ejemplo n.º 18
0
 public QuadNode(IQuadMesh mesh, IQuadNodeFactory quadNodeFactory, ISplitMergeStrategy splitMergeStrategy, ITaskSchedulerFactory taskSchedulerFactory, IQuadNodeRenderer renderer, Statistics statistics)
 {
     _mesh = mesh;
     _quadNodeFactory = quadNodeFactory;
     _splitMergeStrategy = splitMergeStrategy;
     _taskSchedulerFactory = taskSchedulerFactory;
     _renderer = renderer;
     _statistics = statistics;
 }
 public void Setup()
 {
     _logger               = new ConsoleLogger();
     _serverProvider       = new FakeServerProvider();
     _taskSchedulerFactory = new TaskSchedulerFactory(_logger);
     _requestSender        = new FakeSender();
     _roomApiProvider      = new DefaultRoomApiProvider(_requestSender, _logger);
     _roomManager          = new RoomManager(_serverProvider, _logger, _taskSchedulerFactory, _roomApiProvider);
     _roomManager.Start(5);
 }
 public GameApplication(IShamanLogger logger, IApplicationConfig config, ISerializer serializer,
                        ISocketFactory socketFactory, ITaskSchedulerFactory taskSchedulerFactory, IRequestSender requestSender,
                        IRoomManager roomManager, IPacketSender packetSender, IGameMetrics gameMetrics,
                        IShamanMessageSenderFactory messageSenderFactory, IProtectionManager protectionManager) :
     base(logger, config, serializer, socketFactory, taskSchedulerFactory, requestSender, gameMetrics, protectionManager)
 {
     _roomManager          = roomManager;
     _packetSender         = packetSender;
     _messageSenderFactory = messageSenderFactory;
     Logger.Debug($"GameApplication constructor called");
 }
Ejemplo n.º 21
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SchedulerTaskFactory" /> class.
 /// </summary>
 /// <param name="schedulerFactory">The scheduler factory.</param>
 public SchedulerTaskFactory(ITaskSchedulerFactory schedulerFactory)
 {
     Guard.NotNull(() => schedulerFactory, schedulerFactory);
     _scheduler = new Lazy<ATaskScheduler>(schedulerFactory.Create);
     _factory = new Lazy<TaskFactory>(() =>
     {
         lock (_tryStartNewLocker)
         {
             return new TaskFactory(_scheduler.Value);
         }
     });
 }
Ejemplo n.º 22
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SchedulerTaskFactory" /> class.
 /// </summary>
 /// <param name="schedulerFactory">The scheduler factory.</param>
 public SchedulerTaskFactory(ITaskSchedulerFactory schedulerFactory)
 {
     Guard.NotNull(() => schedulerFactory, schedulerFactory);
     _scheduler = new Lazy <ATaskScheduler>(schedulerFactory.Create);
     _factory   = new Lazy <TaskFactory>(() =>
     {
         lock (_tryStartNewLocker)
         {
             return(new TaskFactory(_scheduler.Value));
         }
     });
 }
Ejemplo n.º 23
0
 public MatchMakingGroupManager(IShamanLogger logger, ITaskSchedulerFactory taskSchedulerFactory,
                                IPlayersManager playersManager, IShamanMessageSender messageSender, IMmMetrics mmMetrics, IRoomManager roomManager,
                                IRoomPropertiesProvider roomPropertiesProvider, IApplicationConfig config)
 {
     _logger = logger;
     _taskSchedulerFactory   = taskSchedulerFactory;
     _playersManager         = playersManager;
     _messageSender          = messageSender;
     _mmMetrics              = mmMetrics;
     _roomManager            = roomManager;
     _roomPropertiesProvider = roomPropertiesProvider;
     _config = config;
 }
 protected ApplicationBase(IShamanLogger logger, IApplicationConfig config, ISerializer serializer,
                           ISocketFactory socketFactory, ITaskSchedulerFactory taskSchedulerFactory, IRequestSender requestSender,
                           IServerMetrics serverMetrics, IProtectionManager banManager)
 {
     Logger               = logger;
     Config               = config;
     Serializer           = serializer;
     SocketFactory        = socketFactory;
     TaskSchedulerFactory = taskSchedulerFactory;
     TaskScheduler        = taskSchedulerFactory.GetTaskScheduler();
     RequestSender        = requestSender;
     ServerMetrics        = serverMetrics;
     _protectionManager   = banManager;
 }
Ejemplo n.º 25
0
 public virtual void Initialize(IShamanLogger logger, IPeerCollection <T> peerCollection, ISerializer serializer,
                                IApplicationConfig config, ITaskSchedulerFactory taskSchedulerFactory, ushort port,
                                ISocketFactory socketFactory, IRequestSender requestSender, IProtectionManager protectionManager)
 {
     _logger               = logger;
     PeerCollection        = peerCollection;
     Serializer            = serializer;
     Config                = config;
     _taskSchedulerFactory = taskSchedulerFactory;
     TaskScheduler         = _taskSchedulerFactory.GetTaskScheduler();
     _port              = port;
     _socketFactory     = socketFactory;
     RequestSender      = requestSender;
     _protectionManager = protectionManager;
 }
Ejemplo n.º 26
0
        public ShamanClientPeer(IShamanLogger logger, ITaskSchedulerFactory taskSchedulerFactory,
                                ISerializer serializer, IRequestSender requestSender,
                                IShamanClientPeerListener listener, IShamanClientPeerConfig config)
        {
            _status = ShamanClientStatus.Offline;

            _shamanMessageHandler = new MessageHandler(logger, serializer);
            _bundleMessageHandler = new MessageHandler(logger, serializer);

            _logger        = logger;
            _taskScheduler = taskSchedulerFactory.GetTaskScheduler();
//            _serializer.InitializeDefaultSerializers(0, "client");
            _clientPeer    = new ClientPeer(logger, taskSchedulerFactory, config.MaxPacketSize, config.SendTickMs);
            _requestSender = requestSender;
            _listener      = listener;
            _clientPeer.OnDisconnectedFromServer += (reason) =>
            {
                switch (_status)
                {
                case ShamanClientStatus.ConnectingGameServer:
                case ShamanClientStatus.AuthorizingGameServer:
                case ShamanClientStatus.JoiningRoom:
                case ShamanClientStatus.InRoom:
                case ShamanClientStatus.LeavingRoom:
                    OnDisconnectedFromGameServer?.Invoke(reason);
                    break;

                case ShamanClientStatus.ConnectingMatchMaking:
                case ShamanClientStatus.AuthorizingMatchMaking:
                case ShamanClientStatus.JoiningMatchMaking:
                case ShamanClientStatus.OnMatchMaking:
                case ShamanClientStatus.LeavingMatchMaking:
                    OnDisconnectedFromMmServer?.Invoke(reason);
                    break;
                }
                OnDisconnected?.Invoke(reason);
                SetAndReportStatus(ShamanClientStatus.Disconnected, _statusCallback, error: reason.ToString());
                ResetState();
            };
            _pollPackageQueueIntervalMs = config.PollPackageQueueIntervalMs;

            if (config.StartOtherThreadMessageProcessing)
            {
                StartProcessingMessagesLoop();
            }
        }
Ejemplo n.º 27
0
        public TestClientPeer(IShamanLogger logger, ITaskSchedulerFactory taskSchedulerFactory, ISerializer serializer)
        {
            _logger        = logger;
            _serializer    = serializer;
            _taskScheduler = taskSchedulerFactory.GetTaskScheduler();
            _clientPeer    = new ClientPeer(logger, taskSchedulerFactory, 300, 10);
            //_clientPeer.OnPackageReceived += ClientOnPackageReceived;

            _clientPeer.OnDisconnectedFromServer = OnDisconnected;

            _taskScheduler.ScheduleOnInterval(() =>
            {
                IPacketInfo pack = null;
                while ((pack = _clientPeer.PopNextPacket()) != null)
                {
                    ClientOnPackageReceived(pack);
                }
            }, 0, 10);
        }
        public MatchMakingGroup(Dictionary <byte, object> roomProperties,
                                IShamanLogger logger, ITaskSchedulerFactory taskSchedulerFactory, IPlayersManager playersManager,
                                IShamanMessageSender messageSender, IMmMetrics mmMetrics, IRoomManager roomManager)
        {
            Id = Guid.NewGuid();

            _logger             = logger;
            _playersManager     = playersManager;
            _taskScheduler      = taskSchedulerFactory.GetTaskScheduler();
            _matchmakingPlayers = new Queue <MatchMakingPlayer>();
            RoomProperties      = roomProperties;
            _messageSender      = messageSender;
            _mmMetrics          = mmMetrics;
            _roomManager        = roomManager;

            //get properties from dict
            if (!roomProperties.TryGetValue(PropertyCode.RoomProperties.MatchMakingTick, out var tickProperty))
            {
                throw new Exception($"MatchMakingGroup ctr error: there is no MatchMakingTick property");
            }
            if (!roomProperties.TryGetValue(PropertyCode.RoomProperties.TotalPlayersNeeded, out var totalPlayersProperty))
            {
                throw new Exception($"MatchMakingGroup ctr error: there is no TotalPlayersNeeded property");
            }
            if (!roomProperties.TryGetValue(PropertyCode.RoomProperties.MaximumMmTime, out var timeBeforeBotsProperty))
            {
                throw new Exception($"MatchMakingGroup ctr error: there is no MaximumMmTime property");
            }
            if (!roomProperties.TryGetValue(PropertyCode.RoomProperties.MaximumMatchMakingWeight, out var maxMmWeight))
            {
                throw new Exception($"MatchMakingGroup ctr error: there is no MaximumMatchMakingWeight property");
            }

            _matchMakingTickMs  = (int)tickProperty;
            _totalPlayersNeeded = (int)totalPlayersProperty;
            _maximumMmTime      = (int)timeBeforeBotsProperty;
            _maxMmWeight        = (int)maxMmWeight;
        }
        public void Setup()
        {
            _logger = new ConsoleLogger();
            _taskSchedulerFactory = new TaskSchedulerFactory(_logger);
            _playersManager       = new PlayersManager(Mock.Of <IMmMetrics>(), _logger);
            _packetSender         = Mock.Of <IShamanMessageSender>();
            _serverProvider       = new FakeServerProvider();
            _requestSender        = new FakeSender();
            _roomApiProvider      = new DefaultRoomApiProvider(_requestSender, _logger);
            _roomManager          = new RoomManager(_serverProvider, _logger, _taskSchedulerFactory, _roomApiProvider);

            _measures.Add(FakePropertyCodes.PlayerProperties.GameMode, 1);
            _roomProperties.Add(FakePropertyCodes.RoomProperties.MatchMakingTick, 250);
            _roomProperties.Add(FakePropertyCodes.RoomProperties.TotalPlayersNeeded, 3);
            _roomProperties.Add(FakePropertyCodes.RoomProperties.MaximumMmTime, 500);
            _roomProperties.Add(FakePropertyCodes.RoomProperties.MaximumMatchMakingWeight, 1);


            _group = new MatchMakingGroup(_roomProperties, _logger, _taskSchedulerFactory, _playersManager,
                                          _packetSender, Mock.Of <IMmMetrics>(), _roomManager);
            _roomManager.Start(10000);
            _group.Start();
        }
Ejemplo n.º 30
0
 public RoomManager(
     IShamanLogger logger,
     ISerializer serializer,
     IApplicationConfig config,
     ITaskSchedulerFactory taskSchedulerFactory,
     IRoomControllerFactory roomControllerFactory,
     IPacketSender packetSender,
     IShamanMessageSenderFactory messageSenderFactory,
     IGameMetrics gameMetrics,
     IRoomStateUpdater roomStateUpdater)
 {
     _logger                = logger;
     _serializer            = serializer;
     _taskSchedulerFactory  = taskSchedulerFactory;
     _roomControllerFactory = roomControllerFactory;
     _taskScheduler         = _taskSchedulerFactory.GetTaskScheduler();
     _taskScheduler.ScheduleOnInterval(CheckRoomsState, 0, 60000);
     _config = config;
     _taskSchedulerFactory = taskSchedulerFactory;
     _messageSender        = messageSenderFactory.Create(packetSender);
     _gameMetrics          = gameMetrics;
     _roomStateUpdater     = roomStateUpdater;
 }
        public void Setup()
        {
            // var config = new MmApplicationConfig("", "127.0.0.1", new List<ushort> {0}, "", 120000, GameProject.DefaultGame,"", 7002, isAuthOn:false);
            var config = new ApplicationConfig
            {
                PublicDomainNameOrAddress = "127.0.0.1",
                ListenPorts = new List <ushort> {
                    0
                },
                IsAuthOn       = false,
                BindToPortHttp = 7002
            };

            _logger = new ConsoleLogger();
            _roomPropertiesProvider = new FakeRoomPropertiesProvider(3, 500, 250, 3);

            _taskSchedulerFactory = new TaskSchedulerFactory(_logger);
            _playersManager       = new PlayersManager(Mock.Of <IMmMetrics>(), _logger);
            _packetSender         = Mock.Of <IShamanMessageSender>();
            _serverProvider       = new FakeServerProvider();
            _requestSender        = new FakeSender();
            _roomApiProvider      = new DefaultRoomApiProvider(_requestSender, _logger);
            _roomManager          = new RoomManager(_serverProvider, _logger, _taskSchedulerFactory, _roomApiProvider);

            _measures.Add(FakePropertyCodes.PlayerProperties.GameMode, 1);

            _playerProperties = new Dictionary <byte, object>
            {
                { FakePropertyCodes.PlayerProperties.GameMode, 1 }
            };

            _matchMakingGroupManager = new MatchMakingGroupManager(_logger, _taskSchedulerFactory, _playersManager,
                                                                   _packetSender, Mock.Of <IMmMetrics>(), _roomManager, _roomPropertiesProvider, config);
            _matchMakingGroupManager.AddMatchMakingGroup(_measures);
            _matchMakingGroupManager.Start(10000);
        }
Ejemplo n.º 32
0
 public TestSetBase()
 {
     serializer           = new BinarySerializer();
     taskSchedulerFactory = new TaskSchedulerFactory(_serverLogger);
 }
Ejemplo n.º 33
0
 public GameMetrics(IMetricsAgent metricsAgent, ITaskSchedulerFactory taskSchedulerFactory) : base(metricsAgent,
                                                                                                   taskSchedulerFactory)
 {
 }
Ejemplo n.º 34
0
        public ShamanClientPeerLegacy(IMessageDeserializer messageDeserializer, IShamanLogger logger, ITaskSchedulerFactory taskSchedulerFactory, int pollPackageQueueIntervalMs, ISerializer serializer, IRequestSender requestSender, bool startOtherThreadMessageProcessing = true, int maxPacketSize = 300, int sendTickMs = 33)
        {
            _status = ClientStatusLegacy.Offline;

            _messageDeserializer = messageDeserializer;
            _logger        = logger;
            _taskScheduler = taskSchedulerFactory.GetTaskScheduler();
            _serializer    = serializer;
//            _serializer.InitializeDefaultSerializers(0, "client");
            _clientPeer    = new ClientPeer(logger, taskSchedulerFactory, maxPacketSize, sendTickMs);
            _requestSender = requestSender;
            _clientPeer.OnDisconnectedFromServer += (reason) =>
            {
                switch (_status)
                {
                case ClientStatusLegacy.ConnectingGameServer:
                case ClientStatusLegacy.AuthorizingGameServer:
                case ClientStatusLegacy.JoiningRoom:
                case ClientStatusLegacy.InRoom:
                case ClientStatusLegacy.LeavingRoom:
                    OnDisconnectedFromGameServer?.Invoke(reason);
                    break;

                case ClientStatusLegacy.ConnectingMatchMaking:
                case ClientStatusLegacy.AuthorizingMatchMaking:
                case ClientStatusLegacy.JoiningMatchMaking:
                case ClientStatusLegacy.OnMatchMaking:
                case ClientStatusLegacy.LeavingMatchMaking:
                    OnDisconnectedFromMmServer?.Invoke(reason);
                    break;
                }
                OnDisconnected?.Invoke(reason);
                ResetState();
            };
            _pollPackageQueueIntervalMs = pollPackageQueueIntervalMs;

            if (startOtherThreadMessageProcessing)
            {
                StartProcessingMessagesLoop();
            }
        }