Convert netcode debugging _log to logger.LogDebugType

This commit is contained in:
Akkadius
2015-01-12 21:45:49 -06:00
parent 4811631127
commit ffdce868c1
11 changed files with 205 additions and 196 deletions
+12 -11
View File
@@ -1,4 +1,5 @@
#include "debug.h"
#include "eqemu_logsys.h"
#include "eq_stream_ident.h"
#include "eq_stream_proxy.h"
#include "logsys.h"
@@ -45,7 +46,7 @@ void EQStreamIdentifier::Process() {
//first see if this stream has expired
if(r->expire.Check(false)) {
//this stream has failed to match any pattern in our timeframe.
_log(NET__IDENTIFY, "Unable to identify stream from %s:%d before timeout.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()));
logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d before timeout.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()));
r->stream->ReleaseFromUse();
delete r;
cur = m_streams.erase(cur);
@@ -61,23 +62,23 @@ void EQStreamIdentifier::Process() {
}
if(r->stream->GetState() != ESTABLISHED) {
//the stream closed before it was identified.
_log(NET__IDENTIFY, "Unable to identify stream from %s:%d before it closed.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()));
logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d before it closed.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()));
switch(r->stream->GetState())
{
case ESTABLISHED:
_log(NET__IDENTIFY, "Stream state was Established");
logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Established");
break;
case CLOSING:
_log(NET__IDENTIFY, "Stream state was Closing");
logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Closing");
break;
case DISCONNECTING:
_log(NET__IDENTIFY, "Stream state was Disconnecting");
logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Disconnecting");
break;
case CLOSED:
_log(NET__IDENTIFY, "Stream state was Closed");
logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Closed");
break;
default:
_log(NET__IDENTIFY, "Stream state was Unestablished or unknown");
logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Unestablished or unknown");
break;
}
r->stream->ReleaseFromUse();
@@ -102,13 +103,13 @@ void EQStreamIdentifier::Process() {
switch(res) {
case EQStream::MatchNotReady:
//the stream has not received enough packets to compare with this signature
// _log(NET__IDENT_TRACE, "%s:%d: Tried patch %s, but stream is not ready for it.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()), p->name.c_str());
// logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: Tried patch %s, but stream is not ready for it.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()), p->name.c_str());
all_ready = false;
break;
case EQStream::MatchSuccessful: {
//yay, a match.
_log(NET__IDENTIFY, "Identified stream %s:%d with signature %s", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()), p->name.c_str());
logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Identified stream %s:%d with signature %s", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()), p->name.c_str());
// before we assign the eqstream to an interface, let the stream recognize it is in use and the session should not be reset any further
r->stream->SetActive(true);
@@ -122,7 +123,7 @@ void EQStreamIdentifier::Process() {
}
case EQStream::MatchFailed:
//do nothing...
_log(NET__IDENT_TRACE, "%s:%d: Tried patch %s, and it did not match.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()), p->name.c_str());
logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: Tried patch %s, and it did not match.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()), p->name.c_str());
break;
}
}
@@ -130,7 +131,7 @@ void EQStreamIdentifier::Process() {
//if we checked all patches and did not find a match.
if(all_ready && !found_one) {
//the stream cannot be identified.
_log(NET__IDENTIFY, "Unable to identify stream from %s:%d, no match found.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()));
logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d, no match found.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()));
r->stream->ReleaseFromUse();
}