OpenFusion/src/CNShardServer.hpp

31 lines
823 B
C++
Raw Normal View History

#pragma once
2020-08-18 20:42:30 +00:00
#include "CNProtocol.hpp"
#include "Defines.hpp"
2020-08-18 20:42:30 +00:00
#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));
2020-08-18 20:42:30 +00:00
class CNShardServer : public CNServer {
private:
static void handlePacket(CNSocket* sock, CNPacketData* data);
2020-08-19 00:11:31 +00:00
static void keepAliveTimer(CNServer*, time_t);
static void periodicSaveTimer(CNServer* serv, time_t currTime);
2020-08-18 20:42:30 +00:00
public:
static std::map<uint32_t, PacketHandler> ShardPackets;
static std::list<TimerEvent> Timers;
2020-08-18 20:42:30 +00:00
CNShardServer(uint16_t p);
static void _killConnection(CNSocket *cns);
2020-08-22 23:31:09 +00:00
void newConnection(CNSocket* cns);
2020-08-18 20:42:30 +00:00
void killConnection(CNSocket* cns);
void kill();
void onStep();
2020-08-18 20:42:30 +00:00
};