diff --git a/indra/llmessage/llmessagelog.cpp b/indra/llmessage/llmessagelog.cpp index 5e3da3bbc..371617b6b 100644 --- a/indra/llmessage/llmessagelog.cpp +++ b/indra/llmessage/llmessagelog.cpp @@ -9,20 +9,8 @@ LLMessageLogEntry::LLMessageLogEntry(EType type, LLHost from_host, LLHost to_hos { if(data) { - mData.resize(data_size); - mData.assign(data,data + data_size); - } -} -LLMessageLogEntry::LLMessageLogEntry(EType type, LLHost from_host, LLHost to_host, std::vector data, S32 data_size) -: mType(type), - mFromHost(from_host), - mToHost(to_host), - mDataSize(data_size) -{ - if(data.size()) - { - mData.resize(data.size()); - std::copy(data.begin(),data.end(),mData.begin()); + mData = new U8[data_size]; + memcpy(mData, data, data_size); } } LLMessageLogEntry::~LLMessageLogEntry() @@ -44,6 +32,7 @@ void LLMessageLog::setCallback(void (*callback)(LLMessageLogEntry)) void LLMessageLog::log(LLHost from_host, LLHost to_host, U8* data, S32 data_size) { LLMessageLogEntry entry = LLMessageLogEntry(LLMessageLogEntry::TEMPLATE, from_host, to_host, data, data_size); + if(!entry.mDataSize || !entry.mData) return; if(sCallback) sCallback(entry); if(!sMaxSize) return; sDeque.push_back(entry); diff --git a/indra/llmessage/llmessagelog.h b/indra/llmessage/llmessagelog.h index 9467a2a0f..96fae9750 100644 --- a/indra/llmessage/llmessagelog.h +++ b/indra/llmessage/llmessagelog.h @@ -1,41 +1,40 @@ -// -#ifndef LL_LLMESSAGELOG_H -#define LL_LLMESSAGELOG_H -#include "stdtypes.h" -#include "llhost.h" -#include -#include - -class LLMessageSystem; -class LLMessageLogEntry -{ -public: - enum EType - { - TEMPLATE, - HTTP_REQUEST, - HTTP_RESPONSE - }; - LLMessageLogEntry(EType type, LLHost from_host, LLHost to_host, U8* data, S32 data_size); - LLMessageLogEntry(EType type, LLHost from_host, LLHost to_host, std::vector data, S32 data_size); - ~LLMessageLogEntry(); - EType mType; - LLHost mFromHost; - LLHost mToHost; - S32 mDataSize; - std::vector mData; -}; -class LLMessageLog -{ -public: - static void setMaxSize(U32 size); - static void setCallback(void (*callback)(LLMessageLogEntry)); - static void log(LLHost from_host, LLHost to_host, U8* data, S32 data_size); - static std::deque getDeque(); -private: - static U32 sMaxSize; - static void (*sCallback)(LLMessageLogEntry); - static std::deque sDeque; -}; -#endif -// +// +#ifndef LL_LLMESSAGELOG_H +#define LL_LLMESSAGELOG_H +#include "stdtypes.h" +#include "llhost.h" +#include +#include + +class LLMessageSystem; +class LLMessageLogEntry +{ +public: + enum EType + { + TEMPLATE, + HTTP_REQUEST, + HTTP_RESPONSE + }; + LLMessageLogEntry(EType type, LLHost from_host, LLHost to_host, U8* data, S32 data_size); + ~LLMessageLogEntry(); + EType mType; + LLHost mFromHost; + LLHost mToHost; + S32 mDataSize; + U8* mData; +}; +class LLMessageLog +{ +public: + static void setMaxSize(U32 size); + static void setCallback(void (*callback)(LLMessageLogEntry)); + static void log(LLHost from_host, LLHost to_host, U8* data, S32 data_size); + static std::deque getDeque(); +private: + static U32 sMaxSize; + static void (*sCallback)(LLMessageLogEntry); + static std::deque sDeque; +}; +#endif +// diff --git a/indra/llmessage/message.cpp b/indra/llmessage/message.cpp index 7c68dfb6f..a667f67a9 100644 --- a/indra/llmessage/message.cpp +++ b/indra/llmessage/message.cpp @@ -568,7 +568,7 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count ) //dumpPacketToLog(); // - if(mTrueReceiveSize) + if(mTrueReceiveSize && receive_size > (S32) LL_MINIMUM_VALID_PACKET_SIZE) { LLMessageLog::log(mLastSender, LLHost(16777343, mPort), buffer, mTrueReceiveSize); } diff --git a/indra/newview/llfloatermessagelog.cpp b/indra/newview/llfloatermessagelog.cpp index 2ea6e7e01..1918914d5 100644 --- a/indra/newview/llfloatermessagelog.cpp +++ b/indra/newview/llfloatermessagelog.cpp @@ -41,10 +41,10 @@ LLFloaterMessageLogItem::LLFloaterMessageLogItem(LLMessageLogEntry entry) { BOOL decode_invalid = FALSE; S32 decode_len = mDataSize; - std::vector DecodeBuffer(MAX_PACKET_LEN,0); - DecodeBuffer.assign(mData.begin(),mData.end()); - mFlags = DecodeBuffer[0]; + U8 DecodeBuffer[MAX_PACKET_LEN]; + memcpy(&(DecodeBuffer[0]),mData,decode_len); U8* decodep = &(DecodeBuffer[0]); + mFlags = DecodeBuffer[0]; gMessageSystem->zeroCodeExpand(&decodep, &decode_len); if(decode_len < 7) decode_invalid = TRUE; @@ -142,8 +142,8 @@ std::string LLFloaterMessageLogItem::getFull(BOOL show_header) { BOOL decode_invalid = FALSE; S32 decode_len = mDataSize; - std::vector DecodeBuffer(MAX_PACKET_LEN,0); - DecodeBuffer.assign(mData.begin(),mData.end()); + U8 DecodeBuffer[MAX_PACKET_LEN]; + memcpy(&(DecodeBuffer[0]),mData,decode_len); U8* decodep = &(DecodeBuffer[0]); gMessageSystem->zeroCodeExpand(&decodep, &decode_len); if(decode_len < 7) @@ -447,10 +447,8 @@ BOOL LLMessageLogFilterApply::tick() } return TRUE; } - if((*mIter).mData.size()) - { - LLFloaterMessageLog::sInstance->conditionalLog(LLFloaterMessageLogItem((*mIter))); - } + + LLFloaterMessageLog::sInstance->conditionalLog(LLFloaterMessageLogItem((*mIter))); mIter++; mProgress++;