OpenFusion/src/CNShardServer.hpp
dongresource 92307063fc Integrate the monitor's listener socket into the shard's poll()
This removes the need for a separate monitor thread.
2020-12-06 01:44:37 +01:00

32 lines
858 B
C++

#pragma once
#include "CNProtocol.hpp"
#include "Defines.hpp"
#include <map>
#define REGISTER_SHARD_PACKET(pactype, handlr) CNShardServer::ShardPackets[pactype] = handlr;
#define REGISTER_SHARD_TIMER(handlr, delta) CNShardServer::Timers.push_back(TimerEvent(handlr, delta));
class CNShardServer : public CNServer {
private:
static void handlePacket(CNSocket* sock, CNPacketData* data);
static void keepAliveTimer(CNServer*, time_t);
static void periodicSaveTimer(CNServer* serv, time_t currTime);
public:
static std::map<uint32_t, PacketHandler> ShardPackets;
static std::list<TimerEvent> Timers;
CNShardServer(uint16_t p);
static void _killConnection(CNSocket *cns);
bool checkExtraSockets(int i);
void newConnection(CNSocket* cns);
void killConnection(CNSocket* cns);
void kill();
void onStep();
};