Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
WorldSocketMgr.h
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
11
12#ifndef SF_WORLDSOCKETMGR_H
13#define SF_WORLDSOCKETMGR_H
14
15#include "Common.h"
16#include "Platform/Singleton.h"
17#include <boost/asio/io_context.hpp>
18
19class WorldSocket;
20class ReactorRunnable;
21
24{
25public:
26 friend class WorldSocket;
27 friend class WorldSocketAcceptor;
28 friend class Skyfire::Singleton<WorldSocketMgr, Skyfire::Mutex>;
29
31 int StartNetwork(uint16 port, const char* address);
32
34 void StopNetwork();
35
37 void Wait();
38
39private:
40 int OnSocketOpen(WorldSocket* sock, ReactorRunnable* reactor);
41
42 int StartReactiveIO(uint16 port, const char* address);
44 boost::asio::io_context& GetNetworkIoContext(ReactorRunnable* reactor);
45
46private:
48 virtual ~WorldSocketMgr();
49
52
56
58};
59
60#define sWorldSocketMgr Skyfire::Singleton<WorldSocketMgr, Skyfire::Mutex>::instance()
61
62#endif
Handler that can communicate over stream sockets.
Definition WorldSocket.h:51
friend class WorldSocketAcceptor
friend class WorldSocket
int StartNetwork(uint16 port, const char *address)
Start network, listen at address:port .
boost::asio::io_context & GetNetworkIoContext(ReactorRunnable *reactor)
size_t m_NetThreadsCount
int StartReactiveIO(uint16 port, const char *address)
ReactorRunnable * SelectNetworkThread()
int OnSocketOpen(WorldSocket *sock, ReactorRunnable *reactor)
void Wait()
Wait untill all network threads have "joined" .
ReactorRunnable * m_NetThreads
class WorldSocketAcceptor * m_Acceptor
void StopNetwork()
Stops all network threads, It will wait for all running threads .