[7607] Improvements in support some generic achievement classes
[AHbot.git] / src / game / WorldSocketMgr.h
blob75c98a1c9f70c17ca031f6faa107199cbe01e51d
1 /*
2 * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 /** \addtogroup u2w User to World Communication
20 * @{
21 * \file WorldSocketMgr.h
22 * \author Derex <derex101@gmail.com>
25 #ifndef __WORLDSOCKETMGR_H
26 #define __WORLDSOCKETMGR_H
28 #include <ace/Basic_Types.h>
29 #include <ace/Singleton.h>
30 #include <ace/Thread_Mutex.h>
32 class WorldSocket;
33 class ReactorRunnable;
34 class ACE_Event_Handler;
36 /// Manages all sockets connected to peers and network threads
37 class WorldSocketMgr
39 public:
40 friend class WorldSocket;
41 friend class ACE_Singleton<WorldSocketMgr,ACE_Thread_Mutex>;
43 /// Start network, listen at address:port .
44 int StartNetwork (ACE_UINT16 port, const char* address);
46 /// Stops all network threads, It will wait for all running threads .
47 void StopNetwork ();
49 /// Wait untill all network threads have "joined" .
50 void Wait ();
52 /// Make this class singleton .
53 static WorldSocketMgr* Instance ();
55 private:
56 int OnSocketOpen(WorldSocket* sock);
58 int StartReactiveIO(ACE_UINT16 port, const char* address);
60 private:
61 WorldSocketMgr ();
62 virtual ~WorldSocketMgr ();
64 ReactorRunnable* m_NetThreads;
65 size_t m_NetThreadsCount;
67 int m_SockOutKBuff;
68 int m_SockOutUBuff;
69 bool m_UseNoDelay;
71 ACE_Event_Handler* m_Acceptor;
74 #define sWorldSocketMgr WorldSocketMgr::Instance ()
77 #endif
78 /// @}