virtual int svc()
        {
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
            sLog->outStaticDebug ("Network Thread Starting");
#endif

            ACE_ASSERT (m_Reactor);

            SocketSet::iterator i, t;

            while (!m_Reactor->reactor_event_loop_done())
            {
                // dont be too smart to move this outside the loop
                // the run_reactor_event_loop will modify interval
                ACE_Time_Value interval (0, 10000);

                if (m_Reactor->run_reactor_event_loop (interval) == -1)
                    break;

                AddNewSockets();

                for (i = m_Sockets.begin(); i != m_Sockets.end();)
                {
                    if ((*i)->Update() == -1)
                    {
                        t = i;
                        ++i;

                        (*t)->CloseSocket();

                        sScriptMgr->OnSocketClose((*t), false);

                        (*t)->RemoveReference();
                        --m_Connections;
                        m_Sockets.erase (t);
                    }
                    else
                        ++i;
                }
            }

#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
            sLog->outStaticDebug ("Network Thread exits");
#endif

            return 0;
        }
Beispiel #2
0
        virtual int svc ()
        {
            DEBUG_LOG ("Network Thread Starting");

            WorldDatabase.ThreadStart ();

            ACE_ASSERT (m_Reactor);

            SocketSet::iterator i, t;

            while (!m_Reactor->reactor_event_loop_done ())
            {
                // dont be too smart to move this outside the loop
                // the run_reactor_event_loop will modify interval
                ACE_Time_Value interval (0, 10000);

                if (m_Reactor->run_reactor_event_loop (interval) == -1)
                    break;

                AddNewSockets ();

                for (i = m_Sockets.begin (); i != m_Sockets.end ();)
                {
                    if ((*i)->Update () == -1)
                    {
                        t = i;
                        ++i;
                        (*t)->CloseSocket ();
                        (*t)->RemoveReference ();
                        --m_Connections;
                        m_Sockets.erase (t);
                    }
                    else
                        ++i;
                }
            }

            WorldDatabase.ThreadEnd ();

            DEBUG_LOG ("Network Thread Exitting");

            return 0;
        }
        virtual int svc()
        {
            TC_LOG_DEBUG(LOG_FILTER_GENERAL, "Network Thread Starting");

            ACE_ASSERT (m_Reactor);

            SocketSet::iterator i, t;

            while (!m_Reactor->reactor_event_loop_done())
            {
                // dont be too smart to move this outside the loop
                // the run_reactor_event_loop will modify interval
                ACE_Time_Value interval (0, 10000);

                if (m_Reactor->run_reactor_event_loop (interval) == -1)
                    break;

                AddNewSockets();

                for (i = m_Sockets.begin(); i != m_Sockets.end();)
                {
                    if ((*i)->Update() == -1)
                    {
                        t = i;
                        ++i;

                        (*t)->CloseSocket();

                        sScriptMgr->OnSocketClose((*t), false);

                        (*t)->RemoveReference();
                        --m_Connections;
                        m_Sockets.erase (t);
                    }
                    else
                        ++i;
                }
            }

            TC_LOG_DEBUG(LOG_FILTER_GENERAL, "Network Thread exits");

            return 0;
        }