OpenFusion/src/CNShardServer.hpp
2020-09-14 01:38:27 +02:00

28 lines
761 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*, uint64_t);
static void periodicSaveTimer(CNServer* serv, uint64_t currTime);
public:
static std::map<uint32_t, PacketHandler> ShardPackets;
static std::list<TimerEvent> Timers;
CNShardServer(uint16_t p);
void newConnection(CNSocket* cns);
void killConnection(CNSocket* cns);
void onStep();
};