mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-28 17:11:29 +00:00
Working working working on adding profiling, also switched to multi-threaded profiler (slower but need it).
This commit is contained in:
parent
2acf84ce4a
commit
444b652c4f
@ -11,7 +11,7 @@ ADD_EXECUTABLE(export_client_files ${export_sources} ${export_headers})
|
||||
|
||||
INSTALL(TARGETS export_client_files RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
|
||||
TARGET_LINK_LIBRARIES(export_client_files common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY})
|
||||
TARGET_LINK_LIBRARIES(export_client_files common ${PERF_LIBS} debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY})
|
||||
|
||||
IF(MSVC)
|
||||
SET_TARGET_PROPERTIES(export_client_files PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF")
|
||||
|
||||
@ -11,7 +11,7 @@ ADD_EXECUTABLE(import_client_files ${import_sources} ${import_headers})
|
||||
|
||||
INSTALL(TARGETS import_client_files RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
|
||||
TARGET_LINK_LIBRARIES(import_client_files common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY})
|
||||
TARGET_LINK_LIBRARIES(import_client_files common ${PERF_LIBS} debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY})
|
||||
|
||||
IF(MSVC)
|
||||
SET_TARGET_PROPERTIES(import_client_files PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF")
|
||||
|
||||
@ -1620,7 +1620,7 @@ uint32 Database::GetGroupID(const char* name){
|
||||
if (results.RowCount() == 0)
|
||||
{
|
||||
// Commenting this out until logging levels can prevent this from going to console
|
||||
//Log.Out(Logs::General, Logs::None,, "Character not in a group: %s", name);
|
||||
//Log.Out(Logs::General, Logs::None, "Character not in a group: %s", name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -39,9 +39,11 @@ EQPacket::EQPacket(EmuOpcode op, const unsigned char *buf, uint32 len)
|
||||
: BasePacket(buf, len),
|
||||
emu_opcode(op)
|
||||
{
|
||||
_eqp_mt
|
||||
}
|
||||
|
||||
void EQPacket::build_raw_header_dump(char *buffer, uint16 seq) const {
|
||||
_eqp_mt
|
||||
BasePacket::build_raw_header_dump(buffer, seq);
|
||||
buffer += strlen(buffer);
|
||||
|
||||
@ -50,17 +52,20 @@ void EQPacket::build_raw_header_dump(char *buffer, uint16 seq) const {
|
||||
|
||||
void EQPacket::DumpRawHeader(uint16 seq, FILE *to) const
|
||||
{
|
||||
_eqp_mt
|
||||
char buff[196];
|
||||
build_raw_header_dump(buff, seq);
|
||||
fprintf(to, "%s", buff);
|
||||
}
|
||||
|
||||
void EQPacket::build_header_dump(char *buffer) const {
|
||||
_eqp_mt
|
||||
sprintf(buffer, "[EmuOpCode 0x%04x Size=%u]", emu_opcode, size);
|
||||
}
|
||||
|
||||
void EQPacket::DumpRawHeaderNoTime(uint16 seq, FILE *to) const
|
||||
{
|
||||
_eqp_mt
|
||||
if (src_ip) {
|
||||
std::string sIP,dIP;;
|
||||
sIP=long2ip(src_ip);
|
||||
@ -75,6 +80,7 @@ void EQPacket::DumpRawHeaderNoTime(uint16 seq, FILE *to) const
|
||||
|
||||
void EQProtocolPacket::build_raw_header_dump(char *buffer, uint16 seq) const
|
||||
{
|
||||
_eqp_mt
|
||||
BasePacket::build_raw_header_dump(buffer, seq);
|
||||
buffer += strlen(buffer);
|
||||
|
||||
@ -83,6 +89,7 @@ void EQProtocolPacket::build_raw_header_dump(char *buffer, uint16 seq) const
|
||||
|
||||
void EQProtocolPacket::DumpRawHeader(uint16 seq, FILE *to) const
|
||||
{
|
||||
_eqp_mt
|
||||
char buff[196];
|
||||
build_raw_header_dump(buff, seq);
|
||||
fprintf(to, "%s", buff);
|
||||
@ -90,11 +97,13 @@ void EQProtocolPacket::DumpRawHeader(uint16 seq, FILE *to) const
|
||||
|
||||
void EQProtocolPacket::build_header_dump(char *buffer) const
|
||||
{
|
||||
_eqp_mt
|
||||
sprintf(buffer, "[ProtoOpCode 0x%04x Size=%u]",opcode,size);
|
||||
}
|
||||
|
||||
void EQProtocolPacket::DumpRawHeaderNoTime(uint16 seq, FILE *to) const
|
||||
{
|
||||
_eqp_mt
|
||||
if (src_ip) {
|
||||
std::string sIP,dIP;;
|
||||
sIP=long2ip(src_ip);
|
||||
@ -109,6 +118,7 @@ void EQProtocolPacket::DumpRawHeaderNoTime(uint16 seq, FILE *to) const
|
||||
|
||||
void EQApplicationPacket::build_raw_header_dump(char *buffer, uint16 seq) const
|
||||
{
|
||||
_eqp_mt
|
||||
BasePacket::build_raw_header_dump(buffer, seq);
|
||||
buffer += strlen(buffer);
|
||||
|
||||
@ -121,6 +131,7 @@ void EQApplicationPacket::build_raw_header_dump(char *buffer, uint16 seq) const
|
||||
|
||||
void EQApplicationPacket::DumpRawHeader(uint16 seq, FILE *to) const
|
||||
{
|
||||
_eqp_mt
|
||||
char buff[196];
|
||||
build_raw_header_dump(buff, seq);
|
||||
fprintf(to, "%s", buff);
|
||||
@ -128,6 +139,7 @@ void EQApplicationPacket::DumpRawHeader(uint16 seq, FILE *to) const
|
||||
|
||||
void EQApplicationPacket::build_header_dump(char *buffer) const
|
||||
{
|
||||
_eqp_mt
|
||||
#ifdef STATIC_OPCODE
|
||||
sprintf(buffer, "[OpCode 0x%04x Size=%u]\n", emu_opcode,size);
|
||||
#else
|
||||
@ -137,6 +149,7 @@ void EQApplicationPacket::build_header_dump(char *buffer) const
|
||||
|
||||
void EQApplicationPacket::DumpRawHeaderNoTime(uint16 seq, FILE *to) const
|
||||
{
|
||||
_eqp_mt
|
||||
if (src_ip) {
|
||||
std::string sIP,dIP;;
|
||||
sIP=long2ip(src_ip);
|
||||
@ -155,6 +168,7 @@ void EQApplicationPacket::DumpRawHeaderNoTime(uint16 seq, FILE *to) const
|
||||
|
||||
void EQRawApplicationPacket::build_raw_header_dump(char *buffer, uint16 seq) const
|
||||
{
|
||||
_eqp_mt
|
||||
BasePacket::build_raw_header_dump(buffer, seq);
|
||||
buffer += strlen(buffer);
|
||||
|
||||
@ -167,6 +181,7 @@ void EQRawApplicationPacket::build_raw_header_dump(char *buffer, uint16 seq) con
|
||||
|
||||
void EQRawApplicationPacket::DumpRawHeader(uint16 seq, FILE *to) const
|
||||
{
|
||||
_eqp_mt
|
||||
char buff[196];
|
||||
build_raw_header_dump(buff, seq);
|
||||
fprintf(to, "%s", buff);
|
||||
@ -174,6 +189,7 @@ void EQRawApplicationPacket::DumpRawHeader(uint16 seq, FILE *to) const
|
||||
|
||||
void EQRawApplicationPacket::build_header_dump(char *buffer) const
|
||||
{
|
||||
_eqp_mt
|
||||
#ifdef STATIC_OPCODE
|
||||
sprintf(buffer, "[OpCode 0x%04x (0x%04x) Size=%u]\n", emu_opcode, opcode,size);
|
||||
#else
|
||||
@ -183,6 +199,7 @@ void EQRawApplicationPacket::build_header_dump(char *buffer) const
|
||||
|
||||
void EQRawApplicationPacket::DumpRawHeaderNoTime(uint16 seq, FILE *to) const
|
||||
{
|
||||
_eqp_mt
|
||||
if (src_ip) {
|
||||
std::string sIP,dIP;;
|
||||
sIP=long2ip(src_ip);
|
||||
@ -201,6 +218,7 @@ void EQRawApplicationPacket::DumpRawHeaderNoTime(uint16 seq, FILE *to) const
|
||||
|
||||
uint32 EQProtocolPacket::serialize(unsigned char *dest) const
|
||||
{
|
||||
_eqp_mt
|
||||
if (opcode>0xff) {
|
||||
*(uint16 *)dest=opcode;
|
||||
} else {
|
||||
@ -214,6 +232,7 @@ uint32 EQProtocolPacket::serialize(unsigned char *dest) const
|
||||
|
||||
uint32 EQApplicationPacket::serialize(uint16 opcode, unsigned char *dest) const
|
||||
{
|
||||
_eqp_mt
|
||||
uint8 OpCodeBytes = app_opcode_size;
|
||||
|
||||
if (app_opcode_size==1)
|
||||
@ -235,29 +254,10 @@ uint32 EQApplicationPacket::serialize(uint16 opcode, unsigned char *dest) const
|
||||
return size+OpCodeBytes;
|
||||
}
|
||||
|
||||
/*EQProtocolPacket::EQProtocolPacket(uint16 op, const unsigned char *buf, uint32 len)
|
||||
: BasePacket(buf, len),
|
||||
opcode(op)
|
||||
{
|
||||
|
||||
uint32 offset;
|
||||
opcode=ntohs(*(const uint16 *)buf);
|
||||
offset=2;
|
||||
|
||||
if (len-offset) {
|
||||
pBuffer= new unsigned char[len-offset];
|
||||
memcpy(pBuffer,buf+offset,len-offset);
|
||||
size=len-offset;
|
||||
} else {
|
||||
pBuffer=nullptr;
|
||||
size=0;
|
||||
}
|
||||
OpMgr=&RawOpcodeManager;
|
||||
}*/
|
||||
|
||||
bool EQProtocolPacket::combine(const EQProtocolPacket *rhs)
|
||||
{
|
||||
bool result=false;
|
||||
_eqp_mt
|
||||
bool result=false;
|
||||
if (opcode==OP_Combined && size+rhs->size+5<256) {
|
||||
unsigned char *tmpbuffer=new unsigned char [size+rhs->size+3];
|
||||
memcpy(tmpbuffer,pBuffer,size);
|
||||
@ -286,58 +286,10 @@ bool result=false;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
this is the code to do app-layer combining, instead of protocol layer.
|
||||
this was taken out due to complex interactions with the opcode manager,
|
||||
and will require a bit more thinking (likely moving into EQStream) to
|
||||
get running again... but might be a good thing some day.
|
||||
|
||||
bool EQApplicationPacket::combine(const EQApplicationPacket *rhs)
|
||||
{
|
||||
uint32 newsize=0, offset=0;
|
||||
unsigned char *tmpbuffer=nullptr;
|
||||
|
||||
if (opcode!=OP_AppCombined) {
|
||||
newsize=app_opcode_size+size+(size>254?3:1)+app_opcode_size+rhs->size+(rhs->size>254?3:1);
|
||||
tmpbuffer=new unsigned char [newsize];
|
||||
offset=0;
|
||||
if (size>254) {
|
||||
tmpbuffer[offset++]=0xff;
|
||||
*(uint16 *)(tmpbuffer+offset)=htons(size);
|
||||
offset+=1;
|
||||
} else {
|
||||
tmpbuffer[offset++]=size;
|
||||
}
|
||||
offset+=serialize(tmpbuffer+offset);
|
||||
} else {
|
||||
newsize=size+app_opcode_size+rhs->size+(rhs->size>254?3:1);
|
||||
tmpbuffer=new unsigned char [newsize];
|
||||
memcpy(tmpbuffer,pBuffer,size);
|
||||
offset=size;
|
||||
}
|
||||
|
||||
if (rhs->size>254) {
|
||||
tmpbuffer[offset++]=0xff;
|
||||
*(uint16 *)(tmpbuffer+offset)=htons(rhs->size);
|
||||
offset+=1;
|
||||
} else {
|
||||
tmpbuffer[offset++]=rhs->size;
|
||||
}
|
||||
offset+=rhs->serialize(tmpbuffer+offset);
|
||||
|
||||
size=offset;
|
||||
opcode=OP_AppCombined;
|
||||
|
||||
delete[] pBuffer;
|
||||
pBuffer=tmpbuffer;
|
||||
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
|
||||
bool EQProtocolPacket::ValidateCRC(const unsigned char *buffer, int length, uint32 Key)
|
||||
{
|
||||
bool valid=false;
|
||||
_eqp_mt
|
||||
bool valid=false;
|
||||
// OP_SessionRequest, OP_SessionResponse, OP_OutOfSession are not CRC'd
|
||||
if (buffer[0]==0x00 && (buffer[1]==OP_SessionRequest || buffer[1]==OP_SessionResponse || buffer[1]==OP_OutOfSession)) {
|
||||
valid=true;
|
||||
@ -356,8 +308,9 @@ bool valid=false;
|
||||
|
||||
uint32 EQProtocolPacket::Decompress(const unsigned char *buffer, const uint32 length, unsigned char *newbuf, uint32 newbufsize)
|
||||
{
|
||||
uint32 newlen=0;
|
||||
uint32 flag_offset=0;
|
||||
_eqp_mt
|
||||
uint32 newlen=0;
|
||||
uint32 flag_offset=0;
|
||||
newbuf[0]=buffer[0];
|
||||
if (buffer[0]==0x00) {
|
||||
flag_offset=2;
|
||||
@ -381,7 +334,8 @@ uint32 flag_offset=0;
|
||||
}
|
||||
|
||||
uint32 EQProtocolPacket::Compress(const unsigned char *buffer, const uint32 length, unsigned char *newbuf, uint32 newbufsize) {
|
||||
uint32 flag_offset=1,newlength;
|
||||
_eqp_mt
|
||||
uint32 flag_offset=1,newlength;
|
||||
//dump_message_column(buffer,length,"Before: ");
|
||||
newbuf[0]=buffer[0];
|
||||
if (buffer[0]==0) {
|
||||
@ -404,6 +358,7 @@ uint32 flag_offset=1,newlength;
|
||||
|
||||
void EQProtocolPacket::ChatDecode(unsigned char *buffer, int size, int DecodeKey)
|
||||
{
|
||||
_eqp_mt
|
||||
if ((size >= 2) && buffer[1]!=0x01 && buffer[0]!=0x02 && buffer[0]!=0x1d) {
|
||||
int Key=DecodeKey;
|
||||
unsigned char *test=(unsigned char *)malloc(size);
|
||||
@ -429,6 +384,7 @@ void EQProtocolPacket::ChatDecode(unsigned char *buffer, int size, int DecodeKey
|
||||
|
||||
void EQProtocolPacket::ChatEncode(unsigned char *buffer, int size, int EncodeKey)
|
||||
{
|
||||
_eqp_mt
|
||||
if (buffer[1]!=0x01 && buffer[0]!=0x02 && buffer[0]!=0x1d) {
|
||||
int Key=EncodeKey;
|
||||
char *test=(char*)malloc(size);
|
||||
@ -452,10 +408,12 @@ void EQProtocolPacket::ChatEncode(unsigned char *buffer, int size, int EncodeKey
|
||||
}
|
||||
|
||||
EQApplicationPacket *EQApplicationPacket::Copy() const {
|
||||
_eqp_mt
|
||||
return(new EQApplicationPacket(*this));
|
||||
}
|
||||
|
||||
EQRawApplicationPacket *EQProtocolPacket::MakeAppPacket() const {
|
||||
_eqp_mt
|
||||
EQRawApplicationPacket *res = new EQRawApplicationPacket(opcode, pBuffer, size);
|
||||
res->copyInfo(this);
|
||||
return(res);
|
||||
@ -465,10 +423,12 @@ EQRawApplicationPacket::EQRawApplicationPacket(uint16 opcode, const unsigned cha
|
||||
: EQApplicationPacket(OP_Unknown, buf, len),
|
||||
opcode(opcode)
|
||||
{
|
||||
_eqp_mt
|
||||
}
|
||||
EQRawApplicationPacket::EQRawApplicationPacket(const unsigned char *buf, const uint32 len)
|
||||
: EQApplicationPacket(OP_Unknown, buf+sizeof(uint16), len-sizeof(uint16))
|
||||
{
|
||||
_eqp_mt
|
||||
if(GetExecutablePlatform() != ExePlatformUCS) {
|
||||
opcode = *((const uint16 *) buf);
|
||||
if(opcode == 0x0000)
|
||||
@ -502,11 +462,11 @@ EQRawApplicationPacket::EQRawApplicationPacket(const unsigned char *buf, const u
|
||||
}
|
||||
|
||||
void DumpPacket(const EQApplicationPacket* app, bool iShowInfo) {
|
||||
_eqp_mt
|
||||
if (iShowInfo) {
|
||||
std::cout << "Dumping Applayer: 0x" << std::hex << std::setfill('0') << std::setw(4) << app->GetOpcode() << std::dec;
|
||||
std::cout << " size:" << app->size << std::endl;
|
||||
}
|
||||
DumpPacketHex(app->pBuffer, app->size);
|
||||
// DumpPacketAscii(app->pBuffer, app->size);
|
||||
}
|
||||
|
||||
|
||||
@ -49,6 +49,7 @@
|
||||
uint16 EQStream::MaxWindowSize=2048;
|
||||
|
||||
void EQStream::init(bool resetSession) {
|
||||
_eqp_mt
|
||||
// we only reset these statistics if it is a 'new' connection
|
||||
if ( resetSession )
|
||||
{
|
||||
@ -91,6 +92,7 @@ void EQStream::init(bool resetSession) {
|
||||
|
||||
EQRawApplicationPacket *EQStream::MakeApplicationPacket(EQProtocolPacket *p)
|
||||
{
|
||||
_eqp_mt
|
||||
EQRawApplicationPacket *ap=nullptr;
|
||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Creating new application packet, length %d" __L, p->size);
|
||||
// _raw(NET__APP_CREATE_HEX, 0xFFFF, p);
|
||||
@ -100,6 +102,7 @@ EQRawApplicationPacket *EQStream::MakeApplicationPacket(EQProtocolPacket *p)
|
||||
|
||||
EQRawApplicationPacket *EQStream::MakeApplicationPacket(const unsigned char *buf, uint32 len)
|
||||
{
|
||||
_eqp_mt
|
||||
EQRawApplicationPacket *ap=nullptr;
|
||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Creating new application packet, length %d" __L, len);
|
||||
ap = new EQRawApplicationPacket(buf, len);
|
||||
@ -107,6 +110,7 @@ EQRawApplicationPacket *EQStream::MakeApplicationPacket(const unsigned char *buf
|
||||
}
|
||||
|
||||
EQProtocolPacket *EQStream::MakeProtocolPacket(const unsigned char *buf, uint32 len) {
|
||||
_eqp_mt
|
||||
uint16 proto_opcode = ntohs(*(const uint16 *)buf);
|
||||
|
||||
//advance over opcode.
|
||||
@ -118,6 +122,7 @@ EQProtocolPacket *EQStream::MakeProtocolPacket(const unsigned char *buf, uint32
|
||||
|
||||
void EQStream::ProcessPacket(EQProtocolPacket *p)
|
||||
{
|
||||
_eqp_mt
|
||||
uint32 processed=0, subpacket_length=0;
|
||||
if (p == nullptr)
|
||||
return;
|
||||
@ -515,6 +520,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
|
||||
|
||||
void EQStream::QueuePacket(const EQApplicationPacket *p, bool ack_req)
|
||||
{
|
||||
_eqp_mt
|
||||
if(p == nullptr)
|
||||
return;
|
||||
|
||||
@ -526,6 +532,7 @@ void EQStream::QueuePacket(const EQApplicationPacket *p, bool ack_req)
|
||||
|
||||
void EQStream::FastQueuePacket(EQApplicationPacket **p, bool ack_req)
|
||||
{
|
||||
_eqp_mt
|
||||
EQApplicationPacket *pack=*p;
|
||||
*p = nullptr; //clear caller's pointer.. effectively takes ownership
|
||||
|
||||
@ -555,6 +562,7 @@ void EQStream::FastQueuePacket(EQApplicationPacket **p, bool ack_req)
|
||||
|
||||
void EQStream::SendPacket(uint16 opcode, EQApplicationPacket *p)
|
||||
{
|
||||
_eqp_mt
|
||||
uint32 chunksize,used;
|
||||
uint32 length;
|
||||
|
||||
@ -599,6 +607,7 @@ void EQStream::SendPacket(uint16 opcode, EQApplicationPacket *p)
|
||||
|
||||
void EQStream::SequencedPush(EQProtocolPacket *p)
|
||||
{
|
||||
_eqp_mt
|
||||
#ifdef COLLECTOR
|
||||
delete p;
|
||||
#else
|
||||
@ -627,6 +636,7 @@ if(NextSequencedSend > SequencedQueue.size()) {
|
||||
|
||||
void EQStream::NonSequencedPush(EQProtocolPacket *p)
|
||||
{
|
||||
_eqp_mt
|
||||
#ifdef COLLECTOR
|
||||
delete p;
|
||||
#else
|
||||
@ -639,7 +649,8 @@ void EQStream::NonSequencedPush(EQProtocolPacket *p)
|
||||
|
||||
void EQStream::SendAck(uint16 seq)
|
||||
{
|
||||
uint16 Seq=htons(seq);
|
||||
_eqp_mt
|
||||
uint16 Seq=htons(seq);
|
||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Sending ack with sequence %d" __L, seq);
|
||||
SetLastAckSent(seq);
|
||||
NonSequencedPush(new EQProtocolPacket(OP_Ack,(unsigned char *)&Seq,sizeof(uint16)));
|
||||
@ -647,6 +658,7 @@ uint16 Seq=htons(seq);
|
||||
|
||||
void EQStream::SendOutOfOrderAck(uint16 seq)
|
||||
{
|
||||
_eqp_mt
|
||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Sending out of order ack with sequence %d" __L, seq);
|
||||
uint16 Seq=htons(seq);
|
||||
NonSequencedPush(new EQProtocolPacket(OP_OutOfOrderAck,(unsigned char *)&Seq,sizeof(uint16)));
|
||||
@ -654,6 +666,7 @@ uint16 Seq=htons(seq);
|
||||
|
||||
void EQStream::Write(int eq_fd)
|
||||
{
|
||||
_eqp_mt
|
||||
std::queue<EQProtocolPacket *> ReadyToSend;
|
||||
bool SeqEmpty=false, NonSeqEmpty=false;
|
||||
std::deque<EQProtocolPacket *>::iterator sitr;
|
||||
@ -849,8 +862,9 @@ void EQStream::Write(int eq_fd)
|
||||
|
||||
void EQStream::WritePacket(int eq_fd, EQProtocolPacket *p)
|
||||
{
|
||||
uint32 length;
|
||||
sockaddr_in address;
|
||||
_eqp_mt
|
||||
uint32 length;
|
||||
sockaddr_in address;
|
||||
address.sin_family = AF_INET;
|
||||
address.sin_addr.s_addr=remote_ip;
|
||||
address.sin_port=remote_port;
|
||||
@ -887,7 +901,8 @@ sockaddr_in address;
|
||||
|
||||
void EQStream::SendSessionResponse()
|
||||
{
|
||||
EQProtocolPacket *out=new EQProtocolPacket(OP_SessionResponse,nullptr,sizeof(SessionResponse));
|
||||
_eqp_mt
|
||||
EQProtocolPacket *out=new EQProtocolPacket(OP_SessionResponse,nullptr,sizeof(SessionResponse));
|
||||
SessionResponse *Response=(SessionResponse *)out->pBuffer;
|
||||
Response->Session=htonl(Session);
|
||||
Response->MaxLength=htonl(MaxLen);
|
||||
@ -909,7 +924,8 @@ EQProtocolPacket *out=new EQProtocolPacket(OP_SessionResponse,nullptr,sizeof(Ses
|
||||
|
||||
void EQStream::SendSessionRequest()
|
||||
{
|
||||
EQProtocolPacket *out=new EQProtocolPacket(OP_SessionRequest,nullptr,sizeof(SessionRequest));
|
||||
_eqp_mt
|
||||
EQProtocolPacket *out=new EQProtocolPacket(OP_SessionRequest,nullptr,sizeof(SessionRequest));
|
||||
SessionRequest *Request=(SessionRequest *)out->pBuffer;
|
||||
memset(Request,0,sizeof(SessionRequest));
|
||||
Request->Session=htonl(time(nullptr));
|
||||
@ -922,6 +938,7 @@ EQProtocolPacket *out=new EQProtocolPacket(OP_SessionRequest,nullptr,sizeof(Sess
|
||||
|
||||
void EQStream::_SendDisconnect()
|
||||
{
|
||||
_eqp_mt
|
||||
if(GetState() == CLOSED)
|
||||
return;
|
||||
|
||||
@ -934,6 +951,7 @@ void EQStream::_SendDisconnect()
|
||||
|
||||
void EQStream::InboundQueuePush(EQRawApplicationPacket *p)
|
||||
{
|
||||
_eqp_mt
|
||||
MInboundQueue.lock();
|
||||
InboundQueue.push_back(p);
|
||||
MInboundQueue.unlock();
|
||||
@ -941,7 +959,8 @@ void EQStream::InboundQueuePush(EQRawApplicationPacket *p)
|
||||
|
||||
EQApplicationPacket *EQStream::PopPacket()
|
||||
{
|
||||
EQRawApplicationPacket *p=nullptr;
|
||||
_eqp_mt
|
||||
EQRawApplicationPacket *p=nullptr;
|
||||
|
||||
MInboundQueue.lock();
|
||||
if (InboundQueue.size()) {
|
||||
@ -968,7 +987,8 @@ EQRawApplicationPacket *p=nullptr;
|
||||
|
||||
EQRawApplicationPacket *EQStream::PopRawPacket()
|
||||
{
|
||||
EQRawApplicationPacket *p=nullptr;
|
||||
_eqp_mt
|
||||
EQRawApplicationPacket *p=nullptr;
|
||||
|
||||
MInboundQueue.lock();
|
||||
if (InboundQueue.size()) {
|
||||
@ -995,7 +1015,8 @@ EQRawApplicationPacket *p=nullptr;
|
||||
|
||||
EQRawApplicationPacket *EQStream::PeekPacket()
|
||||
{
|
||||
EQRawApplicationPacket *p=nullptr;
|
||||
_eqp_mt
|
||||
EQRawApplicationPacket *p=nullptr;
|
||||
|
||||
MInboundQueue.lock();
|
||||
if (InboundQueue.size()) {
|
||||
@ -1009,7 +1030,8 @@ EQRawApplicationPacket *p=nullptr;
|
||||
|
||||
void EQStream::InboundQueueClear()
|
||||
{
|
||||
EQApplicationPacket *p=nullptr;
|
||||
_eqp_mt
|
||||
EQApplicationPacket *p=nullptr;
|
||||
|
||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Clearing inbound queue" __L);
|
||||
|
||||
@ -1027,7 +1049,8 @@ EQApplicationPacket *p=nullptr;
|
||||
|
||||
bool EQStream::HasOutgoingData()
|
||||
{
|
||||
bool flag;
|
||||
_eqp_mt
|
||||
bool flag;
|
||||
|
||||
//once closed, we have nothing more to say
|
||||
if(CheckClosed())
|
||||
@ -1052,7 +1075,8 @@ bool flag;
|
||||
|
||||
void EQStream::OutboundQueueClear()
|
||||
{
|
||||
EQProtocolPacket *p=nullptr;
|
||||
_eqp_mt
|
||||
EQProtocolPacket *p=nullptr;
|
||||
|
||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Clearing outbound queue" __L);
|
||||
|
||||
@ -1074,7 +1098,8 @@ EQProtocolPacket *p=nullptr;
|
||||
|
||||
void EQStream::PacketQueueClear()
|
||||
{
|
||||
EQProtocolPacket *p=nullptr;
|
||||
_eqp_mt
|
||||
EQProtocolPacket *p=nullptr;
|
||||
|
||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Clearing future packet queue" __L);
|
||||
|
||||
@ -1090,8 +1115,9 @@ EQProtocolPacket *p=nullptr;
|
||||
|
||||
void EQStream::Process(const unsigned char *buffer, const uint32 length)
|
||||
{
|
||||
static unsigned char newbuffer[2048];
|
||||
uint32 newlength=0;
|
||||
_eqp_mt
|
||||
static unsigned char newbuffer[2048];
|
||||
uint32 newlength=0;
|
||||
if (EQProtocolPacket::ValidateCRC(buffer,length,Key)) {
|
||||
if (compressed) {
|
||||
newlength=EQProtocolPacket::Decompress(buffer,length,newbuffer,2048);
|
||||
@ -1114,6 +1140,7 @@ uint32 newlength=0;
|
||||
|
||||
long EQStream::GetNextAckToSend()
|
||||
{
|
||||
_eqp_mt
|
||||
MAcks.lock();
|
||||
long l=NextAckToSend;
|
||||
MAcks.unlock();
|
||||
@ -1123,6 +1150,7 @@ long EQStream::GetNextAckToSend()
|
||||
|
||||
long EQStream::GetLastAckSent()
|
||||
{
|
||||
_eqp_mt
|
||||
MAcks.lock();
|
||||
long l=LastAckSent;
|
||||
MAcks.unlock();
|
||||
@ -1132,16 +1160,17 @@ long EQStream::GetLastAckSent()
|
||||
|
||||
void EQStream::AckPackets(uint16 seq)
|
||||
{
|
||||
std::deque<EQProtocolPacket *>::iterator itr, tmp;
|
||||
_eqp_mt
|
||||
std::deque<EQProtocolPacket *>::iterator itr, tmp;
|
||||
|
||||
MOutboundQueue.lock();
|
||||
//do a bit of sanity checking.
|
||||
if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) {
|
||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Pre-Ack Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq);
|
||||
}
|
||||
if(NextSequencedSend > SequencedQueue.size()) {
|
||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Pre-Ack Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size());
|
||||
}
|
||||
//do a bit of sanity checking.
|
||||
if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) {
|
||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Pre-Ack Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq);
|
||||
}
|
||||
if(NextSequencedSend > SequencedQueue.size()) {
|
||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Pre-Ack Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size());
|
||||
}
|
||||
|
||||
SeqOrder ord = CompareSequence(SequencedBase, seq);
|
||||
if(ord == SeqInOrder) {
|
||||
@ -1157,12 +1186,12 @@ if(NextSequencedSend > SequencedQueue.size()) {
|
||||
//this is a good ack, we get to ack some blocks.
|
||||
seq++; //we stop at the block right after their ack, counting on the wrap of both numbers.
|
||||
while(SequencedBase != seq) {
|
||||
if(SequencedQueue.empty()) {
|
||||
Log.Out(Logs::Detail, Logs::Netcode, _L "OUT OF PACKETS acked packet with sequence %lu. Next send is %d before this." __L, (unsigned long)SequencedBase, NextSequencedSend);
|
||||
SequencedBase = NextOutSeq;
|
||||
NextSequencedSend = 0;
|
||||
break;
|
||||
}
|
||||
if(SequencedQueue.empty()) {
|
||||
Log.Out(Logs::Detail, Logs::Netcode, _L "OUT OF PACKETS acked packet with sequence %lu. Next send is %d before this." __L, (unsigned long)SequencedBase, NextSequencedSend);
|
||||
SequencedBase = NextOutSeq;
|
||||
NextSequencedSend = 0;
|
||||
break;
|
||||
}
|
||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Removing acked packet with sequence %lu. Next send is %d before this." __L, (unsigned long)SequencedBase, NextSequencedSend);
|
||||
//clean out the acked packet
|
||||
delete SequencedQueue.front();
|
||||
@ -1173,12 +1202,12 @@ Log.Out(Logs::Detail, Logs::Netcode, _L "OUT OF PACKETS acked packet with sequen
|
||||
//advance the base sequence number to the seq of the block after the one we just got rid of.
|
||||
SequencedBase++;
|
||||
}
|
||||
if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) {
|
||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Post-Ack on %d Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, seq, SequencedBase, SequencedQueue.size(), NextOutSeq);
|
||||
}
|
||||
if(NextSequencedSend > SequencedQueue.size()) {
|
||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Post-Ack Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size());
|
||||
}
|
||||
if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) {
|
||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Post-Ack on %d Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, seq, SequencedBase, SequencedQueue.size(), NextOutSeq);
|
||||
}
|
||||
if(NextSequencedSend > SequencedQueue.size()) {
|
||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Post-Ack Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size());
|
||||
}
|
||||
}
|
||||
|
||||
MOutboundQueue.unlock();
|
||||
@ -1186,6 +1215,7 @@ if(NextSequencedSend > SequencedQueue.size()) {
|
||||
|
||||
void EQStream::SetNextAckToSend(uint32 seq)
|
||||
{
|
||||
_eqp_mt
|
||||
MAcks.lock();
|
||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Set Next Ack To Send to %lu" __L, (unsigned long)seq);
|
||||
NextAckToSend=seq;
|
||||
@ -1194,6 +1224,7 @@ void EQStream::SetNextAckToSend(uint32 seq)
|
||||
|
||||
void EQStream::SetLastAckSent(uint32 seq)
|
||||
{
|
||||
_eqp_mt
|
||||
MAcks.lock();
|
||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Set Last Ack Sent to %lu" __L, (unsigned long)seq);
|
||||
LastAckSent=seq;
|
||||
@ -1202,6 +1233,7 @@ void EQStream::SetLastAckSent(uint32 seq)
|
||||
|
||||
void EQStream::ProcessQueue()
|
||||
{
|
||||
_eqp_mt
|
||||
if(PacketQueue.empty()) {
|
||||
return;
|
||||
}
|
||||
@ -1217,8 +1249,9 @@ void EQStream::ProcessQueue()
|
||||
|
||||
EQProtocolPacket *EQStream::RemoveQueue(uint16 seq)
|
||||
{
|
||||
std::map<unsigned short,EQProtocolPacket *>::iterator itr;
|
||||
EQProtocolPacket *qp=nullptr;
|
||||
_eqp_mt
|
||||
std::map<unsigned short,EQProtocolPacket *>::iterator itr;
|
||||
EQProtocolPacket *qp=nullptr;
|
||||
if ((itr=PacketQueue.find(seq))!=PacketQueue.end()) {
|
||||
qp=itr->second;
|
||||
PacketQueue.erase(itr);
|
||||
@ -1229,6 +1262,7 @@ EQProtocolPacket *qp=nullptr;
|
||||
|
||||
void EQStream::SetStreamType(EQStreamType type)
|
||||
{
|
||||
_eqp_mt
|
||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Changing stream type from %s to %s" __L, StreamTypeString(StreamType), StreamTypeString(type));
|
||||
StreamType=type;
|
||||
switch (StreamType) {
|
||||
@ -1259,6 +1293,7 @@ void EQStream::SetStreamType(EQStreamType type)
|
||||
|
||||
const char *EQStream::StreamTypeString(EQStreamType t)
|
||||
{
|
||||
_eqp_mt
|
||||
switch (t) {
|
||||
case LoginStream:
|
||||
return "Login";
|
||||
@ -1288,6 +1323,7 @@ const char *EQStream::StreamTypeString(EQStreamType t)
|
||||
//returns SeqFuture if `seq` is later than `expected_seq`
|
||||
EQStream::SeqOrder EQStream::CompareSequence(uint16 expected_seq , uint16 seq)
|
||||
{
|
||||
_eqp_mt
|
||||
if (expected_seq==seq) {
|
||||
// Curent
|
||||
return SeqInOrder;
|
||||
@ -1301,6 +1337,7 @@ EQStream::SeqOrder EQStream::CompareSequence(uint16 expected_seq , uint16 seq)
|
||||
}
|
||||
|
||||
void EQStream::SetState(EQStreamState state) {
|
||||
_eqp_mt
|
||||
MState.lock();
|
||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Changing state from %d to %d" __L, State, state);
|
||||
State=state;
|
||||
@ -1309,7 +1346,7 @@ void EQStream::SetState(EQStreamState state) {
|
||||
|
||||
|
||||
void EQStream::CheckTimeout(uint32 now, uint32 timeout) {
|
||||
|
||||
_eqp_mt
|
||||
bool outgoing_data = HasOutgoingData(); //up here to avoid recursive locking
|
||||
|
||||
EQStreamState orig_state = GetState();
|
||||
@ -1348,6 +1385,7 @@ void EQStream::CheckTimeout(uint32 now, uint32 timeout) {
|
||||
|
||||
void EQStream::Decay()
|
||||
{
|
||||
_eqp_mt
|
||||
MRate.lock();
|
||||
uint32 rate=DecayRate;
|
||||
MRate.unlock();
|
||||
@ -1360,6 +1398,7 @@ void EQStream::Decay()
|
||||
|
||||
void EQStream::AdjustRates(uint32 average_delta)
|
||||
{
|
||||
_eqp_mt
|
||||
if(GetExecutablePlatform() == ExePlatformWorld || GetExecutablePlatform() == ExePlatformZone) {
|
||||
if (average_delta && (average_delta <= AVERAGE_DELTA_MAX)) {
|
||||
MRate.lock();
|
||||
@ -1385,6 +1424,7 @@ void EQStream::AdjustRates(uint32 average_delta)
|
||||
}
|
||||
|
||||
void EQStream::Close() {
|
||||
_eqp_mt
|
||||
if(HasOutgoingData()) {
|
||||
//there is pending data, wait for it to go out.
|
||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Stream requested to Close(), but there is pending data, waiting for it." __L);
|
||||
@ -1401,6 +1441,7 @@ void EQStream::Close() {
|
||||
//this could be expanded to check more than the fitst opcode if
|
||||
//we needed more complex matching
|
||||
EQStream::MatchState EQStream::CheckSignature(const Signature *sig) {
|
||||
_eqp_mt
|
||||
EQRawApplicationPacket *p = nullptr;
|
||||
MatchState res = MatchNotReady;
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
ThreadReturnType EQStreamFactoryReaderLoop(void *eqfs)
|
||||
{
|
||||
EQStreamFactory *fs=(EQStreamFactory *)eqfs;
|
||||
EQStreamFactory *fs = (EQStreamFactory*)eqfs;
|
||||
|
||||
#ifndef WIN32
|
||||
Log.Out(Logs::Detail, Logs::None, "Starting EQStreamFactoryReaderLoop with thread ID %d", pthread_self());
|
||||
@ -40,7 +40,7 @@ EQStreamFactory *fs=(EQStreamFactory *)eqfs;
|
||||
|
||||
ThreadReturnType EQStreamFactoryWriterLoop(void *eqfs)
|
||||
{
|
||||
EQStreamFactory *fs=(EQStreamFactory *)eqfs;
|
||||
EQStreamFactory *fs = (EQStreamFactory*)eqfs;
|
||||
|
||||
#ifndef WIN32
|
||||
Log.Out(Logs::Detail, Logs::None, "Starting EQStreamFactoryWriterLoop with thread ID %d", pthread_self());
|
||||
@ -65,6 +65,7 @@ EQStreamFactory::EQStreamFactory(EQStreamType type, int port, uint32 timeout)
|
||||
|
||||
void EQStreamFactory::Close()
|
||||
{
|
||||
_eqp_mt
|
||||
Stop();
|
||||
|
||||
#ifdef _WINDOWS
|
||||
@ -77,7 +78,8 @@ void EQStreamFactory::Close()
|
||||
|
||||
bool EQStreamFactory::Open()
|
||||
{
|
||||
struct sockaddr_in address;
|
||||
_eqp_mt
|
||||
struct sockaddr_in address;
|
||||
#ifndef WIN32
|
||||
pthread_t t1,t2;
|
||||
#endif
|
||||
@ -118,6 +120,7 @@ struct sockaddr_in address;
|
||||
|
||||
std::shared_ptr<EQStream> EQStreamFactory::Pop()
|
||||
{
|
||||
_eqp_mt
|
||||
std::shared_ptr<EQStream> s = nullptr;
|
||||
MNewStreams.lock();
|
||||
if (NewStreams.size()) {
|
||||
@ -132,6 +135,7 @@ std::shared_ptr<EQStream> EQStreamFactory::Pop()
|
||||
|
||||
void EQStreamFactory::Push(std::shared_ptr<EQStream> s)
|
||||
{
|
||||
_eqp_mt
|
||||
MNewStreams.lock();
|
||||
NewStreams.push(s);
|
||||
MNewStreams.unlock();
|
||||
@ -216,6 +220,7 @@ void EQStreamFactory::ReaderLoop()
|
||||
|
||||
void EQStreamFactory::CheckTimeout()
|
||||
{
|
||||
_eqp_mt
|
||||
//lock streams the entire time were checking timeouts, it should be fast.
|
||||
MStreams.lock();
|
||||
|
||||
|
||||
@ -89,6 +89,7 @@ EQEmuLogSys::~EQEmuLogSys()
|
||||
|
||||
void EQEmuLogSys::LoadLogSettingsDefaults()
|
||||
{
|
||||
_eqp_mt
|
||||
/* Get Executable platform currently running this code (Zone/World/etc) */
|
||||
log_platform = GetExecutablePlatformInt();
|
||||
|
||||
@ -96,6 +97,7 @@ void EQEmuLogSys::LoadLogSettingsDefaults()
|
||||
memset(log_settings, 0, sizeof(LogSettings) * Logs::LogCategory::MaxCategoryID);
|
||||
|
||||
/* Set Defaults */
|
||||
log_settings[Logs::LoginServer].log_to_console = Logs::General;
|
||||
log_settings[Logs::World_Server].log_to_console = Logs::General;
|
||||
log_settings[Logs::Zone_Server].log_to_console = Logs::General;
|
||||
log_settings[Logs::QS_Server].log_to_console = Logs::General;
|
||||
@ -116,12 +118,13 @@ void EQEmuLogSys::LoadLogSettingsDefaults()
|
||||
platform_file_name = "ucs";
|
||||
else if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformLogin)
|
||||
platform_file_name = "login";
|
||||
else if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformLogin)
|
||||
else if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformLaunch)
|
||||
platform_file_name = "launcher";
|
||||
}
|
||||
|
||||
std::string EQEmuLogSys::FormatOutMessageString(uint16 log_category, const std::string &in_message)
|
||||
{
|
||||
_eqp_mt
|
||||
std::string category_string;
|
||||
if (log_category > 0 && Logs::LogCategoryName[log_category])
|
||||
category_string = StringFormat("[%s] ", Logs::LogCategoryName[log_category]);
|
||||
@ -130,6 +133,7 @@ std::string EQEmuLogSys::FormatOutMessageString(uint16 log_category, const std::
|
||||
|
||||
void EQEmuLogSys::ProcessGMSay(uint16 debug_level, uint16 log_category, const std::string &message)
|
||||
{
|
||||
_eqp_mt
|
||||
/* Check if category enabled for process */
|
||||
if (log_settings[log_category].log_to_gmsay == 0)
|
||||
return;
|
||||
@ -149,6 +153,7 @@ void EQEmuLogSys::ProcessGMSay(uint16 debug_level, uint16 log_category, const st
|
||||
|
||||
void EQEmuLogSys::ProcessLogWrite(uint16 debug_level, uint16 log_category, const std::string &message)
|
||||
{
|
||||
_eqp_mt
|
||||
if (log_category == Logs::Crash) {
|
||||
char time_stamp[80];
|
||||
EQEmuLogSys::SetCurrentTimeStamp(time_stamp);
|
||||
@ -175,6 +180,7 @@ void EQEmuLogSys::ProcessLogWrite(uint16 debug_level, uint16 log_category, const
|
||||
}
|
||||
|
||||
uint16 EQEmuLogSys::GetWindowsConsoleColorFromCategory(uint16 log_category) {
|
||||
_eqp_mt
|
||||
switch (log_category) {
|
||||
case Logs::Status:
|
||||
case Logs::Normal:
|
||||
@ -198,6 +204,7 @@ uint16 EQEmuLogSys::GetWindowsConsoleColorFromCategory(uint16 log_category) {
|
||||
}
|
||||
|
||||
std::string EQEmuLogSys::GetLinuxConsoleColorFromCategory(uint16 log_category) {
|
||||
_eqp_mt
|
||||
switch (log_category) {
|
||||
case Logs::Status:
|
||||
case Logs::Normal:
|
||||
@ -221,6 +228,7 @@ std::string EQEmuLogSys::GetLinuxConsoleColorFromCategory(uint16 log_category) {
|
||||
}
|
||||
|
||||
uint16 EQEmuLogSys::GetGMSayColorFromCategory(uint16 log_category) {
|
||||
_eqp_mt
|
||||
switch (log_category) {
|
||||
case Logs::Status:
|
||||
case Logs::Normal:
|
||||
@ -245,6 +253,7 @@ uint16 EQEmuLogSys::GetGMSayColorFromCategory(uint16 log_category) {
|
||||
|
||||
void EQEmuLogSys::ProcessConsoleMessage(uint16 debug_level, uint16 log_category, const std::string &message)
|
||||
{
|
||||
_eqp_mt
|
||||
/* Check if category enabled for process */
|
||||
if (log_settings[log_category].log_to_console == 0)
|
||||
return;
|
||||
@ -272,6 +281,7 @@ void EQEmuLogSys::ProcessConsoleMessage(uint16 debug_level, uint16 log_category,
|
||||
|
||||
void EQEmuLogSys::Out(Logs::DebugLevel debug_level, uint16 log_category, std::string message, ...)
|
||||
{
|
||||
_eqp_mt
|
||||
const bool log_to_console = log_settings[log_category].log_to_console > 0;
|
||||
const bool log_to_file = log_settings[log_category].log_to_file > 0;
|
||||
const bool log_to_gmsay = log_settings[log_category].log_to_gmsay > 0;
|
||||
@ -293,6 +303,7 @@ void EQEmuLogSys::Out(Logs::DebugLevel debug_level, uint16 log_category, std::st
|
||||
|
||||
void EQEmuLogSys::SetCurrentTimeStamp(char* time_stamp)
|
||||
{
|
||||
_eqp_mt
|
||||
time_t raw_time;
|
||||
struct tm * time_info;
|
||||
time(&raw_time);
|
||||
@ -302,6 +313,7 @@ void EQEmuLogSys::SetCurrentTimeStamp(char* time_stamp)
|
||||
|
||||
void EQEmuLogSys::MakeDirectory(const std::string &directory_name)
|
||||
{
|
||||
_eqp_mt
|
||||
#ifdef _WINDOWS
|
||||
struct _stat st;
|
||||
if (_stat(directory_name.c_str(), &st) == 0) // exists
|
||||
@ -317,6 +329,7 @@ void EQEmuLogSys::MakeDirectory(const std::string &directory_name)
|
||||
|
||||
void EQEmuLogSys::CloseFileLogs()
|
||||
{
|
||||
_eqp_mt
|
||||
if (process_log.is_open()) {
|
||||
process_log.close();
|
||||
}
|
||||
@ -324,6 +337,7 @@ void EQEmuLogSys::CloseFileLogs()
|
||||
|
||||
void EQEmuLogSys::StartFileLogs(const std::string &log_name)
|
||||
{
|
||||
_eqp_mt
|
||||
EQEmuLogSys::CloseFileLogs();
|
||||
|
||||
/* When loading settings, we must have been given a reason in category based logging to output to a file in order to even create or open one... */
|
||||
|
||||
@ -48,12 +48,14 @@ namespace Logs {
|
||||
Combat,
|
||||
Commands,
|
||||
Crash,
|
||||
Database,
|
||||
Debug,
|
||||
Doors,
|
||||
Error,
|
||||
Guilds,
|
||||
Inventory,
|
||||
Launcher,
|
||||
LoginServer,
|
||||
Netcode,
|
||||
Normal,
|
||||
Object,
|
||||
@ -92,12 +94,14 @@ namespace Logs {
|
||||
"Combat",
|
||||
"Commands",
|
||||
"Crash",
|
||||
"Database",
|
||||
"Debug",
|
||||
"Doors",
|
||||
"Error",
|
||||
"Guilds",
|
||||
"Inventory",
|
||||
"Launcher",
|
||||
"LoginServer",
|
||||
"Netcode",
|
||||
"Normal",
|
||||
"Object",
|
||||
@ -118,10 +122,10 @@ namespace Logs {
|
||||
"WebInterface Server",
|
||||
"World Server",
|
||||
"Zone Server",
|
||||
"MySQL Error",
|
||||
"MySQL Query",
|
||||
"MySQLError",
|
||||
"MySQLQuery",
|
||||
"Mercenaries",
|
||||
"Quest Debug"
|
||||
"QuestDebug"
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -43,7 +43,7 @@ void TimeoutManager::CheckTimeouts() {
|
||||
Timeoutable *it = *cur;
|
||||
if(it->next_check.Check()) {
|
||||
#ifdef TIMEOUT_DEBUG
|
||||
Log.Out(Logs::General, Logs::None,, "Checking timeout on 0x%x\n", it);
|
||||
Log.Out(Logs::General, Logs::None, "Checking timeout on 0x%x\n", it);
|
||||
#endif
|
||||
it->CheckTimeout();
|
||||
}
|
||||
@ -58,13 +58,13 @@ void TimeoutManager::AddMember(Timeoutable *who) {
|
||||
DeleteMember(who); //just in case... prolly not needed.
|
||||
members.push_back(who);
|
||||
#ifdef TIMEOUT_DEBUG
|
||||
Log.Out(Logs::General, Logs::None,, "Adding timeoutable 0x%x\n", who);
|
||||
Log.Out(Logs::General, Logs::None, "Adding timeoutable 0x%x\n", who);
|
||||
#endif
|
||||
}
|
||||
|
||||
void TimeoutManager::DeleteMember(Timeoutable *who) {
|
||||
#ifdef TIMEOUT_DEBUG
|
||||
Log.Out(Logs::General, Logs::None,, "Removing timeoutable 0x%x\n", who);
|
||||
Log.Out(Logs::General, Logs::None, "Removing timeoutable 0x%x\n", who);
|
||||
#endif
|
||||
std::vector<Timeoutable *>::iterator cur,end;
|
||||
cur = members.begin();
|
||||
|
||||
@ -15,7 +15,7 @@ ADD_EXECUTABLE(eqlaunch ${eqlaunch_sources} ${eqlaunch_headers})
|
||||
|
||||
INSTALL(TARGETS eqlaunch RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
|
||||
TARGET_LINK_LIBRARIES(eqlaunch common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY})
|
||||
TARGET_LINK_LIBRARIES(eqlaunch common ${PERF_LIBS} debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY})
|
||||
|
||||
IF(MSVC)
|
||||
SET_TARGET_PROPERTIES(eqlaunch PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF")
|
||||
|
||||
@ -67,7 +67,7 @@ void EQP::CPU::ST::Profiler::Clear() {
|
||||
current_ = root_;
|
||||
}
|
||||
|
||||
void EQP::CPU::ST::Profiler::Dump(std::ostream &stream) {
|
||||
void EQP::CPU::ST::Profiler::Dump(std::ostream &stream, int num) {
|
||||
uint64_t total = 0;
|
||||
std::vector<ProfilerNodeDump> sorted_vec;
|
||||
sorted_vec.reserve(root_->GetNodes().size() + 1);
|
||||
@ -77,14 +77,21 @@ void EQP::CPU::ST::Profiler::Dump(std::ostream &stream) {
|
||||
n.name = iter.first;
|
||||
n.node = iter.second;
|
||||
sorted_vec.push_back(n);
|
||||
|
||||
total += iter.second->GetTime();
|
||||
}
|
||||
|
||||
std::sort(sorted_vec.begin(), sorted_vec.end(),
|
||||
[](const ProfilerNodeDump& a, const ProfilerNodeDump& b) { return a.node->GetTime() > b.node->GetTime(); });
|
||||
|
||||
int i = 0;
|
||||
for(auto &iter : sorted_vec) {
|
||||
iter.node->Dump(stream, iter.name, total, 0);
|
||||
if(num > 0 && i >= num) {
|
||||
break;
|
||||
}
|
||||
|
||||
iter.node->Dump(stream, iter.name, total, 0, num);
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
@ -164,7 +171,7 @@ void EQP::CPU::MT::Profiler::Clear() {
|
||||
imp_->lock_.unlock();
|
||||
}
|
||||
|
||||
void EQP::CPU::MT::Profiler::Dump(std::ostream &stream) {
|
||||
void EQP::CPU::MT::Profiler::Dump(std::ostream &stream, int num) {
|
||||
imp_->lock_.lock();
|
||||
for(auto &iter : imp_->nodes_) {
|
||||
stream << "Thread: " << iter.first << std::endl;
|
||||
@ -177,14 +184,20 @@ void EQP::CPU::MT::Profiler::Dump(std::ostream &stream) {
|
||||
n.name = t_iter.first;
|
||||
n.node = t_iter.second;
|
||||
sorted_vec.push_back(n);
|
||||
|
||||
total += t_iter.second->GetTime();
|
||||
}
|
||||
|
||||
std::sort(sorted_vec.begin(), sorted_vec.end(),
|
||||
[](const ProfilerNodeDump& a, const ProfilerNodeDump& b) { return a.node->GetTime() > b.node->GetTime(); });
|
||||
|
||||
int i = 0;
|
||||
for(auto &t_iter : sorted_vec) {
|
||||
t_iter.node->Dump(stream, t_iter.name, total, 1);
|
||||
if(num > 0 && i >= num) {
|
||||
break;
|
||||
}
|
||||
t_iter.node->Dump(stream, t_iter.name, total, 1, num);
|
||||
++i;
|
||||
}
|
||||
|
||||
stream << std::endl;
|
||||
|
||||
@ -29,7 +29,7 @@ namespace EQP
|
||||
void EventStarted(const char *func, const char *name);
|
||||
void EventFinished(uint64_t time);
|
||||
void Clear();
|
||||
void Dump(std::ostream &stream);
|
||||
void Dump(std::ostream &stream, int num = 0);
|
||||
private:
|
||||
Node *root_;
|
||||
Node *current_;
|
||||
@ -57,7 +57,7 @@ namespace EQP
|
||||
void EventStarted(const char *func, const char *name);
|
||||
void EventFinished(uint64_t time);
|
||||
void Clear();
|
||||
void Dump(std::ostream &stream);
|
||||
void Dump(std::ostream &stream, int num = 0);
|
||||
private:
|
||||
struct impl;
|
||||
impl *imp_;
|
||||
|
||||
@ -15,7 +15,7 @@ EQP::CPU::ProfilerNode::~ProfilerNode() {
|
||||
}
|
||||
}
|
||||
|
||||
void EQP::CPU::ProfilerNode::Dump(std::ostream &stream, const std::string &func, uint64_t total_time, int node_level) {
|
||||
void EQP::CPU::ProfilerNode::Dump(std::ostream &stream, const std::string &func, uint64_t total_time, int node_level, int num) {
|
||||
|
||||
if(node_level >= 1) {
|
||||
stream << std::setw(node_level * 2) << " ";
|
||||
@ -48,7 +48,12 @@ void EQP::CPU::ProfilerNode::Dump(std::ostream &stream, const std::string &func,
|
||||
std::sort(sorted_vec.begin(), sorted_vec.end(),
|
||||
[](const ProfilerNodeDump& a, const ProfilerNodeDump& b) { return a.node->GetTime() > b.node->GetTime(); });
|
||||
|
||||
int i = 0;
|
||||
for(auto &iter : sorted_vec) {
|
||||
iter.node->Dump(stream, iter.name, total_time, node_level + 1);
|
||||
if(num > 0 && i >= num) {
|
||||
break;
|
||||
}
|
||||
iter.node->Dump(stream, iter.name, total_time, node_level + 1, num);
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ namespace EQP
|
||||
|
||||
inline std::unordered_map<std::string, ProfilerNode*>& GetNodes() { return nodes_; }
|
||||
|
||||
void Dump(std::ostream &stream, const std::string &func, uint64_t total_time, int node_level);
|
||||
void Dump(std::ostream &stream, const std::string &func, uint64_t total_time, int node_level, int num);
|
||||
private:
|
||||
uint64_t count_;
|
||||
uint64_t time_;
|
||||
|
||||
@ -20,13 +20,13 @@
|
||||
#include "login_server.h"
|
||||
#include "login_structures.h"
|
||||
#include "../common/misc_functions.h"
|
||||
#include "../common/eqemu_logsys.h"
|
||||
|
||||
extern ErrorLog *server_log;
|
||||
extern LoginServer server;
|
||||
|
||||
Client::Client(std::shared_ptr<EQStream> c, LSClientVersion v)
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt
|
||||
connection = c;
|
||||
version = v;
|
||||
status = cs_not_sent_session_ready;
|
||||
@ -37,13 +37,13 @@ Client::Client(std::shared_ptr<EQStream> c, LSClientVersion v)
|
||||
|
||||
bool Client::Process()
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt
|
||||
EQApplicationPacket *app = connection->PopPacket();
|
||||
while(app)
|
||||
{
|
||||
if(server.options.IsTraceOn())
|
||||
{
|
||||
server_log->Log(log_network, "Application packet received from client (size %u)", app->Size());
|
||||
Log.Out(Logs::General, Logs::Netcode, "Application packet received from client (size %u)", app->Size());
|
||||
}
|
||||
|
||||
if(server.options.IsDumpInPacketsOn())
|
||||
@ -57,7 +57,7 @@ bool Client::Process()
|
||||
{
|
||||
if(server.options.IsTraceOn())
|
||||
{
|
||||
server_log->Log(log_network, "Session ready received from client.");
|
||||
Log.Out(Logs::General, Logs::Netcode, "Session ready received from client.");
|
||||
}
|
||||
Handle_SessionReady((const char*)app->pBuffer, app->Size());
|
||||
break;
|
||||
@ -66,13 +66,13 @@ bool Client::Process()
|
||||
{
|
||||
if(app->Size() < 20)
|
||||
{
|
||||
server_log->Log(log_network_error, "Login received but it is too small, discarding.");
|
||||
Log.Out(Logs::General, Logs::Netcode, "Login received but it is too small, discarding.");
|
||||
break;
|
||||
}
|
||||
|
||||
if(server.options.IsTraceOn())
|
||||
{
|
||||
server_log->Log(log_network, "Login received from client.");
|
||||
Log.Out(Logs::General, Logs::Netcode, "Login received from client.");
|
||||
}
|
||||
|
||||
Handle_Login((const char*)app->pBuffer, app->Size());
|
||||
@ -82,7 +82,7 @@ bool Client::Process()
|
||||
{
|
||||
if(server.options.IsTraceOn())
|
||||
{
|
||||
server_log->Log(log_network, "Server list request received from client.");
|
||||
Log.Out(Logs::General, Logs::Netcode, "Server list request received from client.");
|
||||
}
|
||||
|
||||
SendServerListPacket();
|
||||
@ -92,7 +92,7 @@ bool Client::Process()
|
||||
{
|
||||
if(app->Size() < sizeof(PlayEverquestRequest_Struct))
|
||||
{
|
||||
server_log->Log(log_network_error, "Play received but it is too small, discarding.");
|
||||
Log.Out(Logs::General, Logs::Netcode, "Play received but it is too small, discarding.");
|
||||
break;
|
||||
}
|
||||
|
||||
@ -103,7 +103,7 @@ bool Client::Process()
|
||||
{
|
||||
char dump[64];
|
||||
app->build_header_dump(dump);
|
||||
server_log->Log(log_network_error, "Recieved unhandled application packet from the client: %s.", dump);
|
||||
Log.Out(Logs::General, Logs::Netcode, "Recieved unhandled application packet from the client: %s.", dump);
|
||||
}
|
||||
}
|
||||
|
||||
@ -116,23 +116,23 @@ bool Client::Process()
|
||||
|
||||
void Client::Handle_SessionReady(const char* data, unsigned int size)
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt
|
||||
if(status != cs_not_sent_session_ready)
|
||||
{
|
||||
server_log->Log(log_network_error, "Session ready received again after already being received.");
|
||||
Log.Out(Logs::General, Logs::Netcode, "Session ready received again after already being received.");
|
||||
return;
|
||||
}
|
||||
|
||||
if(size < sizeof(unsigned int))
|
||||
{
|
||||
server_log->Log(log_network_error, "Session ready was too small.");
|
||||
Log.Out(Logs::General, Logs::Netcode, "Session ready was too small.");
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned int mode = *((unsigned int*)data);
|
||||
if(mode == (unsigned int)lm_from_world)
|
||||
{
|
||||
server_log->Log(log_network, "Session ready indicated logged in from world(unsupported feature), disconnecting.");
|
||||
Log.Out(Logs::General, Logs::Netcode, "Session ready indicated logged in from world(unsupported feature), disconnecting.");
|
||||
connection->Close();
|
||||
return;
|
||||
}
|
||||
@ -178,16 +178,16 @@ void Client::Handle_SessionReady(const char* data, unsigned int size)
|
||||
|
||||
void Client::Handle_Login(const char* data, unsigned int size)
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt
|
||||
if(status != cs_waiting_for_login)
|
||||
{
|
||||
server_log->Log(log_network_error, "Login received after already having logged in.");
|
||||
Log.Out(Logs::General, Logs::Netcode, "Login received after already having logged in.");
|
||||
return;
|
||||
}
|
||||
|
||||
if((size - 12) % 8 != 0)
|
||||
{
|
||||
server_log->Log(log_network_error, "Login received packet of size: %u, this would cause a block corruption, discarding.", size);
|
||||
Log.Out(Logs::General, Logs::Netcode, "Login received packet of size: %u, this would cause a block corruption, discarding.", size);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -208,8 +208,8 @@ void Client::Handle_Login(const char* data, unsigned int size)
|
||||
|
||||
if(server.options.IsTraceOn())
|
||||
{
|
||||
server_log->Log(log_client, "User: %s", e_user.c_str());
|
||||
server_log->Log(log_client, "Hash: %s", e_hash.c_str());
|
||||
Log.Out(Logs::General, Logs::LoginServer, "User: %s", e_user.c_str());
|
||||
Log.Out(Logs::General, Logs::LoginServer, "Hash: %s", e_hash.c_str());
|
||||
}
|
||||
|
||||
server.eq_crypto->DeleteHeap(e_buffer);
|
||||
@ -222,8 +222,8 @@ void Client::Handle_Login(const char* data, unsigned int size)
|
||||
|
||||
if(server.options.IsTraceOn())
|
||||
{
|
||||
server_log->Log(log_client, "User: %s", e_user.c_str());
|
||||
server_log->Log(log_client, "Hash: %s", e_hash.c_str());
|
||||
Log.Out(Logs::General, Logs::LoginServer, "User: %s", e_user.c_str());
|
||||
Log.Out(Logs::General, Logs::LoginServer, "Hash: %s", e_hash.c_str());
|
||||
}
|
||||
|
||||
_HeapDeleteCharBuffer(e_buffer);
|
||||
@ -232,7 +232,7 @@ void Client::Handle_Login(const char* data, unsigned int size)
|
||||
bool result;
|
||||
if(server.db->GetLoginDataFromAccountName(e_user, d_pass_hash, d_account_id) == false)
|
||||
{
|
||||
server_log->Log(log_client_error, "Error logging in, user %s does not exist in the database.", e_user.c_str());
|
||||
Log.Out(Logs::General, Logs::Error, "Error logging in, user %s does not exist in the database.", e_user.c_str());
|
||||
result = false;
|
||||
}
|
||||
else
|
||||
@ -333,10 +333,10 @@ void Client::Handle_Login(const char* data, unsigned int size)
|
||||
|
||||
void Client::Handle_Play(const char* data)
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt
|
||||
if(status != cs_logged_in)
|
||||
{
|
||||
server_log->Log(log_client_error, "Client sent a play request when they either were not logged in, discarding.");
|
||||
Log.Out(Logs::General, Logs::Error, "Client sent a play request when they either were not logged in, discarding.");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -346,7 +346,7 @@ void Client::Handle_Play(const char* data)
|
||||
|
||||
if(server.options.IsTraceOn())
|
||||
{
|
||||
server_log->Log(log_network, "Play received from client, server number %u sequence %u.", server_id_in, sequence_in);
|
||||
Log.Out(Logs::General, Logs::Netcode, "Play received from client, server number %u sequence %u.", server_id_in, sequence_in);
|
||||
}
|
||||
|
||||
this->play_server_id = (unsigned int)play->ServerNumber;
|
||||
@ -357,7 +357,7 @@ void Client::Handle_Play(const char* data)
|
||||
|
||||
void Client::SendServerListPacket()
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt
|
||||
EQApplicationPacket *outapp = server.SM->CreateServerListPacket(this);
|
||||
|
||||
if(server.options.IsDumpOutPacketsOn())
|
||||
@ -371,11 +371,11 @@ void Client::SendServerListPacket()
|
||||
|
||||
void Client::SendPlayResponse(EQApplicationPacket *outapp)
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt
|
||||
if(server.options.IsTraceOn())
|
||||
{
|
||||
server_log->Log(log_network_trace, "Sending play response for %s.", GetAccountName().c_str());
|
||||
server_log->LogPacket(log_network_trace, (const char*)outapp->pBuffer, outapp->size);
|
||||
Log.Out(Logs::Detail, Logs::Netcode, "Sending play response for %s.", GetAccountName().c_str());
|
||||
//server_log->LogPacket(log_network_trace, (const char*)outapp->pBuffer, outapp->size);
|
||||
}
|
||||
connection->QueuePacket(outapp);
|
||||
status = cs_logged_in;
|
||||
@ -383,7 +383,7 @@ void Client::SendPlayResponse(EQApplicationPacket *outapp)
|
||||
|
||||
void Client::GenerateKey()
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt
|
||||
key.clear();
|
||||
int count = 0;
|
||||
while(count < 10)
|
||||
|
||||
@ -18,31 +18,31 @@
|
||||
#include "client_manager.h"
|
||||
#include "error_log.h"
|
||||
#include "login_server.h"
|
||||
#include "../common/eqemu_logsys.h"
|
||||
|
||||
extern ErrorLog *server_log;
|
||||
extern LoginServer server;
|
||||
extern bool run_server;
|
||||
|
||||
ClientManager::ClientManager()
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt
|
||||
int titanium_port = atoi(server.config->GetVariable("Titanium", "port").c_str());
|
||||
titanium_stream = new EQStreamFactory(LoginStream, titanium_port);
|
||||
titanium_ops = new RegularOpcodeManager;
|
||||
if(!titanium_ops->LoadOpcodes(server.config->GetVariable("Titanium", "opcodes").c_str()))
|
||||
{
|
||||
server_log->Log(log_error, "ClientManager fatal error: couldn't load opcodes for Titanium file %s.",
|
||||
Log.Out(Logs::Detail, Logs::Error, "ClientManager fatal error: couldn't load opcodes for Titanium file %s.",
|
||||
server.config->GetVariable("Titanium", "opcodes").c_str());
|
||||
run_server = false;
|
||||
}
|
||||
|
||||
if(titanium_stream->Open())
|
||||
{
|
||||
server_log->Log(log_network, "ClientManager listening on Titanium stream.");
|
||||
Log.Out(Logs::General, Logs::Netcode, "ClientManager listening on Titanium stream.");
|
||||
}
|
||||
else
|
||||
{
|
||||
server_log->Log(log_error, "ClientManager fatal error: couldn't open Titanium stream.");
|
||||
Log.Out(Logs::Detail, Logs::Error, "ClientManager fatal error: couldn't open Titanium stream.");
|
||||
run_server = false;
|
||||
}
|
||||
|
||||
@ -51,25 +51,25 @@ ClientManager::ClientManager()
|
||||
sod_ops = new RegularOpcodeManager;
|
||||
if(!sod_ops->LoadOpcodes(server.config->GetVariable("SoD", "opcodes").c_str()))
|
||||
{
|
||||
server_log->Log(log_error, "ClientManager fatal error: couldn't load opcodes for SoD file %s.",
|
||||
Log.Out(Logs::Detail, Logs::Error, "ClientManager fatal error: couldn't load opcodes for SoD file %s.",
|
||||
server.config->GetVariable("SoD", "opcodes").c_str());
|
||||
run_server = false;
|
||||
}
|
||||
|
||||
if(sod_stream->Open())
|
||||
{
|
||||
server_log->Log(log_network, "ClientManager listening on SoD stream.");
|
||||
Log.Out(Logs::General, Logs::Netcode, "ClientManager listening on SoD stream.");
|
||||
}
|
||||
else
|
||||
{
|
||||
server_log->Log(log_error, "ClientManager fatal error: couldn't open SoD stream.");
|
||||
Log.Out(Logs::Detail, Logs::Error, "ClientManager fatal error: couldn't open SoD stream.");
|
||||
run_server = false;
|
||||
}
|
||||
}
|
||||
|
||||
ClientManager::~ClientManager()
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt
|
||||
if(titanium_stream)
|
||||
{
|
||||
titanium_stream->Close();
|
||||
@ -95,14 +95,14 @@ ClientManager::~ClientManager()
|
||||
|
||||
void ClientManager::Process()
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt
|
||||
ProcessDisconnect();
|
||||
std::shared_ptr<EQStream> cur = titanium_stream->Pop();
|
||||
while(cur)
|
||||
{
|
||||
struct in_addr in;
|
||||
in.s_addr = cur->GetRemoteIP();
|
||||
server_log->Log(log_network, "New Titanium client connection from %s:%d", inet_ntoa(in), ntohs(cur->GetRemotePort()));
|
||||
Log.Out(Logs::General, Logs::Netcode, "New Titanium client connection from %s:%d", inet_ntoa(in), ntohs(cur->GetRemotePort()));
|
||||
|
||||
cur->SetOpcodeManager(&titanium_ops);
|
||||
Client *c = new Client(cur, cv_titanium);
|
||||
@ -115,7 +115,7 @@ void ClientManager::Process()
|
||||
{
|
||||
struct in_addr in;
|
||||
in.s_addr = cur->GetRemoteIP();
|
||||
server_log->Log(log_network, "New SoD client connection from %s:%d", inet_ntoa(in), ntohs(cur->GetRemotePort()));
|
||||
Log.Out(Logs::General, Logs::Netcode, "New SoD client connection from %s:%d", inet_ntoa(in), ntohs(cur->GetRemotePort()));
|
||||
|
||||
cur->SetOpcodeManager(&sod_ops);
|
||||
Client *c = new Client(cur, cv_sod);
|
||||
@ -128,7 +128,7 @@ void ClientManager::Process()
|
||||
{
|
||||
if((*iter)->Process() == false)
|
||||
{
|
||||
server_log->Log(log_client, "Client had a fatal error and had to be removed from the login.");
|
||||
Log.Out(Logs::General, Logs::LoginServer, "Client had a fatal error and had to be removed from the login.");
|
||||
delete (*iter);
|
||||
iter = clients.erase(iter);
|
||||
}
|
||||
@ -141,14 +141,14 @@ void ClientManager::Process()
|
||||
|
||||
void ClientManager::ProcessDisconnect()
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt
|
||||
list<Client*>::iterator iter = clients.begin();
|
||||
while(iter != clients.end())
|
||||
{
|
||||
std::shared_ptr<EQStream> c = (*iter)->GetConnection();
|
||||
if(c->CheckClosed())
|
||||
{
|
||||
server_log->Log(log_network, "Client disconnected from the server, removing client.");
|
||||
Log.Out(Logs::General, Logs::Netcode, "Client disconnected from the server, removing client.");
|
||||
delete (*iter);
|
||||
iter = clients.erase(iter);
|
||||
}
|
||||
@ -161,7 +161,7 @@ void ClientManager::ProcessDisconnect()
|
||||
|
||||
void ClientManager::UpdateServerList()
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt
|
||||
list<Client*>::iterator iter = clients.begin();
|
||||
while(iter != clients.end())
|
||||
{
|
||||
@ -172,13 +172,13 @@ void ClientManager::UpdateServerList()
|
||||
|
||||
void ClientManager::RemoveExistingClient(unsigned int account_id)
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt
|
||||
list<Client*>::iterator iter = clients.begin();
|
||||
while(iter != clients.end())
|
||||
{
|
||||
if((*iter)->GetAccountID() == account_id)
|
||||
{
|
||||
server_log->Log(log_network, "Client attempting to log in and existing client already logged in, removing existing client.");
|
||||
Log.Out(Logs::General, Logs::Netcode, "Client attempting to log in and existing client already logged in, removing existing client.");
|
||||
delete (*iter);
|
||||
iter = clients.erase(iter);
|
||||
}
|
||||
@ -191,7 +191,7 @@ void ClientManager::RemoveExistingClient(unsigned int account_id)
|
||||
|
||||
Client *ClientManager::GetClient(unsigned int account_id)
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt
|
||||
Client *cur = nullptr;
|
||||
int count = 0;
|
||||
list<Client*>::iterator iter = clients.begin();
|
||||
@ -207,7 +207,7 @@ Client *ClientManager::GetClient(unsigned int account_id)
|
||||
|
||||
if(count > 1)
|
||||
{
|
||||
server_log->Log(log_client_error, "More than one client with a given account_id existed in the client list.");
|
||||
Log.Out(Logs::General, Logs::Error, "More than one client with a given account_id existed in the client list.");
|
||||
}
|
||||
return cur;
|
||||
}
|
||||
|
||||
@ -18,8 +18,8 @@
|
||||
#include "../common/global_define.h"
|
||||
#include "config.h"
|
||||
#include "error_log.h"
|
||||
#include "../common/eqemu_logsys.h"
|
||||
|
||||
extern ErrorLog *server_log;
|
||||
/**
|
||||
* Retrieves the variable we want from our title or theme
|
||||
* First gets the map from the title
|
||||
@ -27,7 +27,7 @@ extern ErrorLog *server_log;
|
||||
*/
|
||||
std::string Config::GetVariable(std::string title, std::string parameter)
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt
|
||||
std::map<std::string, std::map<std::string, std::string> >::iterator iter = vars.find(title);
|
||||
if(iter != vars.end())
|
||||
{
|
||||
@ -47,10 +47,10 @@ std::string Config::GetVariable(std::string title, std::string parameter)
|
||||
*/
|
||||
void Config::Parse(const char *file_name)
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt
|
||||
if(file_name == nullptr)
|
||||
{
|
||||
server_log->Log(log_error, "Config::Parse(), file_name passed was null.");
|
||||
Log.Out(Logs::Detail, Logs::Error, "Config::Parse(), file_name passed was null.");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -73,7 +73,7 @@ void Config::Parse(const char *file_name)
|
||||
++iter;
|
||||
if(iter == tokens.end())
|
||||
{
|
||||
server_log->Log(log_error, "Config::Parse(), EOF before title done parsing.");
|
||||
Log.Out(Logs::Detail, Logs::Error, "Config::Parse(), EOF before title done parsing.");
|
||||
fclose(input);
|
||||
vars.clear();
|
||||
return;
|
||||
@ -106,7 +106,7 @@ void Config::Parse(const char *file_name)
|
||||
mode++;
|
||||
if((*iter).compare("=") != 0)
|
||||
{
|
||||
server_log->Log(log_error, "Config::Parse(), invalid parse token where = should be.");
|
||||
Log.Out(Logs::Detail, Logs::Error, "Config::Parse(), invalid parse token where = should be.");
|
||||
fclose(input);
|
||||
vars.clear();
|
||||
return;
|
||||
@ -135,7 +135,7 @@ void Config::Parse(const char *file_name)
|
||||
}
|
||||
else
|
||||
{
|
||||
server_log->Log(log_error, "Config::Parse(), file was unable to be opened for parsing.");
|
||||
Log.Out(Logs::Detail, Logs::Error, "Config::Parse(), file was unable to be opened for parsing.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -146,7 +146,7 @@ void Config::Parse(const char *file_name)
|
||||
*/
|
||||
void Config::Tokenize(FILE *input, std::list<std::string> &tokens)
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt
|
||||
char c = fgetc(input);
|
||||
std::string lexeme;
|
||||
|
||||
|
||||
@ -22,15 +22,15 @@
|
||||
#include "database_mysql.h"
|
||||
#include "error_log.h"
|
||||
#include "login_server.h"
|
||||
#include "../common/eqemu_logsys.h"
|
||||
|
||||
extern ErrorLog *server_log;
|
||||
extern LoginServer server;
|
||||
|
||||
#pragma comment(lib, "mysqlclient.lib")
|
||||
|
||||
DatabaseMySQL::DatabaseMySQL(string user, string pass, string host, string port, string name)
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt
|
||||
this->user = user;
|
||||
this->pass = pass;
|
||||
this->host = host;
|
||||
@ -44,19 +44,19 @@ DatabaseMySQL::DatabaseMySQL(string user, string pass, string host, string port,
|
||||
if(!mysql_real_connect(db, host.c_str(), user.c_str(), pass.c_str(), name.c_str(), atoi(port.c_str()), nullptr, 0))
|
||||
{
|
||||
mysql_close(db);
|
||||
server_log->Log(log_database, "Failed to connect to MySQL database. Error: %s", mysql_error(db));
|
||||
Log.Out(Logs::General, Logs::Database,"Failed to connect to MySQL database. Error: %s", mysql_error(db));
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
server_log->Log(log_database, "Failed to create db object in MySQL database.");
|
||||
Log.Out(Logs::General, Logs::Database,"Failed to create db object in MySQL database.");
|
||||
}
|
||||
}
|
||||
|
||||
DatabaseMySQL::~DatabaseMySQL()
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt
|
||||
if(db)
|
||||
{
|
||||
mysql_close(db);
|
||||
@ -65,7 +65,7 @@ DatabaseMySQL::~DatabaseMySQL()
|
||||
|
||||
bool DatabaseMySQL::GetLoginDataFromAccountName(string name, string &password, unsigned int &id)
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt
|
||||
if(!db)
|
||||
{
|
||||
return false;
|
||||
@ -80,7 +80,7 @@ bool DatabaseMySQL::GetLoginDataFromAccountName(string name, string &password, u
|
||||
|
||||
if(mysql_query(db, query.str().c_str()) != 0)
|
||||
{
|
||||
server_log->Log(log_database, "Mysql query failed: %s", query.str().c_str());
|
||||
Log.Out(Logs::General, Logs::Database,"Mysql query failed: %s", query.str().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -97,14 +97,14 @@ bool DatabaseMySQL::GetLoginDataFromAccountName(string name, string &password, u
|
||||
}
|
||||
}
|
||||
|
||||
server_log->Log(log_database, "Mysql query returned no result: %s", query.str().c_str());
|
||||
Log.Out(Logs::General, Logs::Database,"Mysql query returned no result: %s", query.str().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DatabaseMySQL::GetWorldRegistration(string long_name, string short_name, unsigned int &id, string &desc, unsigned int &list_id,
|
||||
unsigned int &trusted, string &list_desc, string &account, string &password)
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt
|
||||
if(!db)
|
||||
{
|
||||
return false;
|
||||
@ -126,7 +126,7 @@ bool DatabaseMySQL::GetWorldRegistration(string long_name, string short_name, un
|
||||
|
||||
if(mysql_query(db, query.str().c_str()) != 0)
|
||||
{
|
||||
server_log->Log(log_database, "Mysql query failed: %s", query.str().c_str());
|
||||
Log.Out(Logs::General, Logs::Database,"Mysql query failed: %s", query.str().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -151,7 +151,7 @@ bool DatabaseMySQL::GetWorldRegistration(string long_name, string short_name, un
|
||||
|
||||
if(mysql_query(db, query.str().c_str()) != 0)
|
||||
{
|
||||
server_log->Log(log_database, "Mysql query failed: %s", query.str().c_str());
|
||||
Log.Out(Logs::General, Logs::Database,"Mysql query failed: %s", query.str().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -167,20 +167,20 @@ bool DatabaseMySQL::GetWorldRegistration(string long_name, string short_name, un
|
||||
}
|
||||
}
|
||||
|
||||
server_log->Log(log_database, "Mysql query returned no result: %s", query.str().c_str());
|
||||
Log.Out(Logs::General, Logs::Database,"Mysql query returned no result: %s", query.str().c_str());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
server_log->Log(log_database, "Mysql query returned no result: %s", query.str().c_str());
|
||||
Log.Out(Logs::General, Logs::Database,"Mysql query returned no result: %s", query.str().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
void DatabaseMySQL::UpdateLSAccountData(unsigned int id, string ip_address)
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt
|
||||
if(!db)
|
||||
{
|
||||
return;
|
||||
@ -194,13 +194,13 @@ void DatabaseMySQL::UpdateLSAccountData(unsigned int id, string ip_address)
|
||||
|
||||
if(mysql_query(db, query.str().c_str()) != 0)
|
||||
{
|
||||
server_log->Log(log_database, "Mysql query failed: %s", query.str().c_str());
|
||||
Log.Out(Logs::General, Logs::Database,"Mysql query failed: %s", query.str().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void DatabaseMySQL::UpdateLSAccountInfo(unsigned int id, string name, string password, string email)
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt
|
||||
if(!db)
|
||||
{
|
||||
return;
|
||||
@ -214,13 +214,13 @@ void DatabaseMySQL::UpdateLSAccountInfo(unsigned int id, string name, string pas
|
||||
|
||||
if(mysql_query(db, query.str().c_str()) != 0)
|
||||
{
|
||||
server_log->Log(log_database, "Mysql query failed: %s", query.str().c_str());
|
||||
Log.Out(Logs::General, Logs::Database,"Mysql query failed: %s", query.str().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void DatabaseMySQL::UpdateWorldRegistration(unsigned int id, string long_name, string ip_address)
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt
|
||||
if(!db)
|
||||
{
|
||||
return;
|
||||
@ -240,13 +240,13 @@ void DatabaseMySQL::UpdateWorldRegistration(unsigned int id, string long_name, s
|
||||
|
||||
if(mysql_query(db, query.str().c_str()) != 0)
|
||||
{
|
||||
server_log->Log(log_database, "Mysql query failed: %s", query.str().c_str());
|
||||
Log.Out(Logs::General, Logs::Database,"Mysql query failed: %s", query.str().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
bool DatabaseMySQL::CreateWorldRegistration(string long_name, string short_name, unsigned int &id)
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt
|
||||
if(!db)
|
||||
{
|
||||
return false;
|
||||
@ -266,7 +266,7 @@ bool DatabaseMySQL::CreateWorldRegistration(string long_name, string short_name,
|
||||
|
||||
if(mysql_query(db, query.str().c_str()) != 0)
|
||||
{
|
||||
server_log->Log(log_database, "Mysql query failed: %s", query.str().c_str());
|
||||
Log.Out(Logs::General, Logs::Database,"Mysql query failed: %s", query.str().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -285,13 +285,13 @@ bool DatabaseMySQL::CreateWorldRegistration(string long_name, string short_name,
|
||||
|
||||
if(mysql_query(db, query.str().c_str()) != 0)
|
||||
{
|
||||
server_log->Log(log_database, "Mysql query failed: %s", query.str().c_str());
|
||||
Log.Out(Logs::General, Logs::Database,"Mysql query failed: %s", query.str().c_str());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
server_log->Log(log_database, "World registration did not exist in the database for %s %s", long_name.c_str(), short_name.c_str());
|
||||
Log.Out(Logs::General, Logs::Database,"World registration did not exist in the database for %s %s", long_name.c_str(), short_name.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -22,25 +22,25 @@
|
||||
#include "database_postgresql.h"
|
||||
#include "error_log.h"
|
||||
#include "login_server.h"
|
||||
#include "../common/eqemu_logsys.h"
|
||||
|
||||
extern ErrorLog *server_log;
|
||||
extern LoginServer server;
|
||||
|
||||
#pragma comment(lib, "libpq.lib")
|
||||
|
||||
DatabasePostgreSQL::DatabasePostgreSQL(string user, string pass, string host, string port, string name)
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt_mt
|
||||
db = nullptr;
|
||||
db = PQsetdbLogin(host.c_str(), port.c_str(), nullptr, nullptr, name.c_str(), user.c_str(), pass.c_str());
|
||||
if(!db)
|
||||
{
|
||||
server_log->Log(log_database, "Failed to connect to PostgreSQL Database.");
|
||||
Log.Out(Logs::General, Logs::Database,"Failed to connect to PostgreSQL Database.");
|
||||
}
|
||||
|
||||
if(PQstatus(db) != CONNECTION_OK)
|
||||
{
|
||||
server_log->Log(log_database, "Failed to connect to PostgreSQL Database.");
|
||||
Log.Out(Logs::General, Logs::Database,"Failed to connect to PostgreSQL Database.");
|
||||
PQfinish(db);
|
||||
db = nullptr;
|
||||
}
|
||||
@ -48,7 +48,7 @@ DatabasePostgreSQL::DatabasePostgreSQL(string user, string pass, string host, st
|
||||
|
||||
DatabasePostgreSQL::~DatabasePostgreSQL()
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt_mt
|
||||
if(db)
|
||||
{
|
||||
PQfinish(db);
|
||||
@ -57,7 +57,7 @@ DatabasePostgreSQL::~DatabasePostgreSQL()
|
||||
|
||||
bool DatabasePostgreSQL::GetLoginDataFromAccountName(string name, string &password, unsigned int &id)
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt_mt
|
||||
if(!db)
|
||||
{
|
||||
return false;
|
||||
@ -86,7 +86,7 @@ bool DatabasePostgreSQL::GetLoginDataFromAccountName(string name, string &passwo
|
||||
char *error = PQresultErrorMessage(res);
|
||||
if(strlen(error) > 0)
|
||||
{
|
||||
server_log->Log(log_database, "Database error in DatabasePostgreSQL::GetLoginDataFromAccountName(): %s", error);
|
||||
Log.Out(Logs::General, Logs::Database,"Database error in DatabasePostgreSQL::GetLoginDataFromAccountName(): %s", error);
|
||||
PQclear(res);
|
||||
return false;
|
||||
}
|
||||
@ -106,7 +106,7 @@ bool DatabasePostgreSQL::GetLoginDataFromAccountName(string name, string &passwo
|
||||
bool DatabasePostgreSQL::GetWorldRegistration(string long_name, string short_name, unsigned int &id, string &desc, unsigned int &list_id,
|
||||
unsigned int &trusted, string &list_desc, string &account, string &password)
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt_mt
|
||||
if(!db)
|
||||
{
|
||||
return false;
|
||||
@ -139,7 +139,7 @@ bool DatabasePostgreSQL::GetWorldRegistration(string long_name, string short_nam
|
||||
char *error = PQresultErrorMessage(res);
|
||||
if(strlen(error) > 0)
|
||||
{
|
||||
server_log->Log(log_database, "Database error in DatabasePostgreSQL::GetWorldRegistration(): %s", error);
|
||||
Log.Out(Logs::General, Logs::Database,"Database error in DatabasePostgreSQL::GetWorldRegistration(): %s", error);
|
||||
PQclear(res);
|
||||
return false;
|
||||
}
|
||||
@ -164,7 +164,7 @@ bool DatabasePostgreSQL::GetWorldRegistration(string long_name, string short_nam
|
||||
|
||||
void DatabasePostgreSQL::UpdateLSAccountData(unsigned int id, string ip_address)
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt_mt
|
||||
if(!db)
|
||||
{
|
||||
return;
|
||||
@ -193,14 +193,14 @@ void DatabasePostgreSQL::UpdateLSAccountData(unsigned int id, string ip_address)
|
||||
char *error = PQresultErrorMessage(res);
|
||||
if(strlen(error) > 0)
|
||||
{
|
||||
server_log->Log(log_database, "Database error in DatabasePostgreSQL::GetLoginDataFromAccountName(): %s", error);
|
||||
Log.Out(Logs::General, Logs::Database,"Database error in DatabasePostgreSQL::GetLoginDataFromAccountName(): %s", error);
|
||||
}
|
||||
PQclear(res);
|
||||
}
|
||||
|
||||
void DatabasePostgreSQL::UpdateWorldRegistration(unsigned int id, string long_name, string ip_address)
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt_mt
|
||||
if(!db)
|
||||
{
|
||||
return;
|
||||
@ -231,7 +231,7 @@ void DatabasePostgreSQL::UpdateWorldRegistration(unsigned int id, string long_na
|
||||
char *error = PQresultErrorMessage(res);
|
||||
if(strlen(error) > 0)
|
||||
{
|
||||
server_log->Log(log_database, "Database error in DatabasePostgreSQL::GetLoginDataFromAccountName(): %s", error);
|
||||
Log.Out(Logs::General, Logs::Database,"Database error in DatabasePostgreSQL::GetLoginDataFromAccountName(): %s", error);
|
||||
}
|
||||
PQclear(res);
|
||||
}
|
||||
|
||||
@ -16,18 +16,17 @@
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include "../common/global_define.h"
|
||||
#include "../common/eqemu_logsys.h"
|
||||
#include "encryption.h"
|
||||
#include "error_log.h"
|
||||
#include <string>
|
||||
|
||||
extern ErrorLog *server_log;
|
||||
|
||||
bool Encryption::LoadCrypto(std::string name)
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt
|
||||
if(!Load(name.c_str()))
|
||||
{
|
||||
server_log->Log(log_error, "Failed to load %s from the operating system.", name.c_str());
|
||||
Log.Out(Logs::Detail, Logs::Error, "Failed to load %s from the operating system.", name.c_str());
|
||||
return false;
|
||||
}
|
||||
else
|
||||
@ -35,21 +34,21 @@ bool Encryption::LoadCrypto(std::string name)
|
||||
encrypt_func = (DLLFUNC_Encrypt)GetSym("Encrypt");
|
||||
if(encrypt_func == NULL)
|
||||
{
|
||||
server_log->Log(log_error, "Failed to attach Encrypt.");
|
||||
Log.Out(Logs::Detail, Logs::Error, "Failed to attach Encrypt.");
|
||||
Unload();
|
||||
return false;
|
||||
}
|
||||
decrypt_func = (DLLFUNC_DecryptUsernamePassword)GetSym("DecryptUsernamePassword");
|
||||
if(decrypt_func == NULL)
|
||||
{
|
||||
server_log->Log(log_error, "Failed to attach DecryptUsernamePassword.");
|
||||
Log.Out(Logs::Detail, Logs::Error, "Failed to attach DecryptUsernamePassword.");
|
||||
Unload();
|
||||
return false;
|
||||
}
|
||||
delete_func = (DLLFUNC_HeapDelete)GetSym("_HeapDeleteCharBuffer");
|
||||
if(delete_func == NULL)
|
||||
{
|
||||
server_log->Log(log_error, "Failed to attach _HeapDeleteCharBuffer.");
|
||||
Log.Out(Logs::Detail, Logs::Error, "Failed to attach _HeapDeleteCharBuffer.");
|
||||
Unload();
|
||||
return false;
|
||||
}
|
||||
@ -59,7 +58,7 @@ bool Encryption::LoadCrypto(std::string name)
|
||||
|
||||
char *Encryption::DecryptUsernamePassword(const char* encrypted_buffer, unsigned int buffer_size, int mode)
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt
|
||||
if(decrypt_func)
|
||||
{
|
||||
return decrypt_func(encrypted_buffer, buffer_size, mode);
|
||||
@ -69,7 +68,7 @@ char *Encryption::DecryptUsernamePassword(const char* encrypted_buffer, unsigned
|
||||
|
||||
char *Encryption::Encrypt(const char* buffer, unsigned int buffer_size, unsigned int &out_size)
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt
|
||||
if(encrypt_func)
|
||||
{
|
||||
return encrypt_func(buffer, buffer_size, out_size);
|
||||
@ -79,7 +78,7 @@ char *Encryption::Encrypt(const char* buffer, unsigned int buffer_size, unsigned
|
||||
|
||||
void Encryption::DeleteHeap(char *buffer)
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt
|
||||
if(delete_func)
|
||||
{
|
||||
delete_func(buffer);
|
||||
@ -88,7 +87,7 @@ void Encryption::DeleteHeap(char *buffer)
|
||||
|
||||
bool Encryption::Load(const char *name)
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt
|
||||
SetLastError(0);
|
||||
#ifdef UNICODE
|
||||
int name_length = strlen(name);
|
||||
@ -116,7 +115,7 @@ bool Encryption::Load(const char *name)
|
||||
|
||||
void Encryption::Unload()
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt
|
||||
if(h_dll)
|
||||
{
|
||||
FreeLibrary(h_dll);
|
||||
@ -126,7 +125,7 @@ void Encryption::Unload()
|
||||
|
||||
bool Encryption::GetSym(const char *name, void **sym)
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt
|
||||
if(Loaded())
|
||||
{
|
||||
*sym = GetProcAddress(h_dll, name);
|
||||
@ -140,7 +139,7 @@ bool Encryption::GetSym(const char *name, void **sym)
|
||||
|
||||
void *Encryption::GetSym(const char *name)
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt
|
||||
if(Loaded())
|
||||
{
|
||||
return GetProcAddress(h_dll, name);
|
||||
|
||||
@ -34,14 +34,14 @@ const char *eqLogTypes[_log_largest_type] =
|
||||
|
||||
ErrorLog::ErrorLog(const char* file_name)
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt
|
||||
log_mutex = new Mutex();
|
||||
error_log = fopen(file_name, "w");
|
||||
}
|
||||
|
||||
ErrorLog::~ErrorLog()
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt
|
||||
log_mutex->lock();
|
||||
if(error_log)
|
||||
{
|
||||
@ -53,7 +53,7 @@ ErrorLog::~ErrorLog()
|
||||
|
||||
void ErrorLog::Log(eqLogType type, const char *message, ...)
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt
|
||||
if(type >= _log_largest_type)
|
||||
{
|
||||
return;
|
||||
@ -101,7 +101,7 @@ void ErrorLog::Log(eqLogType type, const char *message, ...)
|
||||
|
||||
void ErrorLog::LogPacket(eqLogType type, const char *data, size_t size)
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt
|
||||
if(type >= _log_largest_type)
|
||||
{
|
||||
return;
|
||||
|
||||
@ -34,7 +34,6 @@
|
||||
TimeoutManager timeout_manager;
|
||||
LoginServer server;
|
||||
EQEmuLogSys Log;
|
||||
ErrorLog *server_log;
|
||||
bool run_server = true;
|
||||
|
||||
void CatchSignal(int sig_num)
|
||||
@ -50,7 +49,7 @@ void CatchSignal(int sig_num)
|
||||
|
||||
std::ofstream profile_out(prof_name, std::ofstream::out);
|
||||
if(profile_out.good()) {
|
||||
EQP::CPU::ST::GetProfiler().Dump(profile_out);
|
||||
EQP::CPU::MT::GetProfiler().Dump(profile_out, 5);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -59,30 +58,39 @@ int main()
|
||||
{
|
||||
RegisterExecutablePlatform(ExePlatformLogin);
|
||||
set_exception_handler();
|
||||
Log.LoadLogSettingsDefaults();
|
||||
|
||||
//Create our error log, is of format login_<number>.log
|
||||
time_t current_time = time(nullptr);
|
||||
std::stringstream log_name(std::stringstream::in | std::stringstream::out);
|
||||
log_name << "./logs/login_" << (unsigned int)current_time << ".log";
|
||||
server_log = new ErrorLog(log_name.str().c_str());
|
||||
server_log->Log(log_debug, "Logging System Init.");
|
||||
//log_settings
|
||||
Log.log_settings[Logs::LogCategory::Crash].log_to_file = true;
|
||||
Log.log_settings[Logs::LogCategory::Error].log_to_console = true;
|
||||
Log.log_settings[Logs::LogCategory::Error].log_to_file = true;
|
||||
Log.log_settings[Logs::LogCategory::Debug].log_to_console = true;
|
||||
Log.log_settings[Logs::LogCategory::Debug].log_to_file = true;
|
||||
Log.log_settings[Logs::LogCategory::Database].log_to_console = true;
|
||||
Log.log_settings[Logs::LogCategory::Database].log_to_file = true;
|
||||
Log.log_settings[Logs::LogCategory::World_Server].log_to_console = true;
|
||||
Log.log_settings[Logs::LogCategory::World_Server].log_to_file = true;
|
||||
Log.log_settings[Logs::LogCategory::Netcode].log_to_console = true;
|
||||
Log.log_settings[Logs::LogCategory::Netcode].log_to_file = true;
|
||||
Log.file_logs_enabled = true;
|
||||
Log.StartFileLogs();
|
||||
|
||||
if(signal(SIGINT, CatchSignal) == SIG_ERR) {
|
||||
server_log->Log(log_error, "Could not set signal handler");
|
||||
Log.Out(Logs::Detail, Logs::Error, "Could not set signal handler");
|
||||
return 1;
|
||||
}
|
||||
if(signal(SIGTERM, CatchSignal) == SIG_ERR) {
|
||||
server_log->Log(log_error, "Could not set signal handler");
|
||||
Log.Out(Logs::Detail, Logs::Error, "Could not set signal handler");
|
||||
return 1;
|
||||
}
|
||||
if(signal(SIGBREAK, CatchSignal) == SIG_ERR) {
|
||||
server_log->Log(log_error, "Could not set signal handler");
|
||||
Log.Out(Logs::Detail, Logs::Error, "Could not set signal handler");
|
||||
return 1;
|
||||
}
|
||||
|
||||
//Create our subsystem and parse the ini file.
|
||||
server.config = new Config();
|
||||
server_log->Log(log_debug, "Config System Init.");
|
||||
Log.Out(Logs::General, Logs::Debug, "Config System Init.");
|
||||
server.config->Parse("login.ini");
|
||||
|
||||
//Parse unregistered allowed option.
|
||||
@ -167,7 +175,7 @@ int main()
|
||||
if(server.config->GetVariable("database", "subsystem").compare("MySQL") == 0)
|
||||
{
|
||||
#ifdef EQEMU_MYSQL_ENABLED
|
||||
server_log->Log(log_debug, "MySQL Database Init.");
|
||||
Log.Out(Logs::General, Logs::Debug, "MySQL Database Init.");
|
||||
server.db = (Database*)new DatabaseMySQL(
|
||||
server.config->GetVariable("database", "user"),
|
||||
server.config->GetVariable("database", "password"),
|
||||
@ -179,7 +187,7 @@ int main()
|
||||
else if(server.config->GetVariable("database", "subsystem").compare("PostgreSQL") == 0)
|
||||
{
|
||||
#ifdef EQEMU_POSTGRESQL_ENABLED
|
||||
server_log->Log(log_debug, "PostgreSQL Database Init.");
|
||||
Log.Out(Logs::General, Logs::Debug, "PostgreSQL Database Init.");
|
||||
server.db = (Database*)new DatabasePostgreSQL(
|
||||
server.config->GetVariable("database", "user"),
|
||||
server.config->GetVariable("database", "password"),
|
||||
@ -192,75 +200,67 @@ int main()
|
||||
//Make sure our database got created okay, otherwise cleanup and exit.
|
||||
if(!server.db)
|
||||
{
|
||||
server_log->Log(log_error, "Database Initialization Failure.");
|
||||
server_log->Log(log_debug, "Config System Shutdown.");
|
||||
Log.Out(Logs::Detail, Logs::Error, "Database Initialization Failure.");
|
||||
Log.Out(Logs::General, Logs::Debug, "Config System Shutdown.");
|
||||
delete server.config;
|
||||
server_log->Log(log_debug, "Log System Shutdown.");
|
||||
delete server_log;
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if WIN32
|
||||
//initialize our encryption.
|
||||
server_log->Log(log_debug, "Encryption Initialize.");
|
||||
Log.Out(Logs::General, Logs::Debug, "Encryption Initialize.");
|
||||
server.eq_crypto = new Encryption();
|
||||
if(server.eq_crypto->LoadCrypto(server.config->GetVariable("security", "plugin")))
|
||||
{
|
||||
server_log->Log(log_debug, "Encryption Loaded Successfully.");
|
||||
Log.Out(Logs::General, Logs::Debug, "Encryption Loaded Successfully.");
|
||||
}
|
||||
else
|
||||
{
|
||||
//We can't run without encryption, cleanup and exit.
|
||||
server_log->Log(log_error, "Encryption Failed to Load.");
|
||||
server_log->Log(log_debug, "Database System Shutdown.");
|
||||
Log.Out(Logs::Detail, Logs::Error, "Encryption Failed to Load.");
|
||||
Log.Out(Logs::General, Logs::Debug, "Database System Shutdown.");
|
||||
delete server.db;
|
||||
server_log->Log(log_debug, "Config System Shutdown.");
|
||||
Log.Out(Logs::General, Logs::Debug, "Config System Shutdown.");
|
||||
delete server.config;
|
||||
server_log->Log(log_debug, "Log System Shutdown.");
|
||||
delete server_log;
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
//create our server manager.
|
||||
server_log->Log(log_debug, "Server Manager Initialize.");
|
||||
Log.Out(Logs::General, Logs::Debug, "Server Manager Initialize.");
|
||||
server.SM = new ServerManager();
|
||||
if(!server.SM)
|
||||
{
|
||||
//We can't run without a server manager, cleanup and exit.
|
||||
server_log->Log(log_error, "Server Manager Failed to Start.");
|
||||
Log.Out(Logs::Detail, Logs::Error, "Server Manager Failed to Start.");
|
||||
#ifdef WIN32
|
||||
server_log->Log(log_debug, "Encryption System Shutdown.");
|
||||
Log.Out(Logs::General, Logs::Debug, "Encryption System Shutdown.");
|
||||
delete server.eq_crypto;
|
||||
#endif
|
||||
server_log->Log(log_debug, "Database System Shutdown.");
|
||||
Log.Out(Logs::General, Logs::Debug, "Database System Shutdown.");
|
||||
delete server.db;
|
||||
server_log->Log(log_debug, "Config System Shutdown.");
|
||||
Log.Out(Logs::General, Logs::Debug, "Config System Shutdown.");
|
||||
delete server.config;
|
||||
server_log->Log(log_debug, "Log System Shutdown.");
|
||||
delete server_log;
|
||||
return 1;
|
||||
}
|
||||
|
||||
//create our client manager.
|
||||
server_log->Log(log_debug, "Client Manager Initialize.");
|
||||
Log.Out(Logs::General, Logs::Debug, "Client Manager Initialize.");
|
||||
server.CM = new ClientManager();
|
||||
if(!server.CM)
|
||||
{
|
||||
//We can't run without a client manager, cleanup and exit.
|
||||
server_log->Log(log_error, "Client Manager Failed to Start.");
|
||||
server_log->Log(log_debug, "Server Manager Shutdown.");
|
||||
Log.Out(Logs::Detail, Logs::Error, "Client Manager Failed to Start.");
|
||||
Log.Out(Logs::General, Logs::Debug, "Server Manager Shutdown.");
|
||||
delete server.SM;
|
||||
#ifdef WIN32
|
||||
server_log->Log(log_debug, "Encryption System Shutdown.");
|
||||
Log.Out(Logs::General, Logs::Debug, "Encryption System Shutdown.");
|
||||
delete server.eq_crypto;
|
||||
#endif
|
||||
server_log->Log(log_debug, "Database System Shutdown.");
|
||||
Log.Out(Logs::General, Logs::Debug, "Database System Shutdown.");
|
||||
delete server.db;
|
||||
server_log->Log(log_debug, "Config System Shutdown.");
|
||||
Log.Out(Logs::General, Logs::Debug, "Config System Shutdown.");
|
||||
delete server.config;
|
||||
server_log->Log(log_debug, "Log System Shutdown.");
|
||||
delete server_log;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -272,7 +272,7 @@ int main()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
server_log->Log(log_debug, "Server Started.");
|
||||
Log.Out(Logs::General, Logs::Debug, "Server Started.");
|
||||
while(run_server)
|
||||
{
|
||||
Timer::SetCurrentTime();
|
||||
@ -281,21 +281,19 @@ int main()
|
||||
Sleep(100);
|
||||
}
|
||||
|
||||
server_log->Log(log_debug, "Server Shutdown.");
|
||||
server_log->Log(log_debug, "Client Manager Shutdown.");
|
||||
Log.Out(Logs::General, Logs::Debug, "Server Shutdown.");
|
||||
Log.Out(Logs::General, Logs::Debug, "Client Manager Shutdown.");
|
||||
delete server.CM;
|
||||
server_log->Log(log_debug, "Server Manager Shutdown.");
|
||||
Log.Out(Logs::General, Logs::Debug, "Server Manager Shutdown.");
|
||||
delete server.SM;
|
||||
#ifdef WIN32
|
||||
server_log->Log(log_debug, "Encryption System Shutdown.");
|
||||
Log.Out(Logs::General, Logs::Debug, "Encryption System Shutdown.");
|
||||
delete server.eq_crypto;
|
||||
#endif
|
||||
server_log->Log(log_debug, "Database System Shutdown.");
|
||||
Log.Out(Logs::General, Logs::Debug, "Database System Shutdown.");
|
||||
delete server.db;
|
||||
server_log->Log(log_debug, "Config System Shutdown.");
|
||||
Log.Out(Logs::General, Logs::Debug, "Config System Shutdown.");
|
||||
delete server.config;
|
||||
server_log->Log(log_debug, "Log System Shutdown.");
|
||||
delete server_log;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -19,33 +19,33 @@
|
||||
#include "login_server.h"
|
||||
#include "error_log.h"
|
||||
#include "login_structures.h"
|
||||
#include "../common/eqemu_logsys.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
extern ErrorLog *server_log;
|
||||
extern LoginServer server;
|
||||
extern bool run_server;
|
||||
|
||||
ServerManager::ServerManager()
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt
|
||||
char error_buffer[TCPConnection_ErrorBufferSize];
|
||||
|
||||
int listen_port = atoi(server.config->GetVariable("options", "listen_port").c_str());
|
||||
tcps = new EmuTCPServer(listen_port, true);
|
||||
if(tcps->Open(listen_port, error_buffer))
|
||||
{
|
||||
server_log->Log(log_network, "ServerManager listening on port %u", listen_port);
|
||||
Log.Out(Logs::General, Logs::Netcode, "ServerManager listening on port %u", listen_port);
|
||||
}
|
||||
else
|
||||
{
|
||||
server_log->Log(log_error, "ServerManager fatal error opening port on %u: %s", listen_port, error_buffer);
|
||||
Log.Out(Logs::Detail, Logs::Error, "ServerManager fatal error opening port on %u: %s", listen_port, error_buffer);
|
||||
run_server = false;
|
||||
}
|
||||
}
|
||||
|
||||
ServerManager::~ServerManager()
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt
|
||||
if(tcps)
|
||||
{
|
||||
tcps->Close();
|
||||
@ -55,19 +55,19 @@ ServerManager::~ServerManager()
|
||||
|
||||
void ServerManager::Process()
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt
|
||||
ProcessDisconnect();
|
||||
EmuTCPConnection *tcp_c = nullptr;
|
||||
while(tcp_c = tcps->NewQueuePop())
|
||||
{
|
||||
in_addr tmp;
|
||||
tmp.s_addr = tcp_c->GetrIP();
|
||||
server_log->Log(log_network, "New world server connection from %s:%d", inet_ntoa(tmp), tcp_c->GetrPort());
|
||||
Log.Out(Logs::General, Logs::Netcode, "New world server connection from %s:%d", inet_ntoa(tmp), tcp_c->GetrPort());
|
||||
|
||||
WorldServer *cur = GetServerByAddress(tcp_c->GetrIP());
|
||||
if(cur)
|
||||
{
|
||||
server_log->Log(log_network, "World server already existed for %s, removing existing connection and updating current.", inet_ntoa(tmp));
|
||||
Log.Out(Logs::General, Logs::Netcode, "World server already existed for %s, removing existing connection and updating current.", inet_ntoa(tmp));
|
||||
cur->GetConnection()->Free();
|
||||
cur->SetConnection(tcp_c);
|
||||
cur->Reset();
|
||||
@ -84,7 +84,7 @@ void ServerManager::Process()
|
||||
{
|
||||
if((*iter)->Process() == false)
|
||||
{
|
||||
server_log->Log(log_world, "World server %s had a fatal error and had to be removed from the login.", (*iter)->GetLongName().c_str());
|
||||
Log.Out(Logs::General, Logs::World_Server, "World server %s had a fatal error and had to be removed from the login.", (*iter)->GetLongName().c_str());
|
||||
delete (*iter);
|
||||
iter = world_servers.erase(iter);
|
||||
}
|
||||
@ -97,7 +97,7 @@ void ServerManager::Process()
|
||||
|
||||
void ServerManager::ProcessDisconnect()
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt
|
||||
list<WorldServer*>::iterator iter = world_servers.begin();
|
||||
while(iter != world_servers.end())
|
||||
{
|
||||
@ -106,7 +106,7 @@ void ServerManager::ProcessDisconnect()
|
||||
{
|
||||
in_addr tmp;
|
||||
tmp.s_addr = c->GetrIP();
|
||||
server_log->Log(log_network, "World server disconnected from the server, removing server and freeing connection.");
|
||||
Log.Out(Logs::General, Logs::Netcode, "World server disconnected from the server, removing server and freeing connection.");
|
||||
c->Free();
|
||||
delete (*iter);
|
||||
iter = world_servers.erase(iter);
|
||||
@ -120,7 +120,7 @@ void ServerManager::ProcessDisconnect()
|
||||
|
||||
WorldServer* ServerManager::GetServerByAddress(unsigned int address)
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt
|
||||
list<WorldServer*>::iterator iter = world_servers.begin();
|
||||
while(iter != world_servers.end())
|
||||
{
|
||||
@ -136,7 +136,7 @@ WorldServer* ServerManager::GetServerByAddress(unsigned int address)
|
||||
|
||||
EQApplicationPacket *ServerManager::CreateServerListPacket(Client *c)
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt
|
||||
unsigned int packet_size = sizeof(ServerListHeader_Struct);
|
||||
unsigned int server_count = 0;
|
||||
in_addr in;
|
||||
@ -274,7 +274,7 @@ EQApplicationPacket *ServerManager::CreateServerListPacket(Client *c)
|
||||
|
||||
void ServerManager::SendUserToWorldRequest(unsigned int server_id, unsigned int client_account_id)
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt
|
||||
list<WorldServer*>::iterator iter = world_servers.begin();
|
||||
bool found = false;
|
||||
while(iter != world_servers.end())
|
||||
@ -299,13 +299,13 @@ void ServerManager::SendUserToWorldRequest(unsigned int server_id, unsigned int
|
||||
|
||||
if(!found && server.options.IsTraceOn())
|
||||
{
|
||||
server_log->Log(log_client_error, "Client requested a user to world but supplied an invalid id of %u.", server_id);
|
||||
Log.Out(Logs::General, Logs::Error, "Client requested a user to world but supplied an invalid id of %u.", server_id);
|
||||
}
|
||||
}
|
||||
|
||||
bool ServerManager::ServerExists(string l_name, string s_name, WorldServer *ignore)
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt
|
||||
list<WorldServer*>::iterator iter = world_servers.begin();
|
||||
while(iter != world_servers.end())
|
||||
{
|
||||
@ -327,7 +327,7 @@ bool ServerManager::ServerExists(string l_name, string s_name, WorldServer *igno
|
||||
|
||||
void ServerManager::DestroyServerByName(string l_name, string s_name, WorldServer *ignore)
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt
|
||||
list<WorldServer*>::iterator iter = world_servers.begin();
|
||||
while(iter != world_servers.end())
|
||||
{
|
||||
|
||||
@ -19,13 +19,13 @@
|
||||
#include "error_log.h"
|
||||
#include "login_server.h"
|
||||
#include "login_structures.h"
|
||||
#include "../common/eqemu_logsys.h"
|
||||
|
||||
extern ErrorLog *server_log;
|
||||
extern LoginServer server;
|
||||
|
||||
WorldServer::WorldServer(EmuTCPConnection *c)
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt
|
||||
connection = c;
|
||||
zones_booted = 0;
|
||||
players_online = 0;
|
||||
@ -40,7 +40,7 @@ WorldServer::WorldServer(EmuTCPConnection *c)
|
||||
|
||||
WorldServer::~WorldServer()
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt
|
||||
if(connection)
|
||||
{
|
||||
connection->Free();
|
||||
@ -49,7 +49,7 @@ WorldServer::~WorldServer()
|
||||
|
||||
void WorldServer::Reset()
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt
|
||||
zones_booted = 0;
|
||||
players_online = 0;
|
||||
status = 0;
|
||||
@ -62,13 +62,13 @@ void WorldServer::Reset()
|
||||
|
||||
bool WorldServer::Process()
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt
|
||||
ServerPacket *app = nullptr;
|
||||
while(app = connection->PopPacket())
|
||||
{
|
||||
if(server.options.IsWorldTraceOn())
|
||||
{
|
||||
server_log->Log(log_network_trace, "Application packet received from server: 0x%.4X, (size %u)", app->opcode, app->size);
|
||||
Log.Out(Logs::Detail, Logs::Netcode, "Application packet received from server: 0x%.4X, (size %u)", app->opcode, app->size);
|
||||
}
|
||||
|
||||
if(server.options.IsDumpInPacketsOn())
|
||||
@ -82,14 +82,14 @@ bool WorldServer::Process()
|
||||
{
|
||||
if(app->size < sizeof(ServerNewLSInfo_Struct))
|
||||
{
|
||||
server_log->Log(log_network_error, "Received application packet from server that had opcode ServerOP_NewLSInfo, "
|
||||
Log.Out(Logs::General, Logs::Netcode, "Received application packet from server that had opcode ServerOP_NewLSInfo, "
|
||||
"but was too small. Discarded to avoid buffer overrun.");
|
||||
break;
|
||||
}
|
||||
|
||||
if(server.options.IsWorldTraceOn())
|
||||
{
|
||||
server_log->Log(log_network_trace, "New Login Info Recieved.");
|
||||
Log.Out(Logs::Detail, Logs::Netcode, "New Login Info Recieved.");
|
||||
}
|
||||
|
||||
ServerNewLSInfo_Struct *info = (ServerNewLSInfo_Struct*)app->pBuffer;
|
||||
@ -100,14 +100,14 @@ bool WorldServer::Process()
|
||||
{
|
||||
if(app->size < sizeof(ServerLSStatus_Struct))
|
||||
{
|
||||
server_log->Log(log_network_error, "Recieved application packet from server that had opcode ServerOP_LSStatus, "
|
||||
Log.Out(Logs::General, Logs::Netcode, "Recieved application packet from server that had opcode ServerOP_LSStatus, "
|
||||
"but was too small. Discarded to avoid buffer overrun.");
|
||||
break;
|
||||
}
|
||||
|
||||
if(server.options.IsWorldTraceOn())
|
||||
{
|
||||
server_log->Log(log_network_trace, "World Server Status Recieved.");
|
||||
Log.Out(Logs::Detail, Logs::Netcode, "World Server Status Recieved.");
|
||||
}
|
||||
|
||||
ServerLSStatus_Struct *ls_status = (ServerLSStatus_Struct*)app->pBuffer;
|
||||
@ -131,7 +131,7 @@ bool WorldServer::Process()
|
||||
{
|
||||
if(app->size < sizeof(UsertoWorldResponse_Struct))
|
||||
{
|
||||
server_log->Log(log_network_error, "Recieved application packet from server that had opcode ServerOP_UsertoWorldResp, "
|
||||
Log.Out(Logs::General, Logs::Netcode, "Recieved application packet from server that had opcode ServerOP_UsertoWorldResp, "
|
||||
"but was too small. Discarded to avoid buffer overrun.");
|
||||
break;
|
||||
}
|
||||
@ -141,21 +141,21 @@ bool WorldServer::Process()
|
||||
//While keeping world server spam with multiple servers connected almost impossible.
|
||||
if(server.options.IsTraceOn())
|
||||
{
|
||||
server_log->Log(log_network_trace, "User-To-World Response received.");
|
||||
Log.Out(Logs::Detail, Logs::Netcode, "User-To-World Response received.");
|
||||
}
|
||||
|
||||
UsertoWorldResponse_Struct *utwr = (UsertoWorldResponse_Struct*)app->pBuffer;
|
||||
server_log->Log(log_client, "Trying to find client with user id of %u.", utwr->lsaccountid);
|
||||
Log.Out(Logs::General, Logs::LoginServer, "Trying to find client with user id of %u.", utwr->lsaccountid);
|
||||
Client *c = server.CM->GetClient(utwr->lsaccountid);
|
||||
if(c)
|
||||
{
|
||||
server_log->Log(log_client, "Found client with user id of %u and account name of %s.", utwr->lsaccountid, c->GetAccountName().c_str());
|
||||
Log.Out(Logs::General, Logs::LoginServer, "Found client with user id of %u and account name of %s.", utwr->lsaccountid, c->GetAccountName().c_str());
|
||||
EQApplicationPacket *outapp = new EQApplicationPacket(OP_PlayEverquestResponse, sizeof(PlayEverquestResponse_Struct));
|
||||
PlayEverquestResponse_Struct *per = (PlayEverquestResponse_Struct*)outapp->pBuffer;
|
||||
per->Sequence = c->GetPlaySequence();
|
||||
per->ServerNumber = c->GetPlayServerID();
|
||||
server_log->Log(log_client, "Found sequence and play of %u %u", c->GetPlaySequence(), c->GetPlayServerID());
|
||||
server_log->LogPacket(log_network_trace, (const char*)outapp->pBuffer, outapp->size);
|
||||
Log.Out(Logs::General, Logs::LoginServer, "Found sequence and play of %u %u", c->GetPlaySequence(), c->GetPlayServerID());
|
||||
//server_log->LogPacket(log_network_trace, (const char*)outapp->pBuffer, outapp->size);
|
||||
|
||||
if(utwr->response > 0)
|
||||
{
|
||||
@ -184,9 +184,9 @@ bool WorldServer::Process()
|
||||
|
||||
if(server.options.IsTraceOn())
|
||||
{
|
||||
server_log->Log(log_network_trace, "Sending play response with following data, allowed %u, sequence %u, server number %u, message %u",
|
||||
Log.Out(Logs::Detail, Logs::Netcode, "Sending play response with following data, allowed %u, sequence %u, server number %u, message %u",
|
||||
per->Allowed, per->Sequence, per->ServerNumber, per->Message);
|
||||
server_log->LogPacket(log_network_trace, (const char*)outapp->pBuffer, outapp->size);
|
||||
//server_log->LogPacket(log_network_trace, (const char*)outapp->pBuffer, outapp->size);
|
||||
}
|
||||
|
||||
if(server.options.IsDumpOutPacketsOn())
|
||||
@ -199,7 +199,7 @@ bool WorldServer::Process()
|
||||
}
|
||||
else
|
||||
{
|
||||
server_log->Log(log_client_error, "Recieved User-To-World Response for %u but could not find the client referenced!.", utwr->lsaccountid);
|
||||
Log.Out(Logs::General, Logs::Error, "Recieved User-To-World Response for %u but could not find the client referenced!.", utwr->lsaccountid);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -207,16 +207,16 @@ bool WorldServer::Process()
|
||||
{
|
||||
if(app->size < sizeof(ServerLSAccountUpdate_Struct))
|
||||
{
|
||||
server_log->Log(log_network_error, "Recieved application packet from server that had opcode ServerLSAccountUpdate_Struct, "
|
||||
Log.Out(Logs::General, Logs::Netcode, "Recieved application packet from server that had opcode ServerLSAccountUpdate_Struct, "
|
||||
"but was too small. Discarded to avoid buffer overrun.");
|
||||
break;
|
||||
}
|
||||
|
||||
server_log->Log(log_network_trace, "ServerOP_LSAccountUpdate packet received from: %s", short_name.c_str());
|
||||
Log.Out(Logs::Detail, Logs::Netcode, "ServerOP_LSAccountUpdate packet received from: %s", short_name.c_str());
|
||||
ServerLSAccountUpdate_Struct *lsau = (ServerLSAccountUpdate_Struct*)app->pBuffer;
|
||||
if(trusted)
|
||||
{
|
||||
server_log->Log(log_network_trace, "ServerOP_LSAccountUpdate update processed for: %s", lsau->useraccount);
|
||||
Log.Out(Logs::Detail, Logs::Netcode, "ServerOP_LSAccountUpdate update processed for: %s", lsau->useraccount);
|
||||
string name;
|
||||
string password;
|
||||
string email;
|
||||
@ -229,7 +229,7 @@ bool WorldServer::Process()
|
||||
}
|
||||
default:
|
||||
{
|
||||
server_log->Log(log_network_error, "Recieved application packet from server that had an unknown operation code 0x%.4X.", app->opcode);
|
||||
Log.Out(Logs::General, Logs::Netcode, "Recieved application packet from server that had an unknown operation code 0x%.4X.", app->opcode);
|
||||
}
|
||||
}
|
||||
|
||||
@ -241,10 +241,10 @@ bool WorldServer::Process()
|
||||
|
||||
void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i)
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt
|
||||
if(logged_in)
|
||||
{
|
||||
server_log->Log(log_network_error, "WorldServer::Handle_NewLSInfo called but the login server was already marked as logged in, aborting.");
|
||||
Log.Out(Logs::General, Logs::Netcode, "WorldServer::Handle_NewLSInfo called but the login server was already marked as logged in, aborting.");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -254,7 +254,7 @@ void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i)
|
||||
}
|
||||
else
|
||||
{
|
||||
server_log->Log(log_network_error, "Handle_NewLSInfo error, account name was too long.");
|
||||
Log.Out(Logs::General, Logs::Netcode, "Handle_NewLSInfo error, account name was too long.");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -264,7 +264,7 @@ void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i)
|
||||
}
|
||||
else
|
||||
{
|
||||
server_log->Log(log_network_error, "Handle_NewLSInfo error, account password was too long.");
|
||||
Log.Out(Logs::General, Logs::Netcode, "Handle_NewLSInfo error, account password was too long.");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -274,7 +274,7 @@ void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i)
|
||||
}
|
||||
else
|
||||
{
|
||||
server_log->Log(log_network_error, "Handle_NewLSInfo error, long name was too long.");
|
||||
Log.Out(Logs::General, Logs::Netcode, "Handle_NewLSInfo error, long name was too long.");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -284,7 +284,7 @@ void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i)
|
||||
}
|
||||
else
|
||||
{
|
||||
server_log->Log(log_network_error, "Handle_NewLSInfo error, short name was too long.");
|
||||
Log.Out(Logs::General, Logs::Netcode, "Handle_NewLSInfo error, short name was too long.");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -292,7 +292,7 @@ void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i)
|
||||
{
|
||||
if(strlen(i->local_address) == 0)
|
||||
{
|
||||
server_log->Log(log_network_error, "Handle_NewLSInfo error, local address was null, defaulting to localhost");
|
||||
Log.Out(Logs::General, Logs::Netcode, "Handle_NewLSInfo error, local address was null, defaulting to localhost");
|
||||
local_ip = "127.0.0.1";
|
||||
}
|
||||
else
|
||||
@ -302,7 +302,7 @@ void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i)
|
||||
}
|
||||
else
|
||||
{
|
||||
server_log->Log(log_network_error, "Handle_NewLSInfo error, local address was too long.");
|
||||
Log.Out(Logs::General, Logs::Netcode, "Handle_NewLSInfo error, local address was too long.");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -313,7 +313,7 @@ void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i)
|
||||
in_addr in;
|
||||
in.s_addr = GetConnection()->GetrIP();
|
||||
remote_ip = inet_ntoa(in);
|
||||
server_log->Log(log_network_error, "Handle_NewLSInfo error, remote address was null, defaulting to stream address %s.", remote_ip.c_str());
|
||||
Log.Out(Logs::General, Logs::Netcode, "Handle_NewLSInfo error, remote address was null, defaulting to stream address %s.", remote_ip.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -325,7 +325,7 @@ void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i)
|
||||
in_addr in;
|
||||
in.s_addr = GetConnection()->GetrIP();
|
||||
remote_ip = inet_ntoa(in);
|
||||
server_log->Log(log_network_error, "Handle_NewLSInfo error, remote address was too long, defaulting to stream address %s.", remote_ip.c_str());
|
||||
Log.Out(Logs::General, Logs::Netcode, "Handle_NewLSInfo error, remote address was too long, defaulting to stream address %s.", remote_ip.c_str());
|
||||
}
|
||||
|
||||
if(strlen(i->serverversion) <= 64)
|
||||
@ -334,7 +334,7 @@ void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i)
|
||||
}
|
||||
else
|
||||
{
|
||||
server_log->Log(log_network_error, "Handle_NewLSInfo error, server version was too long.");
|
||||
Log.Out(Logs::General, Logs::Netcode, "Handle_NewLSInfo error, server version was too long.");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -344,7 +344,7 @@ void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i)
|
||||
}
|
||||
else
|
||||
{
|
||||
server_log->Log(log_network_error, "Handle_NewLSInfo error, protocol version was too long.");
|
||||
Log.Out(Logs::General, Logs::Netcode, "Handle_NewLSInfo error, protocol version was too long.");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -355,7 +355,7 @@ void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i)
|
||||
{
|
||||
if(server.SM->ServerExists(long_name, short_name, this))
|
||||
{
|
||||
server_log->Log(log_world_error, "World tried to login but there already exists a server that has that name.");
|
||||
Log.Out(Logs::General, Logs::Error, "World tried to login but there already exists a server that has that name.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -363,7 +363,7 @@ void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i)
|
||||
{
|
||||
if(server.SM->ServerExists(long_name, short_name, this))
|
||||
{
|
||||
server_log->Log(log_world_error, "World tried to login but there already exists a server that has that name.");
|
||||
Log.Out(Logs::General, Logs::Error, "World tried to login but there already exists a server that has that name.");
|
||||
server.SM->DestroyServerByName(long_name, short_name, this);
|
||||
}
|
||||
}
|
||||
@ -383,7 +383,7 @@ void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i)
|
||||
{
|
||||
if(s_acct_name.size() == 0 || s_acct_pass.size() == 0)
|
||||
{
|
||||
server_log->Log(log_world, "Server %s(%s) successfully logged into account that had no user/password requirement.",
|
||||
Log.Out(Logs::General, Logs::World_Server, "Server %s(%s) successfully logged into account that had no user/password requirement.",
|
||||
long_name.c_str(), short_name.c_str());
|
||||
authorized = true;
|
||||
SetRuntimeID(s_id);
|
||||
@ -392,7 +392,7 @@ void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i)
|
||||
}
|
||||
else if(s_acct_name.compare(account_name) == 0 && s_acct_pass.compare(account_password) == 0)
|
||||
{
|
||||
server_log->Log(log_world, "Server %s(%s) successfully logged in.",
|
||||
Log.Out(Logs::General, Logs::World_Server, "Server %s(%s) successfully logged in.",
|
||||
long_name.c_str(), short_name.c_str());
|
||||
authorized = true;
|
||||
SetRuntimeID(s_id);
|
||||
@ -400,7 +400,7 @@ void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i)
|
||||
desc = s_desc;
|
||||
if(s_trusted)
|
||||
{
|
||||
server_log->Log(log_network_trace, "ServerOP_LSAccountUpdate sent to world");
|
||||
Log.Out(Logs::Detail, Logs::Netcode, "ServerOP_LSAccountUpdate sent to world");
|
||||
trusted = true;
|
||||
ServerPacket *outapp = new ServerPacket(ServerOP_LSAccountUpdate, 0);
|
||||
connection->SendPacket(outapp);
|
||||
@ -408,21 +408,21 @@ void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i)
|
||||
}
|
||||
else
|
||||
{
|
||||
server_log->Log(log_world, "Server %s(%s) attempted to log in but account and password did not match the entry in the database, and only"
|
||||
Log.Out(Logs::General, Logs::World_Server, "Server %s(%s) attempted to log in but account and password did not match the entry in the database, and only"
|
||||
" registered servers are allowed.", long_name.c_str(), short_name.c_str());
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
server_log->Log(log_world, "Server %s(%s) attempted to log in but database couldn't find an entry and only registered servers are allowed.",
|
||||
Log.Out(Logs::General, Logs::World_Server, "Server %s(%s) attempted to log in but database couldn't find an entry and only registered servers are allowed.",
|
||||
long_name.c_str(), short_name.c_str());
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
server_log->Log(log_world, "Server %s(%s) did not attempt to log in but only registered servers are allowed.",
|
||||
Log.Out(Logs::General, Logs::World_Server, "Server %s(%s) did not attempt to log in but only registered servers are allowed.",
|
||||
long_name.c_str(), short_name.c_str());
|
||||
return;
|
||||
}
|
||||
@ -442,7 +442,7 @@ void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i)
|
||||
{
|
||||
if(s_acct_name.compare(account_name) == 0 && s_acct_pass.compare(account_password) == 0)
|
||||
{
|
||||
server_log->Log(log_world, "Server %s(%s) successfully logged in.",
|
||||
Log.Out(Logs::General, Logs::World_Server, "Server %s(%s) successfully logged in.",
|
||||
long_name.c_str(), short_name.c_str());
|
||||
authorized = true;
|
||||
SetRuntimeID(s_id);
|
||||
@ -450,7 +450,7 @@ void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i)
|
||||
desc = s_desc;
|
||||
if(s_trusted)
|
||||
{
|
||||
server_log->Log(log_network_trace, "ServerOP_LSAccountUpdate sent to world");
|
||||
Log.Out(Logs::Detail, Logs::Netcode, "ServerOP_LSAccountUpdate sent to world");
|
||||
trusted = true;
|
||||
ServerPacket *outapp = new ServerPacket(ServerOP_LSAccountUpdate, 0);
|
||||
connection->SendPacket(outapp);
|
||||
@ -459,7 +459,7 @@ void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i)
|
||||
else
|
||||
{
|
||||
// this is the first of two cases where we should deny access even if unregistered is allowed
|
||||
server_log->Log(log_world, "Server %s(%s) attempted to log in but account and password did not match the entry in the database.",
|
||||
Log.Out(Logs::General, Logs::World_Server, "Server %s(%s) attempted to log in but account and password did not match the entry in the database.",
|
||||
long_name.c_str(), short_name.c_str());
|
||||
}
|
||||
}
|
||||
@ -468,12 +468,12 @@ void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i)
|
||||
if(s_acct_name.size() > 0 || s_acct_pass.size() > 0)
|
||||
{
|
||||
// this is the second of two cases where we should deny access even if unregistered is allowed
|
||||
server_log->Log(log_world, "Server %s(%s) did not attempt to log in but this server requires a password.",
|
||||
Log.Out(Logs::General, Logs::World_Server, "Server %s(%s) did not attempt to log in but this server requires a password.",
|
||||
long_name.c_str(), short_name.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
server_log->Log(log_world, "Server %s(%s) did not attempt to log in but unregistered servers are allowed.",
|
||||
Log.Out(Logs::General, Logs::World_Server, "Server %s(%s) did not attempt to log in but unregistered servers are allowed.",
|
||||
long_name.c_str(), short_name.c_str());
|
||||
authorized = true;
|
||||
SetRuntimeID(s_id);
|
||||
@ -483,7 +483,7 @@ void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i)
|
||||
}
|
||||
else
|
||||
{
|
||||
server_log->Log(log_world, "Server %s(%s) attempted to log in but database couldn't find an entry but unregistered servers are allowed.",
|
||||
Log.Out(Logs::General, Logs::World_Server, "Server %s(%s) attempted to log in but database couldn't find an entry but unregistered servers are allowed.",
|
||||
long_name.c_str(), short_name.c_str());
|
||||
if(server.db->CreateWorldRegistration(long_name, short_name, s_id))
|
||||
{
|
||||
@ -506,7 +506,7 @@ void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct* i)
|
||||
|
||||
void WorldServer::Handle_LSStatus(ServerLSStatus_Struct *s)
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt
|
||||
players_online = s->num_players;
|
||||
zones_booted = s->num_zones;
|
||||
status = s->status;
|
||||
@ -514,7 +514,7 @@ void WorldServer::Handle_LSStatus(ServerLSStatus_Struct *s)
|
||||
|
||||
void WorldServer::SendClientAuth(unsigned int ip, string account, string key, unsigned int account_id)
|
||||
{
|
||||
_eqp
|
||||
_eqp_mt
|
||||
ServerPacket *outapp = new ServerPacket(ServerOP_LSClientAuth, sizeof(ServerLSClientAuth));
|
||||
ServerLSClientAuth* slsca = (ServerLSClientAuth*)outapp->pBuffer;
|
||||
|
||||
|
||||
@ -21,7 +21,7 @@ INSTALL(TARGETS queryserv RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
|
||||
ADD_DEFINITIONS(-DQSERV)
|
||||
|
||||
TARGET_LINK_LIBRARIES(queryserv common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY})
|
||||
TARGET_LINK_LIBRARIES(queryserv common ${PERF_LIBS} debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY})
|
||||
|
||||
IF(MSVC)
|
||||
SET_TARGET_PROPERTIES(queryserv PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF")
|
||||
|
||||
@ -23,7 +23,7 @@ ADD_EXECUTABLE(shared_memory ${shared_memory_sources} ${shared_memory_headers})
|
||||
|
||||
INSTALL(TARGETS shared_memory RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
|
||||
TARGET_LINK_LIBRARIES(shared_memory common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY})
|
||||
TARGET_LINK_LIBRARIES(shared_memory common ${PERF_LIBS} debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY})
|
||||
|
||||
IF(MSVC)
|
||||
SET_TARGET_PROPERTIES(shared_memory PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF")
|
||||
|
||||
@ -20,7 +20,7 @@ SET(tests_headers
|
||||
|
||||
ADD_EXECUTABLE(tests ${tests_sources} ${tests_headers})
|
||||
|
||||
TARGET_LINK_LIBRARIES(tests common cppunit)
|
||||
TARGET_LINK_LIBRARIES(tests common ${PERF_LIBS} cppunit)
|
||||
|
||||
INSTALL(TARGETS tests RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@ INSTALL(TARGETS ucs RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
|
||||
ADD_DEFINITIONS(-DUCS)
|
||||
|
||||
TARGET_LINK_LIBRARIES(ucs common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY})
|
||||
TARGET_LINK_LIBRARIES(ucs common ${PERF_LIBS} debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY})
|
||||
|
||||
IF(MSVC)
|
||||
SET_TARGET_PROPERTIES(ucs PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF")
|
||||
|
||||
@ -68,7 +68,7 @@ INSTALL(TARGETS world RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
|
||||
ADD_DEFINITIONS(-DWORLD)
|
||||
|
||||
TARGET_LINK_LIBRARIES(world common ${PERL_LIBRARY} debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY})
|
||||
TARGET_LINK_LIBRARIES(world common ${PERF_LIBS} ${PERL_LIBRARY} debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY})
|
||||
|
||||
IF(MSVC)
|
||||
SET_TARGET_PROPERTIES(world PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF")
|
||||
|
||||
@ -307,29 +307,7 @@ bool EQWHTTPServer::Start(uint16 port, const char *mime_file) {
|
||||
m_running = true;
|
||||
m_port = port;
|
||||
|
||||
/*
|
||||
|
||||
#ifdef _WINDOWS
|
||||
_beginthread(ThreadProc, 0, this);
|
||||
#else
|
||||
pthread_create(&m_thread, nullptr, ThreadProc, this);
|
||||
#endif*/
|
||||
|
||||
return(true);
|
||||
}
|
||||
|
||||
/*
|
||||
void EQWHTTPServer::Run() {
|
||||
Log.LogDebugType(Logs::Detail, Logs::World_Server, "HTTP Processing thread started on port %d", m_port);
|
||||
do {
|
||||
#warning DELETE THIS IF YOU DONT USE IT
|
||||
Sleep(10);
|
||||
} while(m_running);
|
||||
Log.LogDebugType(Logs::Detail, Logs::World_Server, "HTTP Processing thread terminating on port %d", m_port);
|
||||
}
|
||||
|
||||
ThreadReturnType EQWHTTPServer::ThreadProc(void *data) {
|
||||
((EQWHTTPServer *) data)->Run();
|
||||
THREAD_RETURN(nullptr);
|
||||
}*/
|
||||
|
||||
|
||||
@ -219,7 +219,7 @@ INSTALL(TARGETS zone RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
|
||||
ADD_DEFINITIONS(-DZONE)
|
||||
|
||||
TARGET_LINK_LIBRARIES(zone common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY})
|
||||
TARGET_LINK_LIBRARIES(zone common ${PERF_LIBS} debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY})
|
||||
|
||||
IF(EQEMU_BUILD_PERL)
|
||||
TARGET_LINK_LIBRARIES(zone ${PERL_LIBRARY})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user