Remove eqemu_logsys_fmt.h header, more log tweaks

This commit is contained in:
Akkadius 2019-07-05 17:20:20 -05:00
parent f0937c3963
commit 86f9a205e5
20 changed files with 197 additions and 94 deletions

View File

@ -139,7 +139,6 @@ SET(common_headers
eqemu_config.h eqemu_config.h
eqemu_config_elements.h eqemu_config_elements.h
eqemu_logsys.h eqemu_logsys.h
eqemu_logsys_fmt.h
eq_limits.h eq_limits.h
eq_packet.h eq_packet.h
eq_stream_ident.h eq_stream_ident.h

View File

@ -14,33 +14,37 @@
#include <string.h> #include <string.h>
#ifdef _WINDOWS #ifdef _WINDOWS
#define snprintf _snprintf #define snprintf _snprintf
#define strncasecmp _strnicmp #define strncasecmp _strnicmp
#define strcasecmp _stricmp #define strcasecmp _stricmp
#include <process.h> #include <process.h>
#else #else
#include "unix.h"
#include <pthread.h> #include "unix.h"
#include <pthread.h>
#endif #endif
#ifdef _EQDEBUG #ifdef _EQDEBUG
#define DEBUG_MYSQL_QUERIES 0 #define DEBUG_MYSQL_QUERIES 0
#else #else
#define DEBUG_MYSQL_QUERIES 0 #define DEBUG_MYSQL_QUERIES 0
#endif #endif
DBcore::DBcore() { DBcore::DBcore()
{
mysql_init(&mysql); mysql_init(&mysql);
pHost = 0; pHost = 0;
pUser = 0; pUser = 0;
pPassword = 0; pPassword = 0;
pDatabase = 0; pDatabase = 0;
pCompress = false; pCompress = false;
pSSL = false; pSSL = false;
pStatus = Closed; pStatus = Closed;
} }
DBcore::~DBcore() { DBcore::~DBcore()
{
mysql_close(&mysql); mysql_close(&mysql);
safe_delete_array(pHost); safe_delete_array(pHost);
safe_delete_array(pUser); safe_delete_array(pUser);
@ -49,7 +53,8 @@ DBcore::~DBcore() {
} }
// Sends the MySQL server a keepalive // Sends the MySQL server a keepalive
void DBcore::ping() { void DBcore::ping()
{
if (!MDatabase.trylock()) { if (!MDatabase.trylock()) {
// well, if's it's locked, someone's using it. If someone's using it, it doesnt need a keepalive // well, if's it's locked, someone's using it. If someone's using it, it doesnt need a keepalive
return; return;
@ -63,34 +68,32 @@ MySQLRequestResult DBcore::QueryDatabase(std::string query, bool retryOnFailureO
return QueryDatabase(query.c_str(), query.length(), retryOnFailureOnce); return QueryDatabase(query.c_str(), query.length(), retryOnFailureOnce);
} }
MySQLRequestResult DBcore::QueryDatabase(const char* query, uint32 querylen, bool retryOnFailureOnce) MySQLRequestResult DBcore::QueryDatabase(const char *query, uint32 querylen, bool retryOnFailureOnce)
{ {
LockMutex lock(&MDatabase); LockMutex lock(&MDatabase);
// Reconnect if we are not connected before hand. // Reconnect if we are not connected before hand.
if (pStatus != Connected) if (pStatus != Connected) {
Open(); Open();
}
// request query. != 0 indicates some kind of error. // request query. != 0 indicates some kind of error.
if (mysql_real_query(&mysql, query, querylen) != 0) if (mysql_real_query(&mysql, query, querylen) != 0) {
{
unsigned int errorNumber = mysql_errno(&mysql); unsigned int errorNumber = mysql_errno(&mysql);
if (errorNumber == CR_SERVER_GONE_ERROR) if (errorNumber == CR_SERVER_GONE_ERROR) {
pStatus = Error; pStatus = Error;
}
// error appears to be a disconnect error, may need to try again. // error appears to be a disconnect error, may need to try again.
if (errorNumber == CR_SERVER_LOST || errorNumber == CR_SERVER_GONE_ERROR) if (errorNumber == CR_SERVER_LOST || errorNumber == CR_SERVER_GONE_ERROR) {
{
if (retryOnFailureOnce) if (retryOnFailureOnce) {
{ Log(Logs::General, Logs::Status, "Database Error: Lost connection, attempting to recover...");
std::cout << "Database Error: Lost connection, attempting to recover...." << std::endl;
MySQLRequestResult requestResult = QueryDatabase(query, querylen, false); MySQLRequestResult requestResult = QueryDatabase(query, querylen, false);
if (requestResult.Success()) if (requestResult.Success()) {
{ Log(Logs::General, Logs::Status, "Reconnection to database successful");
std::cout << "Reconnection to database successful." << std::endl;
return requestResult; return requestResult;
} }
@ -102,109 +105,147 @@ MySQLRequestResult DBcore::QueryDatabase(const char* query, uint32 querylen, boo
snprintf(errorBuffer, MYSQL_ERRMSG_SIZE, "#%i: %s", mysql_errno(&mysql), mysql_error(&mysql)); snprintf(errorBuffer, MYSQL_ERRMSG_SIZE, "#%i: %s", mysql_errno(&mysql), mysql_error(&mysql));
return MySQLRequestResult(nullptr, 0, 0, 0, 0, (uint32)mysql_errno(&mysql), errorBuffer); return MySQLRequestResult(nullptr, 0, 0, 0, 0, (uint32) mysql_errno(&mysql), errorBuffer);
} }
auto errorBuffer = new char[MYSQL_ERRMSG_SIZE]; auto errorBuffer = new char[MYSQL_ERRMSG_SIZE];
snprintf(errorBuffer, MYSQL_ERRMSG_SIZE, "#%i: %s", mysql_errno(&mysql), mysql_error(&mysql)); snprintf(errorBuffer, MYSQL_ERRMSG_SIZE, "#%i: %s", mysql_errno(&mysql), mysql_error(&mysql));
/* Implement Logging at the Root */ /* Implement Logging at the Root */
if (mysql_errno(&mysql) > 0 && strlen(query) > 0){ if (mysql_errno(&mysql) > 0 && strlen(query) > 0) {
if (LogSys.log_settings[Logs::MySQLError].is_category_enabled == 1) if (LogSys.log_settings[Logs::MySQLError].is_category_enabled == 1)
Log(Logs::General, Logs::MySQLError, "%i: %s \n %s", mysql_errno(&mysql), mysql_error(&mysql), query); Log(Logs::General, Logs::MySQLError, "%i: %s \n %s", mysql_errno(&mysql), mysql_error(&mysql), query);
} }
return MySQLRequestResult(nullptr, 0, 0, 0, 0, mysql_errno(&mysql),errorBuffer); return MySQLRequestResult(nullptr, 0, 0, 0, 0, mysql_errno(&mysql), errorBuffer);
} }
// successful query. get results. // successful query. get results.
MYSQL_RES* res = mysql_store_result(&mysql); MYSQL_RES *res = mysql_store_result(&mysql);
uint32 rowCount = 0; uint32 rowCount = 0;
if (res != nullptr) if (res != nullptr) {
rowCount = (uint32)mysql_num_rows(res); rowCount = (uint32) mysql_num_rows(res);
}
MySQLRequestResult requestResult(res, (uint32)mysql_affected_rows(&mysql), rowCount, (uint32)mysql_field_count(&mysql), (uint32)mysql_insert_id(&mysql)); MySQLRequestResult requestResult(
res,
(uint32) mysql_affected_rows(&mysql),
rowCount,
(uint32) mysql_field_count(&mysql),
(uint32) mysql_insert_id(&mysql));
if (LogSys.log_settings[Logs::MySQLQuery].is_category_enabled == 1) if (LogSys.log_settings[Logs::MySQLQuery].is_category_enabled == 1) {
{
if ((strncasecmp(query, "select", 6) == 0)) { if ((strncasecmp(query, "select", 6) == 0)) {
Log(Logs::General, Logs::MySQLQuery, "%s (%u row%s returned)", query, requestResult.RowCount(), requestResult.RowCount() == 1 ? "" : "s"); Log(Logs::General,
Logs::MySQLQuery,
"%s (%u row%s returned)",
query,
requestResult.RowCount(),
requestResult.RowCount() == 1 ? "" : "s");
} }
else { else {
Log(Logs::General, Logs::MySQLQuery, "%s (%u row%s affected)", query, requestResult.RowsAffected(), requestResult.RowsAffected() == 1 ? "" : "s"); Log(Logs::General,
Logs::MySQLQuery,
"%s (%u row%s affected)",
query,
requestResult.RowsAffected(),
requestResult.RowsAffected() == 1 ? "" : "s");
} }
} }
return requestResult; return requestResult;
} }
void DBcore::TransactionBegin() { void DBcore::TransactionBegin()
{
QueryDatabase("START TRANSACTION"); QueryDatabase("START TRANSACTION");
} }
void DBcore::TransactionCommit() { void DBcore::TransactionCommit()
{
QueryDatabase("COMMIT"); QueryDatabase("COMMIT");
} }
void DBcore::TransactionRollback() { void DBcore::TransactionRollback()
{
QueryDatabase("ROLLBACK"); QueryDatabase("ROLLBACK");
} }
uint32 DBcore::DoEscapeString(char* tobuf, const char* frombuf, uint32 fromlen) { uint32 DBcore::DoEscapeString(char *tobuf, const char *frombuf, uint32 fromlen)
{
// No good reason to lock the DB, we only need it in the first place to check char encoding. // No good reason to lock the DB, we only need it in the first place to check char encoding.
// LockMutex lock(&MDatabase); // LockMutex lock(&MDatabase);
return mysql_real_escape_string(&mysql, tobuf, frombuf, fromlen); return mysql_real_escape_string(&mysql, tobuf, frombuf, fromlen);
} }
bool DBcore::Open(const char* iHost, const char* iUser, const char* iPassword, const char* iDatabase,uint32 iPort, uint32* errnum, char* errbuf, bool iCompress, bool iSSL) { bool DBcore::Open(
const char *iHost,
const char *iUser,
const char *iPassword,
const char *iDatabase,
uint32 iPort,
uint32 *errnum,
char *errbuf,
bool iCompress,
bool iSSL
)
{
LockMutex lock(&MDatabase); LockMutex lock(&MDatabase);
safe_delete(pHost); safe_delete(pHost);
safe_delete(pUser); safe_delete(pUser);
safe_delete(pPassword); safe_delete(pPassword);
safe_delete(pDatabase); safe_delete(pDatabase);
pHost = strcpy(new char[strlen(iHost) + 1], iHost); pHost = strcpy(new char[strlen(iHost) + 1], iHost);
pUser = strcpy(new char[strlen(iUser) + 1], iUser); pUser = strcpy(new char[strlen(iUser) + 1], iUser);
pPassword = strcpy(new char[strlen(iPassword) + 1], iPassword); pPassword = strcpy(new char[strlen(iPassword) + 1], iPassword);
pDatabase = strcpy(new char[strlen(iDatabase) + 1], iDatabase); pDatabase = strcpy(new char[strlen(iDatabase) + 1], iDatabase);
pCompress = iCompress; pCompress = iCompress;
pPort = iPort; pPort = iPort;
pSSL = iSSL; pSSL = iSSL;
return Open(errnum, errbuf); return Open(errnum, errbuf);
} }
bool DBcore::Open(uint32* errnum, char* errbuf) { bool DBcore::Open(uint32 *errnum, char *errbuf)
if (errbuf) {
if (errbuf) {
errbuf[0] = 0; errbuf[0] = 0;
}
LockMutex lock(&MDatabase); LockMutex lock(&MDatabase);
if (GetStatus() == Connected) if (GetStatus() == Connected) {
return true; return true;
}
if (GetStatus() == Error) { if (GetStatus() == Error) {
mysql_close(&mysql); mysql_close(&mysql);
mysql_init(&mysql); // Initialize structure again mysql_init(&mysql); // Initialize structure again
} }
if (!pHost) if (!pHost) {
return false; return false;
}
/* /*
Added CLIENT_FOUND_ROWS flag to the connect Added CLIENT_FOUND_ROWS flag to the connect
otherwise DB update calls would say 0 rows affected when the value already equalled otherwise DB update calls would say 0 rows affected when the value already equalled
what the function was tring to set it to, therefore the function would think it failed what the function was tring to set it to, therefore the function would think it failed
*/ */
uint32 flags = CLIENT_FOUND_ROWS; uint32 flags = CLIENT_FOUND_ROWS;
if (pCompress) if (pCompress) {
flags |= CLIENT_COMPRESS; flags |= CLIENT_COMPRESS;
if (pSSL) }
if (pSSL) {
flags |= CLIENT_SSL; flags |= CLIENT_SSL;
}
if (mysql_real_connect(&mysql, pHost, pUser, pPassword, pDatabase, pPort, 0, flags)) { if (mysql_real_connect(&mysql, pHost, pUser, pPassword, pDatabase, pPort, 0, flags)) {
pStatus = Connected; pStatus = Connected;
return true; return true;
} }
else { else {
if (errnum) if (errnum) {
*errnum = mysql_errno(&mysql); *errnum = mysql_errno(&mysql);
if (errbuf) }
if (errbuf) {
snprintf(errbuf, MYSQL_ERRMSG_SIZE, "#%i: %s", mysql_errno(&mysql), mysql_error(&mysql)); snprintf(errbuf, MYSQL_ERRMSG_SIZE, "#%i: %s", mysql_errno(&mysql), mysql_error(&mysql));
}
pStatus = Error; pStatus = Error;
return false; return false;
} }

View File

@ -95,8 +95,8 @@ enum GameChatColor {
*/ */
EQEmuLogSys::EQEmuLogSys() EQEmuLogSys::EQEmuLogSys()
{ {
on_log_gmsay_hook = [](uint16 log_type, const std::string &) {}; on_log_gmsay_hook = [](uint16 log_type, const std::string &) {};
on_log_console_hook = [](uint16 debug_level, uint16 log_type, const std::string &) {}; on_log_console_hook = [](uint16 debug_level, uint16 log_type, const std::string &) {};
} }
/** /**
@ -177,7 +177,10 @@ void EQEmuLogSys::LoadLogSettingsDefaults()
* @param in_message * @param in_message
* @return * @return
*/ */
std::string EQEmuLogSys::FormatOutMessageString(uint16 log_category, const std::string &in_message) std::string EQEmuLogSys::FormatOutMessageString(
uint16 log_category,
const std::string &in_message
)
{ {
std::string ret; std::string ret;
ret.push_back('['); ret.push_back('[');
@ -193,7 +196,11 @@ std::string EQEmuLogSys::FormatOutMessageString(uint16 log_category, const std::
* @param log_category * @param log_category
* @param message * @param message
*/ */
void EQEmuLogSys::ProcessGMSay(uint16 debug_level, uint16 log_category, const std::string &message) void EQEmuLogSys::ProcessGMSay(
uint16 debug_level,
uint16 log_category,
const std::string &message
)
{ {
/** /**
* Enabling Netcode based GMSay output creates a feedback loop that ultimately ends in a crash * Enabling Netcode based GMSay output creates a feedback loop that ultimately ends in a crash
@ -215,7 +222,11 @@ void EQEmuLogSys::ProcessGMSay(uint16 debug_level, uint16 log_category, const st
* @param log_category * @param log_category
* @param message * @param message
*/ */
void EQEmuLogSys::ProcessLogWrite(uint16 debug_level, uint16 log_category, const std::string &message) void EQEmuLogSys::ProcessLogWrite(
uint16 debug_level,
uint16 log_category,
const std::string &message
)
{ {
if (log_category == Logs::Crash) { if (log_category == Logs::Crash) {
char time_stamp[80]; char time_stamp[80];
@ -348,20 +359,37 @@ void EQEmuLogSys::ProcessConsoleMessage(uint16 debug_level, uint16 log_category,
on_log_console_hook(debug_level, log_category, message); on_log_console_hook(debug_level, log_category, message);
} }
/**
* @param str
* @return
*/
constexpr const char *str_end(const char *str) constexpr const char *str_end(const char *str)
{ {
return *str ? str_end(str + 1) : str; return *str ? str_end(str + 1) : str;
} }
/**
* @param str
* @return
*/
constexpr bool str_slant(const char *str) constexpr bool str_slant(const char *str)
{ {
return *str == '/' ? true : (*str ? str_slant(str + 1) : false); return *str == '/' ? true : (*str ? str_slant(str + 1) : false);
} }
/**
* @param str
* @return
*/
constexpr const char *r_slant(const char *str) constexpr const char *r_slant(const char *str)
{ {
return *str == '/' ? (str + 1) : r_slant(str - 1); return *str == '/' ? (str + 1) : r_slant(str - 1);
} }
/**
* @param str
* @return
*/
constexpr const char *file_name(const char *str) constexpr const char *file_name(const char *str)
{ {
return str_slant(str) ? r_slant(str_end(str)) : str; return str_slant(str) ? r_slant(str_end(str)) : str;
@ -452,7 +480,7 @@ void EQEmuLogSys::MakeDirectory(const std::string &directory_name)
return; return;
_mkdir(directory_name.c_str()); _mkdir(directory_name.c_str());
#else #else
struct stat st; struct stat st{};
if (stat(directory_name.c_str(), &st) == 0) { // exists if (stat(directory_name.c_str(), &st) == 0) { // exists
return; return;
} }

View File

@ -193,6 +193,10 @@ public:
*/ */
void CloseFileLogs(); void CloseFileLogs();
void LoadLogSettingsDefaults(); void LoadLogSettingsDefaults();
/**
* @param directory_name
*/
void MakeDirectory(const std::string &directory_name); void MakeDirectory(const std::string &directory_name);
/** /**
@ -216,8 +220,13 @@ public:
/** /**
* Used in file logs to prepend a timestamp entry for logs * Used in file logs to prepend a timestamp entry for logs
* @param time_stamp
*/ */
void SetCurrentTimeStamp(char* time_stamp); void SetCurrentTimeStamp(char* time_stamp);
/**
* @param log_name
*/
void StartFileLogs(const std::string &log_name = ""); void StartFileLogs(const std::string &log_name = "");
/** /**
@ -264,7 +273,14 @@ public:
*/ */
uint16 GetGMSayColorFromCategory(uint16 log_category); uint16 GetGMSayColorFromCategory(uint16 log_category);
/**
* @param f
*/
void SetGMSayHandler(std::function<void(uint16 log_type, const std::string&)> f) { on_log_gmsay_hook = f; } void SetGMSayHandler(std::function<void(uint16 log_type, const std::string&)> f) { on_log_gmsay_hook = f; }
/**
* @param f
*/
void SetConsoleHandler(std::function<void(uint16 debug_level, uint16 log_type, const std::string&)> f) { on_log_console_hook = f; } void SetConsoleHandler(std::function<void(uint16 debug_level, uint16 log_type, const std::string&)> f) { on_log_console_hook = f; }
private: private:
@ -282,6 +298,7 @@ private:
/** /**
* Linux console color messages mapped by category * Linux console color messages mapped by category
*
* @param log_category * @param log_category
* @return * @return
*/ */
@ -292,11 +309,44 @@ private:
*/ */
uint16 GetWindowsConsoleColorFromCategory(uint16 log_category); uint16 GetWindowsConsoleColorFromCategory(uint16 log_category);
/**
* @param debug_level
* @param log_category
* @param message
*/
void ProcessConsoleMessage(uint16 debug_level, uint16 log_category, const std::string &message); void ProcessConsoleMessage(uint16 debug_level, uint16 log_category, const std::string &message);
/**
* @param debug_level
* @param log_category
* @param message
*/
void ProcessGMSay(uint16 debug_level, uint16 log_category, const std::string &message); void ProcessGMSay(uint16 debug_level, uint16 log_category, const std::string &message);
/**
* @param debug_level
* @param log_category
* @param message
*/
void ProcessLogWrite(uint16 debug_level, uint16 log_category, const std::string &message); void ProcessLogWrite(uint16 debug_level, uint16 log_category, const std::string &message);
}; };
extern EQEmuLogSys LogSys; extern EQEmuLogSys LogSys;
template<typename... Args>
void OutF(
EQEmuLogSys &ls,
Logs::DebugLevel debug_level,
uint16 log_category,
const char *file,
const char *func,
int line,
const char *fmt,
const Args &... args
)
{
std::string log_str = fmt::format(fmt, args...);
ls.Out(debug_level, log_category, file, func, line, log_str);
}
#endif #endif

View File

@ -1,6 +1,5 @@
#include "eqstream.h" #include "eqstream.h"
#include "../eqemu_logsys.h" #include "../eqemu_logsys.h"
#include "../eqemu_logsys_fmt.h"
EQ::Net::EQStreamManager::EQStreamManager(const EQStreamManagerInterfaceOptions &options) : EQStreamManagerInterface(options), m_daybreak(options.daybreak_options) EQ::Net::EQStreamManager::EQStreamManager(const EQStreamManagerInterfaceOptions &options) : EQStreamManagerInterface(options), m_daybreak(options.daybreak_options)
{ {

View File

@ -1,7 +1,6 @@
#include "servertalk_client_connection.h" #include "servertalk_client_connection.h"
#include "dns.h" #include "dns.h"
#include "../eqemu_logsys.h" #include "../eqemu_logsys.h"
#include "../eqemu_logsys_fmt.h"
EQ::Net::ServertalkClient::ServertalkClient(const std::string &addr, int port, bool ipv6, const std::string &identifier, const std::string &credentials) EQ::Net::ServertalkClient::ServertalkClient(const std::string &addr, int port, bool ipv6, const std::string &identifier, const std::string &credentials)
: m_timer(std::unique_ptr<EQ::Timer>(new EQ::Timer(100, true, std::bind(&EQ::Net::ServertalkClient::Connect, this)))) : m_timer(std::unique_ptr<EQ::Timer>(new EQ::Timer(100, true, std::bind(&EQ::Net::ServertalkClient::Connect, this))))

View File

@ -1,7 +1,6 @@
#include "servertalk_legacy_client_connection.h" #include "servertalk_legacy_client_connection.h"
#include "dns.h" #include "dns.h"
#include "../eqemu_logsys.h" #include "../eqemu_logsys.h"
#include "../eqemu_logsys_fmt.h"
EQ::Net::ServertalkLegacyClient::ServertalkLegacyClient(const std::string &addr, int port, bool ipv6) EQ::Net::ServertalkLegacyClient::ServertalkLegacyClient(const std::string &addr, int port, bool ipv6)
: m_timer(std::unique_ptr<EQ::Timer>(new EQ::Timer(100, true, std::bind(&EQ::Net::ServertalkLegacyClient::Connect, this)))) : m_timer(std::unique_ptr<EQ::Timer>(new EQ::Timer(100, true, std::bind(&EQ::Net::ServertalkLegacyClient::Connect, this))))

View File

@ -1,7 +1,6 @@
#include "servertalk_server_connection.h" #include "servertalk_server_connection.h"
#include "servertalk_server.h" #include "servertalk_server.h"
#include "../eqemu_logsys.h" #include "../eqemu_logsys.h"
#include "../eqemu_logsys_fmt.h"
#include "../util/uuid.h" #include "../util/uuid.h"
EQ::Net::ServertalkServerConnection::ServertalkServerConnection(std::shared_ptr<EQ::Net::TCPConnection> c, EQ::Net::ServertalkServer *parent, bool encrypted, bool allow_downgrade) EQ::Net::ServertalkServerConnection::ServertalkServerConnection(std::shared_ptr<EQ::Net::TCPConnection> c, EQ::Net::ServertalkServer *parent, bool encrypted, bool allow_downgrade)

View File

@ -24,7 +24,6 @@
#include "../common/eqemu_logsys.h" #include "../common/eqemu_logsys.h"
#include "../common/string_util.h" #include "../common/string_util.h"
#include "encryption.h" #include "encryption.h"
#include "../common/eqemu_logsys_fmt.h"
extern LoginServer server; extern LoginServer server;
@ -140,10 +139,10 @@ void Client::Handle_SessionReady(const char *data, unsigned int size)
status = cs_waiting_for_login; status = cs_waiting_for_login;
/** /**
* The packets are mostly the same but slightly different between the two versions. * The packets are mostly the same but slightly different between the two versions
*/ */
if (version == cv_sod) { if (version == cv_sod) {
EQApplicationPacket *outapp = new EQApplicationPacket(OP_ChatMessage, 17); auto *outapp = new EQApplicationPacket(OP_ChatMessage, 17);
outapp->pBuffer[0] = 0x02; outapp->pBuffer[0] = 0x02;
outapp->pBuffer[10] = 0x01; outapp->pBuffer[10] = 0x01;
outapp->pBuffer[11] = 0x65; outapp->pBuffer[11] = 0x65;
@ -156,8 +155,8 @@ void Client::Handle_SessionReady(const char *data, unsigned int size)
delete outapp; delete outapp;
} }
else { else {
const char *msg = "ChatMessage"; const char *msg = "ChatMessage";
EQApplicationPacket *outapp = new EQApplicationPacket(OP_ChatMessage, 16 + strlen(msg)); auto *outapp = new EQApplicationPacket(OP_ChatMessage, 16 + strlen(msg));
outapp->pBuffer[0] = 0x02; outapp->pBuffer[0] = 0x02;
outapp->pBuffer[10] = 0x01; outapp->pBuffer[10] = 0x01;
outapp->pBuffer[11] = 0x65; outapp->pBuffer[11] = 0x65;
@ -275,8 +274,8 @@ void Client::Handle_Login(const char *data, unsigned int size)
* Login accepted * Login accepted
*/ */
if (result) { if (result) {
LogF( LogLoginserverDetail(
Logs::Detail, Logs::Login_Server, "login [{0}] user [{1}] Login succeeded", "login [{0}] user [{1}] Login succeeded",
db_loginserver, db_loginserver,
user user
); );
@ -284,8 +283,8 @@ void Client::Handle_Login(const char *data, unsigned int size)
DoSuccessfulLogin(user, db_account_id, db_loginserver); DoSuccessfulLogin(user, db_account_id, db_loginserver);
} }
else { else {
LogF( LogLoginserverDetail(
Logs::Detail, Logs::Login_Server, "login [{0}] user [{1}] Login failed", "login [{0}] user [{1}] Login failed",
db_loginserver, db_loginserver,
user user
); );
@ -572,7 +571,7 @@ void Client::DoSuccessfulLogin(const std::string &user, int db_account_id, const
account_name = user; account_name = user;
loginserver_name = db_loginserver; loginserver_name = db_loginserver;
auto *outapp = new EQApplicationPacket(OP_LoginAccepted, 10 + 80); auto *outapp = new EQApplicationPacket(OP_LoginAccepted, 10 + 80);
auto *login_accepted = (LoginAccepted_Struct *) outapp->pBuffer; auto *login_accepted = (LoginAccepted_Struct *) outapp->pBuffer;
login_accepted->unknown1 = llrs.unknown1; login_accepted->unknown1 = llrs.unknown1;
login_accepted->unknown2 = llrs.unknown2; login_accepted->unknown2 = llrs.unknown2;
@ -763,6 +762,7 @@ void Client::LoginSendLogin()
void Client::LoginProcessLoginResponse(const EQ::Net::Packet &p) void Client::LoginProcessLoginResponse(const EQ::Net::Packet &p)
{ {
auto encrypt_size = p.Length() - 12; auto encrypt_size = p.Length() - 12;
if (encrypt_size % 8 > 0) { if (encrypt_size % 8 > 0) {
encrypt_size = (encrypt_size / 8) * 8; encrypt_size = (encrypt_size / 8) * 8;
} }

View File

@ -25,7 +25,6 @@ extern LoginServer server;
extern bool run_server; extern bool run_server;
#include "../common/eqemu_logsys.h" #include "../common/eqemu_logsys.h"
#include "../common/eqemu_logsys_fmt.h"
ClientManager::ClientManager() ClientManager::ClientManager()
{ {
@ -135,7 +134,7 @@ void ClientManager::ProcessDisconnect()
while (iter != clients.end()) { while (iter != clients.end()) {
std::shared_ptr<EQStreamInterface> c = (*iter)->GetConnection(); std::shared_ptr<EQStreamInterface> c = (*iter)->GetConnection();
if (c->CheckState(CLOSED)) { if (c->CheckState(CLOSED)) {
Log(Logs::General, Logs::Login_Server, "Client disconnected from the server, removing client."); LogLoginserver("Client disconnected from the server, removing client.");
delete (*iter); delete (*iter);
iter = clients.erase(iter); iter = clients.erase(iter);
} }

View File

@ -20,7 +20,6 @@
#include "../common/global_define.h" #include "../common/global_define.h"
#include "../common/eqemu_logsys.h" #include "../common/eqemu_logsys.h"
#include "../common/eqemu_logsys_fmt.h"
#include "config.h" #include "config.h"
/** /**

View File

@ -23,7 +23,6 @@
#include "database.h" #include "database.h"
#include "login_server.h" #include "login_server.h"
#include "../common/eqemu_logsys.h" #include "../common/eqemu_logsys.h"
#include "../common/eqemu_logsys_fmt.h"
#include "../common/string_util.h" #include "../common/string_util.h"
extern LoginServer server; extern LoginServer server;

View File

@ -26,7 +26,6 @@
#include "../common/platform.h" #include "../common/platform.h"
#include "../common/crash.h" #include "../common/crash.h"
#include "../common/eqemu_logsys.h" #include "../common/eqemu_logsys.h"
#include "../common/eqemu_logsys_fmt.h"
#include "login_server.h" #include "login_server.h"
#include <time.h> #include <time.h>
#include <stdlib.h> #include <stdlib.h>

View File

@ -24,7 +24,6 @@
#include <stdlib.h> #include <stdlib.h>
#include "../common/eqemu_logsys.h" #include "../common/eqemu_logsys.h"
#include "../common/eqemu_logsys_fmt.h"
#include "../common/ip_util.h" #include "../common/ip_util.h"
extern LoginServer server; extern LoginServer server;

View File

@ -23,7 +23,6 @@
#include "login_structures.h" #include "login_structures.h"
#include "config.h" #include "config.h"
#include "../common/eqemu_logsys.h" #include "../common/eqemu_logsys.h"
#include "../common/eqemu_logsys_fmt.h"
#include "../common/ip_util.h" #include "../common/ip_util.h"
extern LoginServer server; extern LoginServer server;

View File

@ -20,7 +20,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "../common/global_define.h" #include "../common/global_define.h"
#include "../common/string_util.h" #include "../common/string_util.h"
#include "../common/eqemu_logsys.h" #include "../common/eqemu_logsys.h"
#include "../common/eqemu_logsys_fmt.h"
#include "../common/misc_functions.h" #include "../common/misc_functions.h"
#include "ucsconfig.h" #include "ucsconfig.h"

View File

@ -28,7 +28,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "../common/packet_dump.h" #include "../common/packet_dump.h"
#include "../common/string_util.h" #include "../common/string_util.h"
#include "../common/eqemu_logsys.h" #include "../common/eqemu_logsys.h"
#include "../common/eqemu_logsys_fmt.h"
#include "login_server.h" #include "login_server.h"
#include "login_server_list.h" #include "login_server_list.h"
#include "zoneserver.h" #include "zoneserver.h"

View File

@ -25,7 +25,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "../common/string_util.h" #include "../common/string_util.h"
#include "../common/eqemu_logsys.h" #include "../common/eqemu_logsys.h"
#include "../common/eqemu_logsys_fmt.h"
#include "../common/queue.h" #include "../common/queue.h"
#include "../common/timer.h" #include "../common/timer.h"
#include "../common/eq_packet.h" #include "../common/eq_packet.h"

View File

@ -42,7 +42,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "../common/eqemu_exception.h" #include "../common/eqemu_exception.h"
#include "../common/spdat.h" #include "../common/spdat.h"
#include "../common/eqemu_logsys.h" #include "../common/eqemu_logsys.h"
#include "../common/eqemu_logsys_fmt.h"
#include "api_service.h" #include "api_service.h"
#include "zone_config.h" #include "zone_config.h"

View File

@ -25,7 +25,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "../common/string_util.h" #include "../common/string_util.h"
#include "../common/misc_functions.h" #include "../common/misc_functions.h"
#include "../common/eqemu_logsys.h" #include "../common/eqemu_logsys.h"
#include "../common/eqemu_logsys_fmt.h"
#include "map.h" #include "map.h"
#include "npc.h" #include "npc.h"