root/trunk/src/game/WorldSocketMgr.h @ 28

Revision 6, 2.0 kB (checked in by yumileroy, 17 years ago)

[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

Original author: Neo2003
Date: 2008-10-04 06:17:19-05:00

Line 
1/*
2 * Copyright (C) 2005-2008,2007 MaNGOS <http://www.mangosproject.org/>
3 *
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.
8 *
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.
13 *
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
17 */
18
19/** \addtogroup u2w User to World Communication
20 *  @{
21 *  \file WorldSocketMgr.h
22 *  \author Derex <derex101@gmail.com>
23 */
24
25#ifndef __WORLDSOCKETMGR_H
26#define __WORLDSOCKETMGR_H
27
28#include <ace/Basic_Types.h>
29#include <ace/Singleton.h>
30#include <ace/Thread_Mutex.h>
31
32class WorldSocket;
33class ReactorRunnable;
34class ACE_Event_Handler;
35
36/// Manages all sockets connected to peers and network threads
37class WorldSocketMgr
38{
39public:
40  friend class WorldSocket;
41  friend class ACE_Singleton<WorldSocketMgr,ACE_Thread_Mutex>;
42
43  /// Start network, listen at address:port .
44  int StartNetwork (ACE_UINT16 port, const char* address);
45 
46  /// Stops all network threads, It will wait for all running threads .
47  void StopNetwork ();
48 
49  /// Wait untill all network threads have "joined" .
50  void Wait ();
51 
52  /// Make this class singleton .
53  static WorldSocketMgr* Instance ();
54 
55private:
56  int OnSocketOpen(WorldSocket* sock);
57 
58  int StartReactiveIO(ACE_UINT16 port, const char* address);
59 
60private: 
61  WorldSocketMgr ();
62  virtual ~WorldSocketMgr ();
63 
64  ReactorRunnable* m_NetThreads;
65  size_t m_NetThreadsCount;
66 
67  int m_SockOutKBuff;
68  int m_SockOutUBuff;
69  bool m_UseNoDelay;
70 
71  ACE_Event_Handler* m_Acceptor;
72};
73
74#define sWorldSocketMgr WorldSocketMgr::Instance ()
75
76#endif
77/// @}
Note: See TracBrowser for help on using the browser.