1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-15 12:19:55 +00:00
openmw-tes3mp/apps/master/MasterServer.hpp

52 lines
1.1 KiB
C++
Raw Normal View History

2017-04-23 05:39:38 +00:00
#ifndef NEWMASTERPROTO_MASTERSERVER_HPP
#define NEWMASTERPROTO_MASTERSERVER_HPP
#include <thread>
#include <chrono>
#include <RakPeerInterface.h>
#include <components/openmw-mp/Master/MasterData.hpp>
class MasterServer
{
public:
struct Ban
{
RakNet::SystemAddress sa;
bool permanent;
struct Date
{
} date;
};
2017-05-19 16:02:12 +00:00
struct SServer : QueryData
{
std::chrono::steady_clock::time_point lastUpdate;
};
2017-04-23 05:39:38 +00:00
typedef std::map<RakNet::SystemAddress, SServer> ServerMap;
2017-05-19 16:02:12 +00:00
//typedef ServerMap::const_iterator ServerCIter;
2017-04-23 05:39:38 +00:00
typedef ServerMap::iterator ServerIter;
2017-05-19 16:02:12 +00:00
MasterServer(unsigned short maxConnections, unsigned short port);
~MasterServer();
void Start();
void Stop(bool wait = false);
bool isRunning();
void Wait();
ServerMap* GetServers();
2017-04-23 05:39:38 +00:00
private:
void Thread();
private:
std::thread tMasterThread;
RakNet::RakPeerInterface* peer;
RakNet::SocketDescriptor sockdescr;
ServerMap servers;
bool run;
std::map<RakNet::RakNetGUID, std::chrono::steady_clock::time_point> pendingACKs;
2017-04-23 05:39:38 +00:00
};
#endif //NEWMASTERPROTO_MASTERSERVER_HPP