TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
WorldSocketMgr.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
3  * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License as published by the
7  * Free Software Foundation; either version 2 of the License, or (at your
8  * option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13  * more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
25 #ifndef __WORLDSOCKETMGR_H
26 #define __WORLDSOCKETMGR_H
27 
28 #include "SocketMgr.h"
29 
30 class WorldSocket;
31 
33 class TC_GAME_API WorldSocketMgr : public SocketMgr<WorldSocket>
34 {
36 
37 public:
38  ~WorldSocketMgr();
39 
40  static WorldSocketMgr& Instance();
41 
43  bool StartNetwork(boost::asio::io_service& service, std::string const& bindIp, uint16 port, int networkThreads) override;
44 
46  void StopNetwork() override;
47 
48  void OnSocketOpen(tcp::socket&& sock, uint32 threadIndex) override;
49 
50 protected:
52 
53  NetworkThread<WorldSocket>* CreateThreads() const override;
54 
55 private:
60 };
61 
62 #define sWorldSocketMgr WorldSocketMgr::Instance()
63 
64 #endif
65 
SocketMgr< WorldSocket > BaseSocketMgr
Definition: WorldSocketMgr.h:35
Definition: AsyncAcceptor.h:28
virtual bool StartNetwork(boost::asio::io_service &service, std::string const &bindIp, uint16 port, int threadCount)
Definition: SocketMgr.h:38
int32 _socketSendBufferSize
Definition: WorldSocketMgr.h:57
AsyncAcceptor * _instanceAcceptor
Definition: WorldSocketMgr.h:56
virtual NetworkThread< SocketType > * CreateThreads() const =0
virtual void OnSocketOpen(tcp::socket &&sock, uint32 threadIndex)
Definition: SocketMgr.h:87
bool _tcpNoDelay
Definition: WorldSocketMgr.h:59
Definition: SocketMgr.h:30
Manages all sockets connected to peers and network threads.
Definition: WorldSocketMgr.h:33
Definition: WorldSocket.h:70
int32_t int32
Definition: Define.h:146
uint32_t uint32
Definition: Define.h:150
uint16_t uint16
Definition: Define.h:151
virtual void StopNetwork()
Definition: SocketMgr.h:63
int32 m_SockOutUBuff
Definition: WorldSocketMgr.h:58
#define TC_GAME_API
Definition: Define.h:134