[svn] * Added ACE for Linux and Windows (Thanks Derex for Linux part and partial Windows part)
* Updated to 6721 and 676 * Fixed TrinityScript logo * Version updated to 0.2.6721.676 --HG-- branch : trunk rename : 6700-670 => 6721-676
This commit is contained in:
+46
-16
@@ -16,32 +16,62 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/// \addtogroup u2w User to World Communication
|
||||
/// @{
|
||||
/// \file
|
||||
/** \addtogroup u2w User to World Communication
|
||||
* @{
|
||||
* \file WorldSocketMgr.h
|
||||
* \author Derex <[email protected]>
|
||||
*/
|
||||
|
||||
#ifndef __WORLDSOCKETMGR_H
|
||||
#define __WORLDSOCKETMGR_H
|
||||
|
||||
#include "Policies/Singleton.h"
|
||||
#include <ace/Basic_Types.h>
|
||||
#include <ace/Singleton.h>
|
||||
#include <ace/Thread_Mutex.h>
|
||||
|
||||
class WorldSocket;
|
||||
class ReactorRunnable;
|
||||
class ACE_Event_Handler;
|
||||
|
||||
/// Manages the list of connected WorldSockets
|
||||
class WorldSocketMgr
|
||||
/// Manages all sockets connected to peers and network threads
|
||||
class WorldSocketMgr
|
||||
{
|
||||
public:
|
||||
WorldSocketMgr();
|
||||
public:
|
||||
friend class WorldSocket;
|
||||
friend class ACE_Singleton<WorldSocketMgr,ACE_Thread_Mutex>;
|
||||
|
||||
void AddSocket(WorldSocket *s);
|
||||
void RemoveSocket(WorldSocket *s);
|
||||
void Update(time_t diff);
|
||||
|
||||
private:
|
||||
typedef std::set<WorldSocket*> SocketSet;
|
||||
SocketSet m_sockets;
|
||||
/// Start network, listen at address:port .
|
||||
int StartNetwork (ACE_UINT16 port, const char* address);
|
||||
|
||||
/// Stops all network threads, It will wait for all running threads .
|
||||
void StopNetwork ();
|
||||
|
||||
/// Wait untill all network threads have "joined" .
|
||||
void Wait ();
|
||||
|
||||
/// Make this class singleton .
|
||||
static WorldSocketMgr* Instance ();
|
||||
|
||||
private:
|
||||
int OnSocketOpen(WorldSocket* sock);
|
||||
|
||||
int StartReactiveIO(ACE_UINT16 port, const char* address);
|
||||
|
||||
private:
|
||||
WorldSocketMgr ();
|
||||
virtual ~WorldSocketMgr ();
|
||||
|
||||
ReactorRunnable* m_NetThreads;
|
||||
size_t m_NetThreadsCount;
|
||||
|
||||
int m_SockOutKBuff;
|
||||
int m_SockOutUBuff;
|
||||
bool m_UseNoDelay;
|
||||
|
||||
ACE_Event_Handler* m_Acceptor;
|
||||
};
|
||||
|
||||
#define sWorldSocketMgr MaNGOS::Singleton<WorldSocketMgr>::Instance()
|
||||
#define sWorldSocketMgr WorldSocketMgr::Instance ()
|
||||
|
||||
#endif
|
||||
/// @}
|
||||
|
||||
Reference in New Issue
Block a user