Some of these really slow down profiling without adding much (short functions)

This commit is contained in:
KimLS 2015-02-13 00:38:28 -08:00
parent 8e45fd2253
commit b26d9c07f1
10 changed files with 0 additions and 120 deletions

View File

@ -23,7 +23,6 @@
BasePacket::BasePacket(const unsigned char *buf, uint32 len) BasePacket::BasePacket(const unsigned char *buf, uint32 len)
{ {
_eqp
this->pBuffer=nullptr; this->pBuffer=nullptr;
this->size=0; this->size=0;
this->_wpos = 0; this->_wpos = 0;
@ -42,7 +41,6 @@ BasePacket::BasePacket(const unsigned char *buf, uint32 len)
BasePacket::~BasePacket() BasePacket::~BasePacket()
{ {
_eqp
if (pBuffer) if (pBuffer)
delete[] pBuffer; delete[] pBuffer;
pBuffer=nullptr; pBuffer=nullptr;
@ -51,7 +49,6 @@ BasePacket::~BasePacket()
void BasePacket::build_raw_header_dump(char *buffer, uint16 seq) const void BasePacket::build_raw_header_dump(char *buffer, uint16 seq) const
{ {
_eqp
if (timestamp.tv_sec) { if (timestamp.tv_sec) {
char temp[20]; char temp[20];
strftime(temp,20,"%F %T",localtime((const time_t *)&timestamp.tv_sec)); strftime(temp,20,"%F %T",localtime((const time_t *)&timestamp.tv_sec));
@ -69,7 +66,6 @@ void BasePacket::build_raw_header_dump(char *buffer, uint16 seq) const
void BasePacket::DumpRawHeader(uint16 seq, FILE *to) const void BasePacket::DumpRawHeader(uint16 seq, FILE *to) const
{ {
_eqp
char buff[128]; char buff[128];
build_raw_header_dump(buff, seq); build_raw_header_dump(buff, seq);
fprintf(to, "%s", buff); fprintf(to, "%s", buff);
@ -77,13 +73,11 @@ void BasePacket::DumpRawHeader(uint16 seq, FILE *to) const
void BasePacket::build_header_dump(char *buffer) const void BasePacket::build_header_dump(char *buffer) const
{ {
_eqp
sprintf(buffer, "[packet]\n"); sprintf(buffer, "[packet]\n");
} }
void BasePacket::DumpRawHeaderNoTime(uint16 seq, FILE *to) const void BasePacket::DumpRawHeaderNoTime(uint16 seq, FILE *to) const
{ {
_eqp
if (src_ip) { if (src_ip) {
std::string sIP,dIP;; std::string sIP,dIP;;
sIP=long2ip(src_ip); sIP=long2ip(src_ip);
@ -96,7 +90,6 @@ void BasePacket::DumpRawHeaderNoTime(uint16 seq, FILE *to) const
void BasePacket::DumpRaw(FILE *to) const void BasePacket::DumpRaw(FILE *to) const
{ {
_eqp
DumpRawHeader(); DumpRawHeader();
if (pBuffer && size) if (pBuffer && size)
dump_message_column(pBuffer, size, " ", to); dump_message_column(pBuffer, size, " ", to);
@ -105,7 +98,6 @@ void BasePacket::DumpRaw(FILE *to) const
void BasePacket::ReadString(char *str, uint32 Offset, uint32 MaxLength) const void BasePacket::ReadString(char *str, uint32 Offset, uint32 MaxLength) const
{ {
_eqp
uint32 i = 0, j = Offset; uint32 i = 0, j = Offset;
do do
@ -119,18 +111,15 @@ void BasePacket::ReadString(char *str, uint32 Offset, uint32 MaxLength) const
void DumpPacketHex(const BasePacket* app) void DumpPacketHex(const BasePacket* app)
{ {
_eqp
DumpPacketHex(app->pBuffer, app->size); DumpPacketHex(app->pBuffer, app->size);
} }
void DumpPacketAscii(const BasePacket* app) void DumpPacketAscii(const BasePacket* app)
{ {
_eqp
DumpPacketAscii(app->pBuffer, app->size); DumpPacketAscii(app->pBuffer, app->size);
} }
void DumpPacketBin(const BasePacket* app) { void DumpPacketBin(const BasePacket* app) {
_eqp
DumpPacketBin(app->pBuffer, app->size); DumpPacketBin(app->pBuffer, app->size);
} }

View File

@ -30,7 +30,6 @@
#endif #endif
DBcore::DBcore() { DBcore::DBcore() {
_eqp
mysql_init(&mysql); mysql_init(&mysql);
pHost = 0; pHost = 0;
pUser = 0; pUser = 0;
@ -42,7 +41,6 @@ DBcore::DBcore() {
} }
DBcore::~DBcore() { DBcore::~DBcore() {
_eqp
mysql_close(&mysql); mysql_close(&mysql);
safe_delete_array(pHost); safe_delete_array(pHost);
safe_delete_array(pUser); safe_delete_array(pUser);
@ -52,7 +50,6 @@ DBcore::~DBcore() {
// Sends the MySQL server a keepalive // Sends the MySQL server a keepalive
void DBcore::ping() { void DBcore::ping() {
_eqp
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,13 +60,11 @@ void DBcore::ping() {
MySQLRequestResult DBcore::QueryDatabase(std::string query, bool retryOnFailureOnce) MySQLRequestResult DBcore::QueryDatabase(std::string query, bool retryOnFailureOnce)
{ {
_eqp
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)
{ {
_eqp
LockMutex lock(&MDatabase); LockMutex lock(&MDatabase);
// Reconnect if we are not connected before hand. // Reconnect if we are not connected before hand.
@ -139,29 +134,24 @@ MySQLRequestResult DBcore::QueryDatabase(const char* query, uint32 querylen, boo
} }
void DBcore::TransactionBegin() { void DBcore::TransactionBegin() {
_eqp
QueryDatabase("START TRANSACTION"); QueryDatabase("START TRANSACTION");
} }
void DBcore::TransactionCommit() { void DBcore::TransactionCommit() {
_eqp
QueryDatabase("COMMIT"); QueryDatabase("COMMIT");
} }
void DBcore::TransactionRollback() { void DBcore::TransactionRollback() {
_eqp
QueryDatabase("ROLLBACK"); QueryDatabase("ROLLBACK");
} }
uint32 DBcore::DoEscapeString(char* tobuf, const char* frombuf, uint32 fromlen) { uint32 DBcore::DoEscapeString(char* tobuf, const char* frombuf, uint32 fromlen) {
_eqp
// 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) {
_eqp
LockMutex lock(&MDatabase); LockMutex lock(&MDatabase);
safe_delete(pHost); safe_delete(pHost);
safe_delete(pUser); safe_delete(pUser);
@ -178,7 +168,6 @@ bool DBcore::Open(const char* iHost, const char* iUser, const char* iPassword, c
} }
bool DBcore::Open(uint32* errnum, char* errbuf) { bool DBcore::Open(uint32* errnum, char* errbuf) {
_eqp
if (errbuf) if (errbuf)
errbuf[0] = 0; errbuf[0] = 0;
LockMutex lock(&MDatabase); LockMutex lock(&MDatabase);

View File

@ -5,7 +5,6 @@
EQStreamIdentifier::~EQStreamIdentifier() { EQStreamIdentifier::~EQStreamIdentifier() {
_eqp
while(!m_identified.empty()) { while(!m_identified.empty()) {
m_identified.front()->ReleaseFromUse(); m_identified.front()->ReleaseFromUse();
m_identified.pop(); m_identified.pop();
@ -26,7 +25,6 @@ EQStreamIdentifier::~EQStreamIdentifier() {
} }
void EQStreamIdentifier::RegisterPatch(const EQStream::Signature &sig, const char *name, OpcodeManager ** opcodes, const StructStrategy *structs) { void EQStreamIdentifier::RegisterPatch(const EQStream::Signature &sig, const char *name, OpcodeManager ** opcodes, const StructStrategy *structs) {
_eqp
Patch *p = new Patch; Patch *p = new Patch;
p->signature = sig; p->signature = sig;
p->name = name; p->name = name;
@ -36,7 +34,6 @@ void EQStreamIdentifier::RegisterPatch(const EQStream::Signature &sig, const cha
} }
void EQStreamIdentifier::Process() { void EQStreamIdentifier::Process() {
_eqp
std::vector<Record>::iterator cur; std::vector<Record>::iterator cur;
std::vector<Patch *>::iterator curp, endp; std::vector<Patch *>::iterator curp, endp;
@ -146,13 +143,11 @@ void EQStreamIdentifier::Process() {
} }
void EQStreamIdentifier::AddStream(std::shared_ptr<EQStream> &eqs) { void EQStreamIdentifier::AddStream(std::shared_ptr<EQStream> &eqs) {
_eqp
m_streams.push_back(Record(eqs)); m_streams.push_back(Record(eqs));
eqs = nullptr; eqs = nullptr;
} }
EQStreamInterface *EQStreamIdentifier::PopIdentified() { EQStreamInterface *EQStreamIdentifier::PopIdentified() {
_eqp
if(m_identified.empty()) if(m_identified.empty())
return(nullptr); return(nullptr);
EQStreamInterface *res = m_identified.front(); EQStreamInterface *res = m_identified.front();
@ -164,6 +159,5 @@ EQStreamIdentifier::Record::Record(std::shared_ptr<EQStream> s)
: stream(s), : stream(s),
expire(STREAM_IDENT_WAIT_MS) expire(STREAM_IDENT_WAIT_MS)
{ {
_eqp
} }

View File

@ -10,28 +10,23 @@ EQStreamProxy::EQStreamProxy(std::shared_ptr<EQStream> &stream, const StructStra
m_structs(structs), m_structs(structs),
m_opcodes(opcodes) m_opcodes(opcodes)
{ {
_eqp
stream = nullptr; //take the stream. stream = nullptr; //take the stream.
m_stream->SetOpcodeManager(m_opcodes); m_stream->SetOpcodeManager(m_opcodes);
} }
EQStreamProxy::~EQStreamProxy() { EQStreamProxy::~EQStreamProxy() {
_eqp
} }
std::string EQStreamProxy::Describe() const { std::string EQStreamProxy::Describe() const {
_eqp
return(m_structs->Describe()); return(m_structs->Describe());
} }
const ClientVersion EQStreamProxy::GetClientVersion() const const ClientVersion EQStreamProxy::GetClientVersion() const
{ {
_eqp
return m_structs->GetClientVersion(); return m_structs->GetClientVersion();
} }
void EQStreamProxy::QueuePacket(const EQApplicationPacket *p, bool ack_req) { void EQStreamProxy::QueuePacket(const EQApplicationPacket *p, bool ack_req) {
_eqp
if(p == nullptr) if(p == nullptr)
return; return;
@ -40,14 +35,12 @@ void EQStreamProxy::QueuePacket(const EQApplicationPacket *p, bool ack_req) {
} }
void EQStreamProxy::FastQueuePacket(EQApplicationPacket **p, bool ack_req) { void EQStreamProxy::FastQueuePacket(EQApplicationPacket **p, bool ack_req) {
_eqp
if(p == nullptr || *p == nullptr) if(p == nullptr || *p == nullptr)
return; return;
m_structs->Encode(p, m_stream, ack_req); m_structs->Encode(p, m_stream, ack_req);
} }
EQApplicationPacket *EQStreamProxy::PopPacket() { EQApplicationPacket *EQStreamProxy::PopPacket() {
_eqp
EQApplicationPacket *pack = m_stream->PopPacket(); EQApplicationPacket *pack = m_stream->PopPacket();
if(pack == nullptr) if(pack == nullptr)
return(nullptr); return(nullptr);
@ -58,56 +51,46 @@ EQApplicationPacket *EQStreamProxy::PopPacket() {
} }
void EQStreamProxy::Close() { void EQStreamProxy::Close() {
_eqp
m_stream->Close(); m_stream->Close();
} }
uint32 EQStreamProxy::GetRemoteIP() const { uint32 EQStreamProxy::GetRemoteIP() const {
_eqp
return(m_stream->GetRemoteIP()); return(m_stream->GetRemoteIP());
} }
uint16 EQStreamProxy::GetRemotePort() const { uint16 EQStreamProxy::GetRemotePort() const {
_eqp
return(m_stream->GetRemotePort()); return(m_stream->GetRemotePort());
} }
const uint32 EQStreamProxy::GetBytesSent() const const uint32 EQStreamProxy::GetBytesSent() const
{ {
_eqp
return(m_stream->GetBytesSent()); return(m_stream->GetBytesSent());
} }
const uint32 EQStreamProxy::GetBytesRecieved() const const uint32 EQStreamProxy::GetBytesRecieved() const
{ {
_eqp
return(m_stream->GetBytesRecieved()); return(m_stream->GetBytesRecieved());
} }
const uint32 EQStreamProxy::GetBytesSentPerSecond() const const uint32 EQStreamProxy::GetBytesSentPerSecond() const
{ {
_eqp
return(m_stream->GetBytesSentPerSecond()); return(m_stream->GetBytesSentPerSecond());
} }
const uint32 EQStreamProxy::GetBytesRecvPerSecond() const const uint32 EQStreamProxy::GetBytesRecvPerSecond() const
{ {
_eqp
return(m_stream->GetBytesRecvPerSecond()); return(m_stream->GetBytesRecvPerSecond());
} }
void EQStreamProxy::ReleaseFromUse() { void EQStreamProxy::ReleaseFromUse() {
_eqp
m_stream->ReleaseFromUse(); m_stream->ReleaseFromUse();
} }
void EQStreamProxy::RemoveData() { void EQStreamProxy::RemoveData() {
_eqp
m_stream->RemoveData(); m_stream->RemoveData();
} }
bool EQStreamProxy::CheckState(EQStreamState state) { bool EQStreamProxy::CheckState(EQStreamState state) {
_eqp
if(m_stream) if(m_stream)
return(m_stream->CheckState(state)); return(m_stream->CheckState(state));

View File

@ -10,7 +10,6 @@ MySQLRequestResult::MySQLRequestResult()
MySQLRequestResult::MySQLRequestResult(MYSQL_RES* result, uint32 rowsAffected, uint32 rowCount, uint32 columnCount, uint32 lastInsertedID, uint32 errorNumber, char *errorBuffer) MySQLRequestResult::MySQLRequestResult(MYSQL_RES* result, uint32 rowsAffected, uint32 rowCount, uint32 columnCount, uint32 lastInsertedID, uint32 errorNumber, char *errorBuffer)
: m_CurrentRow(result), m_OneBeyondRow() : m_CurrentRow(result), m_OneBeyondRow()
{ {
_eqp
m_Result = result; m_Result = result;
m_RowsAffected = rowsAffected; m_RowsAffected = rowsAffected;
m_RowCount = rowCount; m_RowCount = rowCount;
@ -33,7 +32,6 @@ MySQLRequestResult::MySQLRequestResult(MYSQL_RES* result, uint32 rowsAffected, u
void MySQLRequestResult::FreeInternals() void MySQLRequestResult::FreeInternals()
{ {
_eqp
safe_delete_array(m_ErrorBuffer); safe_delete_array(m_ErrorBuffer);
if (m_Result != nullptr) if (m_Result != nullptr)
@ -44,7 +42,6 @@ void MySQLRequestResult::FreeInternals()
void MySQLRequestResult::ZeroOut() void MySQLRequestResult::ZeroOut()
{ {
_eqp
m_Success = false; m_Success = false;
m_Result = nullptr; m_Result = nullptr;
m_ErrorBuffer = nullptr; m_ErrorBuffer = nullptr;
@ -57,13 +54,11 @@ void MySQLRequestResult::ZeroOut()
MySQLRequestResult::~MySQLRequestResult() MySQLRequestResult::~MySQLRequestResult()
{ {
_eqp
FreeInternals(); FreeInternals();
} }
uint32 MySQLRequestResult::LengthOfColumn(int columnIndex) uint32 MySQLRequestResult::LengthOfColumn(int columnIndex)
{ {
_eqp
if (m_ColumnLengths == nullptr && m_Result != nullptr) if (m_ColumnLengths == nullptr && m_Result != nullptr)
m_ColumnLengths = mysql_fetch_lengths(m_Result); m_ColumnLengths = mysql_fetch_lengths(m_Result);
@ -86,7 +81,6 @@ uint32 MySQLRequestResult::LengthOfColumn(int columnIndex)
const std::string MySQLRequestResult::FieldName(int columnIndex) const std::string MySQLRequestResult::FieldName(int columnIndex)
{ {
_eqp
if (columnIndex >= m_ColumnCount || m_Result == nullptr) if (columnIndex >= m_ColumnCount || m_Result == nullptr)
return std::string(); return std::string();
@ -99,7 +93,6 @@ const std::string MySQLRequestResult::FieldName(int columnIndex)
MySQLRequestResult::MySQLRequestResult(MySQLRequestResult&& moveItem) MySQLRequestResult::MySQLRequestResult(MySQLRequestResult&& moveItem)
: m_CurrentRow(moveItem.m_CurrentRow), m_OneBeyondRow() : m_CurrentRow(moveItem.m_CurrentRow), m_OneBeyondRow()
{ {
_eqp
m_Result = moveItem.m_Result; m_Result = moveItem.m_Result;
m_ErrorBuffer = moveItem.m_ErrorBuffer; m_ErrorBuffer = moveItem.m_ErrorBuffer;
m_Success = moveItem.m_Success; m_Success = moveItem.m_Success;
@ -117,7 +110,6 @@ MySQLRequestResult::MySQLRequestResult(MySQLRequestResult&& moveItem)
MySQLRequestResult& MySQLRequestResult::operator=(MySQLRequestResult&& other) MySQLRequestResult& MySQLRequestResult::operator=(MySQLRequestResult&& other)
{ {
_eqp
// Assigning something to itself? // Assigning something to itself?
// Silly! (but happens) // Silly! (but happens)
if (this == &other) if (this == &other)

View File

@ -12,7 +12,6 @@ MySQLRequestRow::MySQLRequestRow()
MySQLRequestRow::MySQLRequestRow(MySQLRequestRow&& moveItem) MySQLRequestRow::MySQLRequestRow(MySQLRequestRow&& moveItem)
{ {
_eqp
m_Result = moveItem.m_Result; m_Result = moveItem.m_Result;
m_MySQLRow = moveItem.m_MySQLRow; m_MySQLRow = moveItem.m_MySQLRow;
@ -22,7 +21,6 @@ MySQLRequestRow::MySQLRequestRow(MySQLRequestRow&& moveItem)
MySQLRequestRow& MySQLRequestRow::operator=(MySQLRequestRow& moveItem) MySQLRequestRow& MySQLRequestRow::operator=(MySQLRequestRow& moveItem)
{ {
_eqp
m_Result = moveItem.m_Result; m_Result = moveItem.m_Result;
m_MySQLRow = moveItem.m_MySQLRow; m_MySQLRow = moveItem.m_MySQLRow;
@ -35,14 +33,12 @@ MySQLRequestRow& MySQLRequestRow::operator=(MySQLRequestRow& moveItem)
MySQLRequestRow MySQLRequestRow::operator*() MySQLRequestRow MySQLRequestRow::operator*()
{ {
_eqp
return *this; return *this;
} }
MySQLRequestRow::MySQLRequestRow(MYSQL_RES *result) MySQLRequestRow::MySQLRequestRow(MYSQL_RES *result)
: m_Result(result) : m_Result(result)
{ {
_eqp
if (result != nullptr) if (result != nullptr)
m_MySQLRow = mysql_fetch_row(result); m_MySQLRow = mysql_fetch_row(result);
else else
@ -51,14 +47,12 @@ MySQLRequestRow::MySQLRequestRow(MYSQL_RES *result)
MySQLRequestRow& MySQLRequestRow::operator++() MySQLRequestRow& MySQLRequestRow::operator++()
{ {
_eqp
m_MySQLRow = mysql_fetch_row(m_Result); m_MySQLRow = mysql_fetch_row(m_Result);
return *this; return *this;
} }
MySQLRequestRow MySQLRequestRow::operator++(int) MySQLRequestRow MySQLRequestRow::operator++(int)
{ {
_eqp
MySQLRequestRow tmp(*this); MySQLRequestRow tmp(*this);
operator++(); operator++();
return tmp; return tmp;
@ -66,18 +60,15 @@ MySQLRequestRow MySQLRequestRow::operator++(int)
bool MySQLRequestRow::operator==(const MySQLRequestRow& rhs) bool MySQLRequestRow::operator==(const MySQLRequestRow& rhs)
{ {
_eqp
return m_MySQLRow == rhs.m_MySQLRow; return m_MySQLRow == rhs.m_MySQLRow;
} }
bool MySQLRequestRow::operator!=(const MySQLRequestRow& rhs) bool MySQLRequestRow::operator!=(const MySQLRequestRow& rhs)
{ {
_eqp
return m_MySQLRow != rhs.m_MySQLRow; return m_MySQLRow != rhs.m_MySQLRow;
} }
char* MySQLRequestRow::operator[](int index) char* MySQLRequestRow::operator[](int index)
{ {
_eqp
return m_MySQLRow[index]; return m_MySQLRow[index];
} }

View File

@ -25,7 +25,6 @@
#include "../common/servertalk.h" #include "../common/servertalk.h"
void DumpPacketAscii(const uchar* buf, uint32 size, uint32 cols, uint32 skip) { void DumpPacketAscii(const uchar* buf, uint32 size, uint32 cols, uint32 skip) {
_eqp
// Output as ASCII // Output as ASCII
for(uint32 i=skip; i<size; i++) for(uint32 i=skip; i<size; i++)
{ {
@ -50,7 +49,6 @@ void DumpPacketAscii(const uchar* buf, uint32 size, uint32 cols, uint32 skip) {
} }
void DumpPacketHex(const uchar* buf, uint32 size, uint32 cols, uint32 skip) { void DumpPacketHex(const uchar* buf, uint32 size, uint32 cols, uint32 skip) {
_eqp
if (size == 0 || size > 39565) if (size == 0 || size > 39565)
return; return;
// Output as HEX // Output as HEX
@ -93,7 +91,6 @@ void DumpPacketHex(const uchar* buf, uint32 size, uint32 cols, uint32 skip) {
} }
std::string DumpPacketHexToString(const uchar* buf, uint32 size, uint32 cols, uint32 skip) { std::string DumpPacketHexToString(const uchar* buf, uint32 size, uint32 cols, uint32 skip) {
_eqp
std::ostringstream out; std::ostringstream out;
if (size == 0 || size > 39565) if (size == 0 || size > 39565)
return ""; return "";
@ -143,13 +140,11 @@ std::string DumpPacketHexToString(const uchar* buf, uint32 size, uint32 cols, ui
void DumpPacket(const uchar* buf, uint32 size) void DumpPacket(const uchar* buf, uint32 size)
{ {
_eqp
DumpPacketHex(buf, size); DumpPacketHex(buf, size);
// DumpPacketAscii(buf,size); // DumpPacketAscii(buf,size);
} }
void DumpPacket(const ServerPacket* pack, bool iShowInfo) { void DumpPacket(const ServerPacket* pack, bool iShowInfo) {
_eqp
if (iShowInfo) { if (iShowInfo) {
std::cout << "Dumping ServerPacket: 0x" << std::hex << std::setfill('0') << std::setw(4) << pack->opcode << std::dec; std::cout << "Dumping ServerPacket: 0x" << std::hex << std::setfill('0') << std::setw(4) << pack->opcode << std::dec;
std::cout << " size:" << pack->size << std::endl; std::cout << " size:" << pack->size << std::endl;
@ -158,28 +153,23 @@ void DumpPacket(const ServerPacket* pack, bool iShowInfo) {
} }
void DumpPacketBin(const ServerPacket* pack) { void DumpPacketBin(const ServerPacket* pack) {
_eqp
DumpPacketBin(pack->pBuffer, pack->size); DumpPacketBin(pack->pBuffer, pack->size);
} }
void DumpPacketBin(uint32 data) { void DumpPacketBin(uint32 data) {
_eqp
DumpPacketBin((uchar*)&data, sizeof(uint32)); DumpPacketBin((uchar*)&data, sizeof(uint32));
} }
void DumpPacketBin(uint16 data) { void DumpPacketBin(uint16 data) {
_eqp
DumpPacketBin((uchar*)&data, sizeof(uint16)); DumpPacketBin((uchar*)&data, sizeof(uint16));
} }
void DumpPacketBin(uint8 data) { void DumpPacketBin(uint8 data) {
_eqp
DumpPacketBin((uchar*)&data, sizeof(uint8)); DumpPacketBin((uchar*)&data, sizeof(uint8));
} }
void DumpPacketBin(const void* iData, uint32 len) { void DumpPacketBin(const void* iData, uint32 len) {
_eqp
if (!len) if (!len)
return; return;
const uint8* data = (const uint8*) iData; const uint8* data = (const uint8*) iData;

View File

@ -41,7 +41,6 @@
#include "packet_dump_file.h" #include "packet_dump_file.h"
void FileDumpPacketAscii(const char* filename, const uchar* buf, uint32 size, uint32 cols, uint32 skip) { void FileDumpPacketAscii(const char* filename, const uchar* buf, uint32 size, uint32 cols, uint32 skip) {
_eqp
std::ofstream logfile(filename, std::ios::app); std::ofstream logfile(filename, std::ios::app);
// Output as ASCII // Output as ASCII
for(uint32 i=skip; i<size; i++) for(uint32 i=skip; i<size; i++)
@ -68,7 +67,6 @@ void FileDumpPacketAscii(const char* filename, const uchar* buf, uint32 size, ui
void oldFileDumpPacketHex(const char* filename, const uchar* buf, uint32 size, uint32 cols, uint32 skip) void oldFileDumpPacketHex(const char* filename, const uchar* buf, uint32 size, uint32 cols, uint32 skip)
{ {
_eqp
std::ofstream logfile(filename, std::ios::app); std::ofstream logfile(filename, std::ios::app);
// Output as HEX // Output as HEX
char output[4]; char output[4];
@ -91,7 +89,6 @@ void oldFileDumpPacketHex(const char* filename, const uchar* buf, uint32 size, u
void FileDumpPacketHex(const char* filename, const uchar* buf, uint32 size, uint32 cols, uint32 skip) void FileDumpPacketHex(const char* filename, const uchar* buf, uint32 size, uint32 cols, uint32 skip)
{ {
_eqp
if (size == 0) if (size == 0)
return; return;
std::ofstream logfile(filename, std::ios::app); std::ofstream logfile(filename, std::ios::app);
@ -134,19 +131,16 @@ void FileDumpPacketHex(const char* filename, const uchar* buf, uint32 size, uint
void FileDumpPacketHex(const char* filename, const EQApplicationPacket* app) void FileDumpPacketHex(const char* filename, const EQApplicationPacket* app)
{ {
_eqp
FileDumpPacketHex(filename, app->pBuffer, app->size); FileDumpPacketHex(filename, app->pBuffer, app->size);
} }
void FileDumpPacketAscii(const char* filename, const EQApplicationPacket* app) void FileDumpPacketAscii(const char* filename, const EQApplicationPacket* app)
{ {
_eqp
FileDumpPacketAscii(filename, app->pBuffer, app->size); FileDumpPacketAscii(filename, app->pBuffer, app->size);
} }
void FileDumpPacket(const char* filename, const uchar* buf, uint32 size) void FileDumpPacket(const char* filename, const uchar* buf, uint32 size)
{ {
_eqp
FilePrintLine(filename, true, "Size: %5i", size); FilePrintLine(filename, true, "Size: %5i", size);
FileDumpPacketHex(filename, buf, size); FileDumpPacketHex(filename, buf, size);
// FileDumpPacketAscii(filename, buf,size); // FileDumpPacketAscii(filename, buf,size);
@ -154,7 +148,6 @@ void FileDumpPacket(const char* filename, const uchar* buf, uint32 size)
void FileDumpPacket(const char* filename, const EQApplicationPacket* app) void FileDumpPacket(const char* filename, const EQApplicationPacket* app)
{ {
_eqp
FilePrintLine(filename, true, "Size: %5i, OPCode: 0x%04x", app->size, app->GetOpcode()); FilePrintLine(filename, true, "Size: %5i, OPCode: 0x%04x", app->size, app->GetOpcode());
FileDumpPacketHex(filename, app->pBuffer, app->size); FileDumpPacketHex(filename, app->pBuffer, app->size);
// FileDumpPacketAscii(filename, app->pBuffer, app->size); // FileDumpPacketAscii(filename, app->pBuffer, app->size);
@ -165,7 +158,6 @@ void FileDumpPacket(const char* filename, const EQApplicationPacket* app)
if prefix_timestamp specified, prints the current date/time to the file + ": " + text if prefix_timestamp specified, prints the current date/time to the file + ": " + text
*/ */
void FilePrintLine(const char* filename, bool prefix_timestamp, const char* text, ...) { void FilePrintLine(const char* filename, bool prefix_timestamp, const char* text, ...) {
_eqp
std::ofstream logfile(filename, std::ios::app); std::ofstream logfile(filename, std::ios::app);
if (prefix_timestamp) { if (prefix_timestamp) {
time_t rawtime; time_t rawtime;
@ -190,7 +182,6 @@ void FilePrintLine(const char* filename, bool prefix_timestamp, const char* text
} }
void FilePrint(const char* filename, bool newline, bool prefix_timestamp, const char* text, ...) { void FilePrint(const char* filename, bool newline, bool prefix_timestamp, const char* text, ...) {
_eqp
std::ofstream logfile(filename, std::ios::app); std::ofstream logfile(filename, std::ios::app);
if (prefix_timestamp) { if (prefix_timestamp) {
time_t rawtime; time_t rawtime;

View File

@ -88,7 +88,6 @@ CREATE TABLE timers (
PersistentTimer *PersistentTimer::LoadTimer(Database *db, uint32 char_id, pTimerType type) { PersistentTimer *PersistentTimer::LoadTimer(Database *db, uint32 char_id, pTimerType type) {
_eqp
PersistentTimer *p; PersistentTimer *p;
p = new PersistentTimer(char_id, type, 0); p = new PersistentTimer(char_id, type, 0);
if(p->Load(db)) if(p->Load(db))
@ -98,7 +97,6 @@ PersistentTimer *PersistentTimer::LoadTimer(Database *db, uint32 char_id, pTimer
} }
PersistentTimer::PersistentTimer(uint32 char_id, pTimerType type, uint32 in_timer_time) { PersistentTimer::PersistentTimer(uint32 char_id, pTimerType type, uint32 in_timer_time) {
_eqp
_char_id = char_id; _char_id = char_id;
_type = type; _type = type;
@ -115,7 +113,6 @@ PersistentTimer::PersistentTimer(uint32 char_id, pTimerType type, uint32 in_time
} }
PersistentTimer::PersistentTimer(uint32 char_id, pTimerType type, uint32 in_start_time, uint32 in_timer_time, bool in_enable) { PersistentTimer::PersistentTimer(uint32 char_id, pTimerType type, uint32 in_start_time, uint32 in_timer_time, bool in_enable) {
_eqp
_char_id = char_id; _char_id = char_id;
_type = type; _type = type;
@ -128,7 +125,6 @@ PersistentTimer::PersistentTimer(uint32 char_id, pTimerType type, uint32 in_star
} }
bool PersistentTimer::Load(Database *db) { bool PersistentTimer::Load(Database *db) {
_eqp
#ifdef DEBUG_PTIMERS #ifdef DEBUG_PTIMERS
printf("Loading timer: char %lu of type %u\n", (unsigned long)_char_id, _type); printf("Loading timer: char %lu of type %u\n", (unsigned long)_char_id, _type);
@ -155,7 +151,6 @@ bool PersistentTimer::Load(Database *db) {
} }
bool PersistentTimer::Store(Database *db) { bool PersistentTimer::Store(Database *db) {
_eqp
if(Expired(db, false)) //dont need to store expired timers. if(Expired(db, false)) //dont need to store expired timers.
return true; return true;
@ -180,7 +175,6 @@ bool PersistentTimer::Store(Database *db) {
} }
bool PersistentTimer::Clear(Database *db) { bool PersistentTimer::Clear(Database *db) {
_eqp
std::string query = StringFormat("DELETE FROM timers " std::string query = StringFormat("DELETE FROM timers "
"WHERE char_id = %lu AND type = %u ", "WHERE char_id = %lu AND type = %u ",
(unsigned long)_char_id, _type); (unsigned long)_char_id, _type);
@ -202,7 +196,6 @@ bool PersistentTimer::Clear(Database *db) {
/* This function checks if the timer triggered */ /* This function checks if the timer triggered */
bool PersistentTimer::Expired(Database *db, bool iReset) { bool PersistentTimer::Expired(Database *db, bool iReset) {
_eqp
if (this == nullptr) { if (this == nullptr) {
Log.Out(Logs::General, Logs::Error, "Null timer during ->Check()!?\n"); Log.Out(Logs::General, Logs::Error, "Null timer during ->Check()!?\n");
return(true); return(true);
@ -222,7 +215,6 @@ bool PersistentTimer::Expired(Database *db, bool iReset) {
/* This function set the timer and restart it */ /* This function set the timer and restart it */
void PersistentTimer::Start(uint32 set_timer_time) { void PersistentTimer::Start(uint32 set_timer_time) {
_eqp
start_time = get_current_time(); start_time = get_current_time();
enabled = true; enabled = true;
if (set_timer_time != 0) { if (set_timer_time != 0) {
@ -235,7 +227,6 @@ void PersistentTimer::Start(uint32 set_timer_time) {
// This timer updates the timer without restarting it // This timer updates the timer without restarting it
void PersistentTimer::SetTimer(uint32 set_timer_time) { void PersistentTimer::SetTimer(uint32 set_timer_time) {
_eqp
// If we were disabled before => restart the timer // If we were disabled before => restart the timer
timer_time = set_timer_time; timer_time = set_timer_time;
if (!enabled) { if (!enabled) {
@ -248,7 +239,6 @@ void PersistentTimer::SetTimer(uint32 set_timer_time) {
} }
uint32 PersistentTimer::GetRemainingTime() { uint32 PersistentTimer::GetRemainingTime() {
_eqp
if (enabled) { if (enabled) {
uint32 current_time = get_current_time(); uint32 current_time = get_current_time();
if (current_time-start_time > timer_time) if (current_time-start_time > timer_time)
@ -263,19 +253,16 @@ uint32 PersistentTimer::GetRemainingTime() {
uint32 PersistentTimer::get_current_time() { uint32 PersistentTimer::get_current_time() {
_eqp
timeval tv; timeval tv;
gettimeofday(&tv, nullptr); gettimeofday(&tv, nullptr);
return(tv.tv_sec); return(tv.tv_sec);
} }
PTimerList::PTimerList(uint32 char_id) { PTimerList::PTimerList(uint32 char_id) {
_eqp
_char_id = char_id; _char_id = char_id;
} }
PTimerList::~PTimerList() { PTimerList::~PTimerList() {
_eqp
std::map<pTimerType, PersistentTimer *>::iterator s; std::map<pTimerType, PersistentTimer *>::iterator s;
s = _list.begin(); s = _list.begin();
while(s != _list.end()) { while(s != _list.end()) {
@ -287,7 +274,6 @@ PTimerList::~PTimerList() {
bool PTimerList::Load(Database *db) { bool PTimerList::Load(Database *db) {
_eqp
for (auto timerIterator = _list.begin(); timerIterator != _list.end(); ++timerIterator) for (auto timerIterator = _list.begin(); timerIterator != _list.end(); ++timerIterator)
if(timerIterator->second != nullptr) if(timerIterator->second != nullptr)
@ -332,7 +318,6 @@ bool PTimerList::Load(Database *db) {
} }
bool PTimerList::Store(Database *db) { bool PTimerList::Store(Database *db) {
_eqp
#ifdef DEBUG_PTIMERS #ifdef DEBUG_PTIMERS
printf("Storing all timers for char %lu\n", (unsigned long)_char_id); printf("Storing all timers for char %lu\n", (unsigned long)_char_id);
#endif #endif
@ -354,7 +339,6 @@ bool PTimerList::Store(Database *db) {
} }
bool PTimerList::Clear(Database *db) { bool PTimerList::Clear(Database *db) {
_eqp
_list.clear(); _list.clear();
std::string query = StringFormat("DELETE FROM timers WHERE char_id=%lu ", (unsigned long)_char_id); std::string query = StringFormat("DELETE FROM timers WHERE char_id=%lu ", (unsigned long)_char_id);
@ -373,7 +357,6 @@ bool PTimerList::Clear(Database *db) {
} }
void PTimerList::Start(pTimerType type, uint32 duration) { void PTimerList::Start(pTimerType type, uint32 duration) {
_eqp
if(_list.count(type) == 1 && _list[type] != nullptr) { if(_list.count(type) == 1 && _list[type] != nullptr) {
_list[type]->Start(duration); _list[type]->Start(duration);
} else { } else {
@ -382,7 +365,6 @@ void PTimerList::Start(pTimerType type, uint32 duration) {
} }
void PTimerList::Clear(Database *db, pTimerType type) { void PTimerList::Clear(Database *db, pTimerType type) {
_eqp
if(_list.count(type) == 1) { if(_list.count(type) == 1) {
if(_list[type] != nullptr) { if(_list[type] != nullptr) {
_list[type]->Clear(db); _list[type]->Clear(db);
@ -393,7 +375,6 @@ void PTimerList::Clear(Database *db, pTimerType type) {
} }
bool PTimerList::Expired(Database *db, pTimerType type, bool reset) { bool PTimerList::Expired(Database *db, pTimerType type, bool reset) {
_eqp
if(_list.count(type) != 1) if(_list.count(type) != 1)
return(true); return(true);
if(_list[type] == nullptr) if(_list[type] == nullptr)
@ -402,7 +383,6 @@ bool PTimerList::Expired(Database *db, pTimerType type, bool reset) {
} }
bool PTimerList::Enabled(pTimerType type) { bool PTimerList::Enabled(pTimerType type) {
_eqp
if(_list.count(type) != 1) if(_list.count(type) != 1)
return(false); return(false);
if(_list[type] == nullptr) if(_list[type] == nullptr)
@ -411,19 +391,16 @@ bool PTimerList::Enabled(pTimerType type) {
} }
void PTimerList::Enable(pTimerType type) { void PTimerList::Enable(pTimerType type) {
_eqp
if(_list.count(type) == 1 && _list[type] != nullptr) if(_list.count(type) == 1 && _list[type] != nullptr)
_list[type]->Enable(); _list[type]->Enable();
} }
void PTimerList::Disable(pTimerType type) { void PTimerList::Disable(pTimerType type) {
_eqp
if(_list.count(type) == 1 && _list[type] != nullptr) if(_list.count(type) == 1 && _list[type] != nullptr)
_list[type]->Disable(); _list[type]->Disable();
} }
uint32 PTimerList::GetRemainingTime(pTimerType type) { uint32 PTimerList::GetRemainingTime(pTimerType type) {
_eqp
if(_list.count(type) != 1) if(_list.count(type) != 1)
return(0); return(0);
if(_list[type] == nullptr) if(_list[type] == nullptr)
@ -432,14 +409,12 @@ uint32 PTimerList::GetRemainingTime(pTimerType type) {
} }
PersistentTimer *PTimerList::Get(pTimerType type) { PersistentTimer *PTimerList::Get(pTimerType type) {
_eqp
if(_list.count(type) != 1) if(_list.count(type) != 1)
return(nullptr); return(nullptr);
return(_list[type]); return(_list[type]);
} }
void PTimerList::ToVector(std::vector< std::pair<pTimerType, PersistentTimer *> > &out) { void PTimerList::ToVector(std::vector< std::pair<pTimerType, PersistentTimer *> > &out) {
_eqp
std::pair<pTimerType, PersistentTimer *> p; std::pair<pTimerType, PersistentTimer *> p;
std::map<pTimerType, PersistentTimer *>::iterator s; std::map<pTimerType, PersistentTimer *>::iterator s;
@ -455,7 +430,6 @@ void PTimerList::ToVector(std::vector< std::pair<pTimerType, PersistentTimer *>
} }
bool PTimerList::ClearOffline(Database *db, uint32 char_id, pTimerType type) { bool PTimerList::ClearOffline(Database *db, uint32 char_id, pTimerType type) {
_eqp
std::string query = StringFormat("DELETE FROM timers WHERE char_id=%lu AND type=%u ",(unsigned long)char_id, type); std::string query = StringFormat("DELETE FROM timers WHERE char_id=%lu AND type=%u ",(unsigned long)char_id, type);
#ifdef DEBUG_PTIMERS #ifdef DEBUG_PTIMERS

View File

@ -30,7 +30,6 @@ uint32 current_time = 0;
uint32 last_time = 0; uint32 last_time = 0;
Timer::Timer() { Timer::Timer() {
_eqp
timer_time = 0; timer_time = 0;
start_time = current_time; start_time = current_time;
set_at_trigger = timer_time; set_at_trigger = timer_time;
@ -39,7 +38,6 @@ Timer::Timer() {
} }
Timer::Timer(uint32 in_timer_time, bool iUseAcurateTiming) { Timer::Timer(uint32 in_timer_time, bool iUseAcurateTiming) {
_eqp
timer_time = in_timer_time; timer_time = in_timer_time;
start_time = current_time; start_time = current_time;
set_at_trigger = timer_time; set_at_trigger = timer_time;
@ -53,7 +51,6 @@ Timer::Timer(uint32 in_timer_time, bool iUseAcurateTiming) {
} }
Timer::Timer(uint32 start, uint32 timer, bool iUseAcurateTiming = false) { Timer::Timer(uint32 start, uint32 timer, bool iUseAcurateTiming = false) {
_eqp
timer_time = timer; timer_time = timer;
start_time = start; start_time = start;
set_at_trigger = timer_time; set_at_trigger = timer_time;
@ -101,18 +98,15 @@ bool Timer::Check(bool iReset)
/* This function disables the timer */ /* This function disables the timer */
void Timer::Disable() { void Timer::Disable() {
_eqp
enabled = false; enabled = false;
} }
void Timer::Enable() { void Timer::Enable() {
_eqp
enabled = true; enabled = true;
} }
/* This function set the timer and restart it */ /* This function set the timer and restart it */
void Timer::Start(uint32 set_timer_time, bool ChangeResetTimer) { void Timer::Start(uint32 set_timer_time, bool ChangeResetTimer) {
_eqp
start_time = current_time; start_time = current_time;
enabled = true; enabled = true;
if (set_timer_time != 0) if (set_timer_time != 0)
@ -125,7 +119,6 @@ void Timer::Start(uint32 set_timer_time, bool ChangeResetTimer) {
/* This timer updates the timer without restarting it */ /* This timer updates the timer without restarting it */
void Timer::SetTimer(uint32 set_timer_time) { void Timer::SetTimer(uint32 set_timer_time) {
_eqp
/* If we were disabled before => restart the timer */ /* If we were disabled before => restart the timer */
if (!enabled) { if (!enabled) {
start_time = current_time; start_time = current_time;
@ -138,7 +131,6 @@ void Timer::SetTimer(uint32 set_timer_time) {
} }
uint32 Timer::GetRemainingTime() { uint32 Timer::GetRemainingTime() {
_eqp
if (enabled) { if (enabled) {
if (current_time-start_time > timer_time) if (current_time-start_time > timer_time)
return 0; return 0;
@ -151,7 +143,6 @@ uint32 Timer::GetRemainingTime() {
} }
void Timer::SetAtTrigger(uint32 in_set_at_trigger, bool iEnableIfDisabled, bool ChangeTimerTime) { void Timer::SetAtTrigger(uint32 in_set_at_trigger, bool iEnableIfDisabled, bool ChangeTimerTime) {
_eqp
set_at_trigger = in_set_at_trigger; set_at_trigger = in_set_at_trigger;
if (!Enabled() && iEnableIfDisabled) { if (!Enabled() && iEnableIfDisabled) {
Enable(); Enable();
@ -162,7 +153,6 @@ void Timer::SetAtTrigger(uint32 in_set_at_trigger, bool iEnableIfDisabled, bool
void Timer::Trigger() void Timer::Trigger()
{ {
_eqp
enabled = true; enabled = true;
timer_time = set_at_trigger; timer_time = set_at_trigger;
@ -171,13 +161,11 @@ void Timer::Trigger()
const uint32 Timer::GetCurrentTime() const uint32 Timer::GetCurrentTime()
{ {
_eqp
return current_time; return current_time;
} }
//just to keep all time related crap in one place... not really related to timers. //just to keep all time related crap in one place... not really related to timers.
const uint32 Timer::GetTimeSeconds() { const uint32 Timer::GetTimeSeconds() {
_eqp
struct timeval read_time; struct timeval read_time;
gettimeofday(&read_time,0); gettimeofday(&read_time,0);
@ -186,7 +174,6 @@ const uint32 Timer::GetTimeSeconds() {
const uint32 Timer::SetCurrentTime() const uint32 Timer::SetCurrentTime()
{ {
_eqp
struct timeval read_time; struct timeval read_time;
uint32 this_time; uint32 this_time;