Пример #1
0
        public override void OnClientLoopStop()
        {
            IEnumerator e = new ArrayList(m_worldServers).GetEnumerator();

            while (e.MoveNext())
            {
                WorldConnection connection = (WorldConnection)e.Current;
                if (!connection.processWorldServerData())
                {
                    if (m_shutdown == false)
                    {
                        Console.WriteLine("Lost connection to world server " + connection.ToString());
                        LoginServer.Shutdown();
                    }
                    else
                    {
                        m_worldServers.Remove(connection);
                    }
                }
            }

            if (m_shutdown && m_worldServers.Count == 0)
            {
                base.Stop();
            }

            Thread.Sleep(5);
        }
Пример #2
0
        public override void OnClientLoopStop()
        {
            try
            {
                IEnumerator e = new ArrayList(m_worldServers).GetEnumerator();
                while (e.MoveNext())
                {
                    WorldConnection connection = (WorldConnection)e.Current;
                    if (!connection.processWorldServerData())
                    {
                        if (m_shutdown == false)
                        {
                            Console.WriteLine("Lost connection to world server " + connection.ToString());
                            LoginServer.Shutdown();
                        }
                        else
                        {
                            m_worldServers.Remove(connection);
                        }
                        DebugLogger.Log("Lost connection to world server " + connection.ToString() + " -- Server will be restarted!");
                        LoginServer.RestartServer = true;
                    }
                }

                if (m_shutdown && m_worldServers.Count == 0)
                {
                    base.Stop();
                }

                Thread.Sleep(5);
            }
            catch (Exception exp)
            {
                if (exp.GetType() != typeof(ThreadAbortException))
                {
                    DebugLogger.Log("Will restart server!", exp);
                }

                LoginServer.RestartServer = true;
            }
        }