Differentiate new connection messages on the login and shard ports

This commit is contained in:
dongresource 2023-03-11 21:54:56 +01:00
parent abcfa3445b
commit a92cfaff25
4 changed files with 4 additions and 1 deletions

View File

@ -462,7 +462,7 @@ void CNServer::start() {
if (!setSockNonblocking(sock, newConnectionSocket))
continue;
std::cout << "New connection! " << inet_ntoa(address.sin_addr) << std::endl;
std::cout << "New " << serverType << " connection! " << inet_ntoa(address.sin_addr) << std::endl;
addPollFD(newConnectionSocket);

View File

@ -230,6 +230,7 @@ protected:
const size_t STARTFDSCOUNT = 8; // number of initial PollFD slots
std::vector<PollFD> fds;
std::string serverType = "invalid";
SOCKET sock;
uint16_t port;
socklen_t addressSize;

View File

@ -11,6 +11,7 @@
std::map<CNSocket*, CNLoginData> CNLoginServer::loginSessions;
CNLoginServer::CNLoginServer(uint16_t p) {
serverType = "login";
port = p;
pHandler = &CNLoginServer::handlePacket;
init();

View File

@ -16,6 +16,7 @@ std::map<uint32_t, PacketHandler> CNShardServer::ShardPackets;
std::list<TimerEvent> CNShardServer::Timers;
CNShardServer::CNShardServer(uint16_t p) {
serverType = "shard";
port = p;
pHandler = &CNShardServer::handlePacket;
REGISTER_SHARD_TIMER(keepAliveTimer, 4000);