mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-04 22:40:05 +00:00
Add support for verbose logging.
This commit is contained in:
parent
43f2def80b
commit
35c622d8a2
@ -1,3 +1,6 @@
|
||||
# should the server print every packet it receives?
|
||||
verbose=false
|
||||
|
||||
# Login Server configuration
|
||||
[login]
|
||||
# must be kept in sync with loginInfo.php
|
||||
|
@ -17,6 +17,9 @@ CNLoginServer::CNLoginServer(uint16_t p) {
|
||||
}
|
||||
|
||||
void CNLoginServer::handlePacket(CNSocket* sock, CNPacketData* data) {
|
||||
if (settings::VERBOSE)
|
||||
std::cout << "OpenFusion: received " << Defines::p2str(CL2LS, data->type) << " (" << data->type << ")" << std::endl;
|
||||
|
||||
switch (data->type) {
|
||||
case P_CL2LS_REQ_LOGIN: {
|
||||
if (data->size != sizeof(sP_CL2LS_REQ_LOGIN))
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include "CNShardServer.hpp"
|
||||
#include "PlayerManager.hpp"
|
||||
#include "CNShared.hpp"
|
||||
#include "settings.hpp"
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
@ -17,6 +18,10 @@ CNShardServer::CNShardServer(uint16_t p) {
|
||||
}
|
||||
|
||||
void CNShardServer::handlePacket(CNSocket* sock, CNPacketData* data) {
|
||||
if (settings::VERBOSE)
|
||||
std::cout << "OpenFusion: received " << Defines::p2str(CL2FE, data->type) << " (" << data->type << ")" << std::endl;
|
||||
|
||||
|
||||
if (ShardPackets.find(data->type) != ShardPackets.end())
|
||||
ShardPackets[data->type](sock, data);
|
||||
else
|
||||
@ -24,7 +29,7 @@ void CNShardServer::handlePacket(CNSocket* sock, CNPacketData* data) {
|
||||
}
|
||||
|
||||
void CNShardServer::killConnection(CNSocket* cns) {
|
||||
// remove from CNSharedData
|
||||
// remove from CNSharedData
|
||||
Player cachedPlr = PlayerManager::getPlayer(cns);
|
||||
PlayerManager::removePlayer(cns);
|
||||
|
||||
|
@ -3,6 +3,8 @@
|
||||
#include "contrib/INIReader.hpp"
|
||||
|
||||
// defaults :)
|
||||
bool settings::VERBOSE = false;
|
||||
|
||||
int settings::LOGINPORT = 8001;
|
||||
bool settings::LOGINRANDCHARACTERS = false;
|
||||
|
||||
@ -30,6 +32,7 @@ void settings::init() {
|
||||
return;
|
||||
}
|
||||
|
||||
VERBOSE = reader.GetBoolean("", "verbose", VERBOSE);
|
||||
LOGINPORT = reader.GetInteger("login", "port", LOGINPORT);
|
||||
LOGINRANDCHARACTERS = reader.GetBoolean("login", "randomcharacters", LOGINRANDCHARACTERS);
|
||||
SHARDPORT = reader.GetInteger("shard", "port", SHARDPORT);
|
||||
|
@ -2,6 +2,7 @@
|
||||
#define _SETT_HPP
|
||||
|
||||
namespace settings {
|
||||
extern bool VERBOSE;
|
||||
extern int LOGINPORT;
|
||||
extern bool LOGINRANDCHARACTERS;
|
||||
extern int SHARDPORT;
|
||||
|
Loading…
Reference in New Issue
Block a user