// // Created by koncord on 21.04.17. // #ifndef NEWMASTERPROTO_MASTERSERVER_HPP #define NEWMASTERPROTO_MASTERSERVER_HPP #include #include #include #include class MasterServer { public: struct Ban { RakNet::SystemAddress sa; bool permanent; struct Date { } date; }; struct SServer : QueryData { std::chrono::steady_clock::time_point lastUpdate; }; typedef std::map ServerMap; //typedef ServerMap::const_iterator ServerCIter; typedef ServerMap::iterator ServerIter; MasterServer(unsigned short maxConnections, unsigned short port); ~MasterServer(); void Start(); void Stop(bool wait = false); bool isRunning(); void Wait(); ServerMap* GetServers(); private: void Thread(); private: std::thread tMasterThread; RakNet::RakPeerInterface* peer; RakNet::SocketDescriptor sockdescr; ServerMap servers; bool run; std::map pendingACKs; }; #endif //NEWMASTERPROTO_MASTERSERVER_HPP