diff options
author | Josh Bell <josh@lindenlab.com> | 2007-04-11 17:54:18 +0000 |
---|---|---|
committer | Josh Bell <josh@lindenlab.com> | 2007-04-11 17:54:18 +0000 |
commit | 0277259455c4354f81ea8a24c8ab93f27567bc6f (patch) | |
tree | f1411dab563dcf697f794e9e8a592a6d3e5c4d2d /indra/llmessage | |
parent | 568397bbcc4fca307ebc010ec7f815422b9ba80a (diff) |
svn merge -r 59968:60342 svn+ssh://svn.lindenlab.com/svn/linden/branches/maintenance --> release
Diffstat (limited to 'indra/llmessage')
-rw-r--r-- | indra/llmessage/llclassifiedflags.h | 2 | ||||
-rw-r--r-- | indra/llmessage/message.cpp | 118 | ||||
-rw-r--r-- | indra/llmessage/message.h | 34 |
3 files changed, 47 insertions, 107 deletions
diff --git a/indra/llmessage/llclassifiedflags.h b/indra/llmessage/llclassifiedflags.h index 1949eb54d0..610ad35c4a 100644 --- a/indra/llmessage/llclassifiedflags.h +++ b/indra/llmessage/llclassifiedflags.h @@ -22,6 +22,8 @@ const U8 CLASSIFIED_QUERY_FILTER_MATURE = 1 << 1; const U8 CLASSIFIED_QUERY_FILTER_ENABLED = 1 << 2; const U8 CLASSIFIED_QUERY_FILTER_PRICE = 1 << 3; +const S32 MAX_CLASSIFIEDS = 100; + ClassifiedFlags pack_classified_flags(BOOL is_mature, BOOL auto_renew); bool is_cf_mature(ClassifiedFlags flags); //bool is_cf_enabled(ClassifiedFlags flags); diff --git a/indra/llmessage/message.cpp b/indra/llmessage/message.cpp index 099b6a0a5b..6fb319326b 100644 --- a/indra/llmessage/message.cpp +++ b/indra/llmessage/message.cpp @@ -33,6 +33,7 @@ // linden library headers #include "indra_constants.h" +#include "lldarray.h" #include "lldir.h" #include "llerror.h" #include "llfasttimer.h" @@ -447,7 +448,6 @@ private: }; - // static BOOL LLMessageSystem::mTimeDecodes = FALSE; @@ -827,6 +827,9 @@ void LLMessageSystem::init() mMessageFileChecksum = 0; mMessageFileVersionNumber = 0.f; + + mTimingCallback = NULL; + mTimingCallbackData = NULL; } LLMessageSystem::LLMessageSystem() @@ -3480,7 +3483,7 @@ BOOL LLMessageSystem::decodeData(const U8* buffer, const LLHost& sender ) { static LLTimer decode_timer; - if( mTimeDecodes ) + if( mTimeDecodes || mTimingCallback ) { decode_timer.reset(); } @@ -3503,25 +3506,36 @@ BOOL LLMessageSystem::decodeData(const U8* buffer, const LLHost& sender ) // VTPause(); // VTune // } - if( mTimeDecodes ) + if( mTimeDecodes || mTimingCallback ) { F32 decode_time = decode_timer.getElapsedTimeF32(); - mCurrentRMessageTemplate->mDecodeTimeThisFrame += decode_time; - - mCurrentRMessageTemplate->mTotalDecoded++; - mCurrentRMessageTemplate->mTotalDecodeTime += decode_time; - if( mCurrentRMessageTemplate->mMaxDecodeTimePerMsg < decode_time ) + if (mTimingCallback) { - mCurrentRMessageTemplate->mMaxDecodeTimePerMsg = decode_time; + mTimingCallback(mCurrentRMessageTemplate->mName, + decode_time, + mTimingCallbackData); } - - if( decode_time > mTimeDecodesSpamThreshold ) + if (mTimeDecodes) { - lldebugs << "--------- Message " << mCurrentRMessageTemplate->mName << " decode took " << decode_time << " seconds. (" << - mCurrentRMessageTemplate->mMaxDecodeTimePerMsg << " max, " << - (mCurrentRMessageTemplate->mTotalDecodeTime / mCurrentRMessageTemplate->mTotalDecoded) << " avg)" << llendl; + mCurrentRMessageTemplate->mDecodeTimeThisFrame += decode_time; + + mCurrentRMessageTemplate->mTotalDecoded++; + mCurrentRMessageTemplate->mTotalDecodeTime += decode_time; + + if( mCurrentRMessageTemplate->mMaxDecodeTimePerMsg < decode_time ) + { + mCurrentRMessageTemplate->mMaxDecodeTimePerMsg = decode_time; + } + + + if( decode_time > mTimeDecodesSpamThreshold ) + { + lldebugs << "--------- Message " << mCurrentRMessageTemplate->mName << " decode took " << decode_time << " seconds. (" << + mCurrentRMessageTemplate->mMaxDecodeTimePerMsg << " max, " << + (mCurrentRMessageTemplate->mTotalDecodeTime / mCurrentRMessageTemplate->mTotalDecoded) << " avg)" << llendl; + } } } } @@ -4516,76 +4530,6 @@ void process_deny_trusted_circuit(LLMessageSystem *msg, void **) msg->sendCreateTrustedCircuit(msg->getSender(), local_id, remote_id); } -#define LL_ENCRYPT_BUF_LENGTH 16384 - -void encrypt_template(const char *src_name, const char *dest_name) -{ - // encrypt and decrypt are symmetric - decrypt_template(src_name, dest_name); -} - -BOOL decrypt_template(const char *src_name, const char *dest_name) -{ - S32 buf_length = LL_ENCRYPT_BUF_LENGTH; - char buf[LL_ENCRYPT_BUF_LENGTH]; /* Flawfinder: ignore */ - - FILE* infp = NULL; - FILE* outfp = NULL; - BOOL success = FALSE; - char* bufp = NULL; - U32 key = 0; - S32 more_data = 0; - - if(src_name==NULL) - { - llwarns << "Input src_name is NULL!!" << llendl; - goto exit; - } - - infp = LLFile::fopen(src_name,"rb"); /* Flawfinder: ignore */ - if (!infp) - { - llwarns << "could not open " << src_name << " for reading" << llendl; - goto exit; - } - - if(dest_name==NULL) - { - llwarns << "Output dest_name is NULL!!" << llendl; - goto exit; - } - - outfp = LLFile::fopen(dest_name,"w+b"); /* Flawfinder: ignore */ - if (!outfp) - { - llwarns << "could not open " << src_name << " for writing" << llendl; - goto exit; - } - - while ((buf_length = (S32)fread(buf,1,LL_ENCRYPT_BUF_LENGTH,infp))) - { - // unscrozzle bits here - bufp = buf; - more_data = buf_length; - while (more_data--) - { - *bufp = *bufp ^ ((key * 43) % 256); - key++; - bufp++; - } - - if(buf_length != (S32)fwrite(buf,1,buf_length,outfp)) - { - goto exit; - } - } - success = TRUE; - - exit: - if(infp) fclose(infp); - if(outfp) fclose(outfp); - return success; -} void dump_prehash_files() { @@ -5278,6 +5222,12 @@ BOOL LLMessageSystem::callExceptionFunc(EMessageException exception) return FALSE; } +void LLMessageSystem::setTimingFunc(msg_timing_callback func, void* data) +{ + mTimingCallback = func; + mTimingCallbackData = data; +} + BOOL LLMessageSystem::isCircuitCodeKnown(U32 code) const { if(mCircuitCodes.find(code) == mCircuitCodes.end()) diff --git a/indra/llmessage/message.h b/indra/llmessage/message.h index 3f9dfa08d6..3ffafcc1b8 100644 --- a/indra/llmessage/message.h +++ b/indra/llmessage/message.h @@ -26,16 +26,13 @@ #include "llerror.h" #include "net.h" #include "string_table.h" -#include "llptrskipmap.h" #include "llcircuit.h" #include "lltimer.h" #include "llpacketring.h" #include "llhost.h" #include "llpacketack.h" -#include "doublelinkedlist.h" #include "message_prehash.h" #include "llstl.h" -#include "lldarray.h" const U32 MESSAGE_MAX_STRINGS_LENGTH = 64; const U32 MESSAGE_NUMBER_OF_HASH_BUCKETS = 8192; @@ -178,7 +175,6 @@ enum EMessageException typedef void (*msg_exception_callback)(LLMessageSystem*,void*,EMessageException); - class LLMsgData; class LLMsgBlkData; class LLMessageTemplate; @@ -307,6 +303,12 @@ public: // function was found and called. Otherwise return FALSE. BOOL callExceptionFunc(EMessageException exception); + // Set a function that will be called once per packet processed with the + // hashed message name and the time spent in the processing handler function + // measured in seconds. JC + typedef void (*msg_timing_callback)(const char* hashed_name, F32 time, void* data); + void setTimingFunc(msg_timing_callback func, void* data = NULL); + // This method returns true if the code is in the circuit codes map. BOOL isCircuitCodeKnown(U32 code) const; @@ -734,16 +736,15 @@ private: static F32 mTimeDecodesSpamThreshold; // If mTimeDecodes is on, all this many seconds for each msg decode before spamming static BOOL mTimeDecodes; // Measure time for all message decodes if TRUE; + msg_timing_callback mTimingCallback; + void* mTimingCallbackData; + void init(); // ctor shared initialisation. }; // external hook into messaging system extern LLMessageSystem *gMessageSystem; -//extern const char* MESSAGE_LOG_FILENAME; - -void encrypt_template(const char *src_name, const char *dest_name); -BOOL decrypt_template(const char *src_name, const char *dest_name); // Must specific overall system version, which is used to determine // if a patch is available in the message template checksum verification. @@ -1232,22 +1233,9 @@ inline void LLMessageSystem::getString(const char *block, const char *var, S32 b s[buffer_size - 1] = '\0'; } -//----------------------------------------------------------------------------- -// Transmission aliases -//----------------------------------------------------------------------------- -//inline S32 LLMessageSystem::sendMessage(U32 ip, U32 port, BOOL zero_code) -//{ -// return sendMessage(LLHost(ip, port), zero_code); -//} - -//inline S32 LLMessageSystem::sendMessage(const char *ip_str, U32 port, BOOL zero_code) -//{ -// return sendMessage(LLHost(ip_str, port), zero_code); -//} - -inline S32 LLMessageSystem::sendMessage(const U32 circuit)//, BOOL zero_code) +inline S32 LLMessageSystem::sendMessage(const U32 circuit) { - return sendMessage(findHost(circuit));//, zero_code); + return sendMessage(findHost(circuit)); } #endif |