Files
TCPlayerbotCore/src/server/game/Server/WorldSocketMgr.h
T

75 lines
2.0 KiB
C++
Raw Normal View History

2010-10-07 15:54:07 +02:00
/*
2011-01-01 15:01:13 +01:00
* Copyright (C) 2008-2011 TrinityCore <http://www.trinitycore.org/>
2010-10-07 15:54:07 +02:00
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
2008-10-02 16:23:55 -05:00
*/
2009-10-17 15:51:44 -07:00
/** \addtogroup u2w User to World Communication
* @{
* \file WorldSocketMgr.h
* \author Derex <[email protected]>
*/
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
#ifndef __WORLDSOCKETMGR_H
#define __WORLDSOCKETMGR_H
2009-10-17 15:51:44 -07:00
#include <ace/Basic_Types.h>
#include <ace/Singleton.h>
#include <ace/Thread_Mutex.h>
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
class WorldSocket;
class ReactorRunnable;
class ACE_Event_Handler;
2009-10-17 15:51:44 -07:00
/// Manages all sockets connected to peers and network threads
class WorldSocketMgr
2008-10-02 16:23:55 -05:00
{
public:
friend class WorldSocket;
friend class ACE_Singleton<WorldSocketMgr, ACE_Thread_Mutex>;
2009-10-17 15:51:44 -07:00
/// Start network, listen at address:port .
int StartNetwork(ACE_UINT16 port, const char* address);
2009-10-17 15:51:44 -07:00
/// Stops all network threads, It will wait for all running threads .
void StopNetwork();
2009-10-17 15:51:44 -07:00
/// Wait untill all network threads have "joined" .
void Wait();
private:
int OnSocketOpen(WorldSocket* sock);
2009-10-17 15:51:44 -07:00
int StartReactiveIO(ACE_UINT16 port, const char* address);
2009-10-17 15:51:44 -07:00
private:
WorldSocketMgr();
virtual ~WorldSocketMgr();
2009-10-17 15:51:44 -07:00
ReactorRunnable* m_NetThreads;
size_t m_NetThreadsCount;
2009-10-17 15:51:44 -07:00
int m_SockOutKBuff;
int m_SockOutUBuff;
bool m_UseNoDelay;
2009-10-17 15:51:44 -07:00
ACE_Event_Handler* m_Acceptor;
2008-10-02 16:23:55 -05:00
};
2009-10-17 15:51:44 -07:00
2011-04-29 20:47:02 +02:00
#define sWorldSocketMgr ACE_Singleton<WorldSocketMgr, ACE_Thread_Mutex>::instance()
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
#endif
/// @}