2020-08-23 17:14:54 +00:00
|
|
|
#pragma once
|
2020-08-18 20:42:30 +00:00
|
|
|
|
|
|
|
#include "CNProtocol.hpp"
|
2020-08-22 15:25:42 +00:00
|
|
|
#include "Defines.hpp"
|
2020-08-18 20:42:30 +00:00
|
|
|
|
|
|
|
#include <map>
|
|
|
|
|
|
|
|
#define REGISTER_SHARD_PACKET(pactype, handlr) CNShardServer::ShardPackets[pactype] = handlr;
|
2020-08-24 21:11:40 +00:00
|
|
|
#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
|
|
|
|
2020-09-16 15:45:53 +00:00
|
|
|
static void keepAliveTimer(CNServer*, time_t);
|
|
|
|
static void periodicSaveTimer(CNServer* serv, time_t currTime);
|
2020-08-24 21:11:40 +00:00
|
|
|
|
2020-08-18 20:42:30 +00:00
|
|
|
public:
|
|
|
|
static std::map<uint32_t, PacketHandler> ShardPackets;
|
2020-08-24 21:11:40 +00:00
|
|
|
static std::list<TimerEvent> Timers;
|
2020-08-18 20:42:30 +00:00
|
|
|
|
|
|
|
CNShardServer(uint16_t p);
|
|
|
|
|
2020-10-01 23:37:50 +00:00
|
|
|
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);
|
2020-10-02 17:31:47 +00:00
|
|
|
void kill();
|
2020-08-24 21:11:40 +00:00
|
|
|
void onStep();
|
2020-08-18 20:42:30 +00:00
|
|
|
};
|