public bool AddServer(uint connectionId, GameServerLogin packet)
        {
            lock (servers)
            {
                Server server = new Server()
                {
                    connectionId = connectionId, status = packet.gameMatchState, IP = packet.IP, port = (short)packet.Port
                };
                servers[connectionId] = server;

                CheckServer(servers[connectionId]);

                LOG.Info("OnAddSession ServerId[" + connectionId + "] Status[" + packet.gameMatchState.ToString() + "]");
                return(true);
            }
        }
Exemple #2
0
        public bool Execute(JHSNetworkMessage netMsg)
        {
            if (queueManager == null)
            {
                queueManager = GameServerManager.Instance;
            }

            GameServerLogin packet = netMsg.ReadMessage <GameServerLogin>();

            if (packet != null)
            {
                uint connectionId = netMsg.conn.connectionId;
                var  server       = queueManager.GetServerByConnectionId(connectionId);
                if (server == null)
                {
                    if (Settings.BINDPASSWORD == packet.PassWord)
                    {
                        if (queueManager.AddServer(connectionId, packet))
                        {
                            netMsg.conn.Send(GameServerOP.UPDATE_STATE, packet);
                        }
                    }
                }
                else
                {
                    if (server != null)
                    {
                        lock (server)
                        {
                            server.status = packet.gameMatchState;
                            LOG.Info("OnChangeSession ServerId[" + connectionId + "] Status[" + packet.gameMatchState.ToString() + "]");
                        }
                    }
                }
            }
            return(true);
        }