diff options
Diffstat (limited to 'indra/llmessage')
| -rw-r--r-- | indra/llmessage/lldatapacker.cpp | 5 | ||||
| -rw-r--r-- | indra/llmessage/lliohttpserver.cpp | 37 | ||||
| -rw-r--r-- | indra/llmessage/llmessagereader.cpp | 1 | ||||
| -rw-r--r-- | indra/llmessage/llnamevalue.h | 1 | ||||
| -rw-r--r-- | indra/llmessage/lltemplatemessagereader.cpp | 11 | ||||
| -rw-r--r-- | indra/llmessage/llxfer_file.cpp | 6 | ||||
| -rw-r--r-- | indra/llmessage/message.cpp | 1 | ||||
| -rw-r--r-- | indra/llmessage/message.h | 103 | 
8 files changed, 92 insertions, 73 deletions
diff --git a/indra/llmessage/lldatapacker.cpp b/indra/llmessage/lldatapacker.cpp index d36e639f45..74a6a871c0 100644 --- a/indra/llmessage/lldatapacker.cpp +++ b/indra/llmessage/lldatapacker.cpp @@ -1875,7 +1875,10 @@ BOOL LLDataPackerAsciiFile::getValueStr(const char *name, char *out_value, S32 v  	{  		fpos_t last_pos;  		fgetpos(mFP, &last_pos); -		fgets(buffer, DP_BUFSIZE, mFP); +		if (fgets(buffer, DP_BUFSIZE, mFP) == NULL) +		{ +			buffer[0] = '\0'; +		}  		sscanf(buffer, "%511s %511[^\n]", keyword, value);	/* Flawfinder: ignore */ diff --git a/indra/llmessage/lliohttpserver.cpp b/indra/llmessage/lliohttpserver.cpp index 07ca6a42a1..fcf27fac66 100644 --- a/indra/llmessage/lliohttpserver.cpp +++ b/indra/llmessage/lliohttpserver.cpp @@ -33,6 +33,7 @@  static const char HTTP_VERSION_STR[] = "HTTP/1.0";  static const std::string CONTEXT_REQUEST("request"); +static const std::string CONTEXT_RESPONSE("response");  static const std::string HTTP_VERB_GET("GET");  static const std::string HTTP_VERB_PUT("PUT");  static const std::string HTTP_VERB_POST("POST"); @@ -136,10 +137,7 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl(  		LLBufferStream istr(channels, buffer.get());  		static LLTimer timer; -		if (sTimingCallback) -		{ -			timer.reset(); -		} +		timer.reset();  		std::string verb = context[CONTEXT_REQUEST]["verb"];  		if(verb == HTTP_VERB_GET) @@ -169,6 +167,7 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl(  		    mResponse->methodNotAllowed();  		} +		F32 delta = timer.getElapsedTimeF32();  		if (sTimingCallback)  		{  			LLHTTPNode::Description desc; @@ -177,16 +176,20 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl(  			std::string timing_name = info["description"];  			timing_name += " ";  			timing_name += verb; -			F32 delta = timer.getElapsedTimeF32();  			sTimingCallback(timing_name.c_str(), delta, sTimingCallbackData);  		} +		// Log all HTTP transactions. +		llinfos << verb << " " << context[CONTEXT_REQUEST]["path"].asString() +			<< " " << mStatusCode << " " <<  mStatusMessage << " " << delta +			<< "s" << llendl; +  		// Log Internal Server Errors -		if(mStatusCode == 500) -		{ -			llwarns << "LLHTTPPipe::process_impl:500:Internal Server Error"  -					<< llendl; -		} +		//if(mStatusCode == 500) +		//{ +		//	llwarns << "LLHTTPPipe::process_impl:500:Internal Server Error"  +		//			<< llendl; +		//}  	}  	PUMP_DEBUG; @@ -203,7 +206,7 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl(  		case STATE_GOOD_RESULT:  		{ -			context["response"]["contentType"] = "application/xml"; +			context[CONTEXT_RESPONSE]["contentType"] = "application/xml";  			LLBufferStream ostr(channels, buffer.get());  			LLSDSerialize::toXML(mGoodResult, ostr); @@ -212,9 +215,9 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl(  		case STATE_STATUS_RESULT:  		{ -			context["response"]["contentType"] = "text/plain"; -			context["response"]["statusCode"] = mStatusCode; -			context["response"]["statusMessage"] = mStatusMessage; +			context[CONTEXT_RESPONSE]["contentType"] = "text/plain"; +			context[CONTEXT_RESPONSE]["statusCode"] = mStatusCode; +			context[CONTEXT_RESPONSE]["statusMessage"] = mStatusMessage;  			LLBufferStream ostr(channels, buffer.get());  			ostr << mStatusMessage << std::ends; @@ -351,9 +354,9 @@ LLIOPipe::EStatus LLHTTPResponseHeader::process_impl(  		PUMP_DEBUG;  		//mGotEOS = true;  		std::ostringstream ostr; -		std::string message = context["response"]["statusMessage"]; +		std::string message = context[CONTEXT_RESPONSE]["statusMessage"]; -		int code = context["response"]["statusCode"]; +		int code = context[CONTEXT_RESPONSE]["statusCode"];  		if (code < 200)  		{  			code = 200; @@ -362,7 +365,7 @@ LLIOPipe::EStatus LLHTTPResponseHeader::process_impl(  		ostr << HTTP_VERSION_STR << " " << code << " " << message << "\r\n"; -		std::string type = context["response"]["contentType"].asString(); +		std::string type = context[CONTEXT_RESPONSE]["contentType"].asString();  		if (!type.empty())  		{  			ostr << "Content-Type: " << type << "\r\n"; diff --git a/indra/llmessage/llmessagereader.cpp b/indra/llmessage/llmessagereader.cpp index 5375fab0f8..996258af52 100644 --- a/indra/llmessage/llmessagereader.cpp +++ b/indra/llmessage/llmessagereader.cpp @@ -6,6 +6,7 @@   * $License$   */ +#include "linden_common.h"  #include "llmessagereader.h"  static BOOL sTimeDecodes = FALSE; diff --git a/indra/llmessage/llnamevalue.h b/indra/llmessage/llnamevalue.h index 27355277ca..f3d0d0d338 100644 --- a/indra/llmessage/llnamevalue.h +++ b/indra/llmessage/llnamevalue.h @@ -174,7 +174,6 @@ public:  	ENameValueSendto			mSendto;  	UNameValueReference			mNameValueReference; -	S32							mNumberEntries;  	LLStringTable				*mNVNameTable;  	TNameValueCallback			mNameValueCB;  	void						**mUserData; diff --git a/indra/llmessage/lltemplatemessagereader.cpp b/indra/llmessage/lltemplatemessagereader.cpp index 9015be7106..3e08b9de26 100644 --- a/indra/llmessage/lltemplatemessagereader.cpp +++ b/indra/llmessage/lltemplatemessagereader.cpp @@ -6,6 +6,7 @@   * $License$   */ +#include "linden_common.h"  #include "lltemplatemessagereader.h"  #include "llfasttimer.h" @@ -331,7 +332,7 @@ void LLTemplateMessageReader::getF64(const char *block, const char *var,  void LLTemplateMessageReader::getVector3(const char *block, const char *var,   										 LLVector3 &v, S32 blocknum )  { -	getData(block, var, v.mV, sizeof(v.mV), blocknum); +	getData(block, var, &v.mV[0], sizeof(v.mV), blocknum);  	if( !v.isFinite() )  	{ @@ -344,7 +345,7 @@ void LLTemplateMessageReader::getVector3(const char *block, const char *var,  void LLTemplateMessageReader::getVector4(const char *block, const char *var,   										 LLVector4 &v, S32 blocknum)  { -	getData(block, var, v.mV, sizeof(v.mV), blocknum); +	getData(block, var, &v.mV[0], sizeof(v.mV), blocknum);  	if( !v.isFinite() )  	{ @@ -357,7 +358,7 @@ void LLTemplateMessageReader::getVector4(const char *block, const char *var,  void LLTemplateMessageReader::getVector3d(const char *block, const char *var,   										  LLVector3d &v, S32 blocknum )  { -	getData(block, var, v.mdV, sizeof(v.mdV), blocknum); +	getData(block, var, &v.mdV[0], sizeof(v.mdV), blocknum);  	if( !v.isFinite() )  	{ @@ -372,7 +373,7 @@ void LLTemplateMessageReader::getQuat(const char *block, const char *var,  									  LLQuaternion &q, S32 blocknum)  {  	LLVector3 vec; -	getData(block, var, vec.mV, sizeof(vec.mV), blocknum); +	getData(block, var, &vec.mV[0], sizeof(vec.mV), blocknum);  	if( vec.isFinite() )  	{  		q.unpackFromVector3( vec ); @@ -388,7 +389,7 @@ void LLTemplateMessageReader::getQuat(const char *block, const char *var,  void LLTemplateMessageReader::getUUID(const char *block, const char *var,   									  LLUUID &u, S32 blocknum)  { -	getData(block, var, u.mData, sizeof(u.mData), blocknum); +	getData(block, var, &u.mData[0], sizeof(u.mData), blocknum);  }  inline void LLTemplateMessageReader::getIPAddr(const char *block, const char *var, U32 &u, S32 blocknum) diff --git a/indra/llmessage/llxfer_file.cpp b/indra/llmessage/llxfer_file.cpp index 299c043d93..338dbdd215 100644 --- a/indra/llmessage/llxfer_file.cpp +++ b/indra/llmessage/llxfer_file.cpp @@ -269,7 +269,11 @@ S32 LLXfer_File::flush()  		if (mFp)  		{ -			fwrite(mBuffer,1,mBufferLength,mFp); +			if (fwrite(mBuffer,1,mBufferLength,mFp) != mBufferLength) +			{ +				llwarns << "Short write" << llendl; +			} +			  //			llinfos << "******* wrote " << mBufferLength << " bytes of file xfer" << llendl;  			fclose(mFp);  			mFp = NULL; diff --git a/indra/llmessage/message.cpp b/indra/llmessage/message.cpp index 1a616d9e2b..d0414def6d 100644 --- a/indra/llmessage/message.cpp +++ b/indra/llmessage/message.cpp @@ -385,6 +385,7 @@ LLMessageSystem::~LLMessageSystem()  	{  		end_net(mSocket);  	} +	mSocket = 0;  	delete mTemplateMessageReader;  	mTemplateMessageReader = NULL; diff --git a/indra/llmessage/message.h b/indra/llmessage/message.h index 9c07227a67..2f875f2b96 100644 --- a/indra/llmessage/message.h +++ b/indra/llmessage/message.h @@ -19,6 +19,10 @@  #include <netinet/in.h>  #endif +#if LL_SOLARIS +#include <netinet/in.h> +#endif +  #if LL_WINDOWS  #include "winsock2.h" // htons etc.  #endif @@ -184,14 +188,14 @@ public:  class LLMessageSystem  {   private: -	U8										mSendBuffer[MAX_BUFFER_SIZE]; -	S32										mSendSize; +	U8					mSendBuffer[MAX_BUFFER_SIZE]; +	S32					mSendSize;   public: -	LLPacketRing							mPacketRing; -	LLReliablePacketParams					mReliablePacketParams; +	LLPacketRing				mPacketRing; +	LLReliablePacketParams			mReliablePacketParams; -	//LLLinkedList<LLPacketAck>				mAckList; +	//LLLinkedList<LLPacketAck>		mAckList;  	// Set this flag to TRUE when you want *very* verbose logs.  	BOOL mVerboseLog; @@ -202,36 +206,35 @@ class LLMessageSystem  	typedef std::map<U32, LLMessageTemplate*> message_template_number_map_t;  private: -	message_template_name_map_t				mMessageTemplates; -	message_template_number_map_t			mMessageNumbers; +	message_template_name_map_t		mMessageTemplates; +	message_template_number_map_t		mMessageNumbers;  public: -	S32										mSystemVersionMajor; -	S32										mSystemVersionMinor; -	S32										mSystemVersionPatch; -	S32										mSystemVersionServer; -	U32										mVersionFlags; +	S32					mSystemVersionMajor; +	S32					mSystemVersionMinor; +	S32					mSystemVersionPatch; +	S32					mSystemVersionServer; +	U32					mVersionFlags; +	BOOL					mbProtected; -	BOOL									mbProtected; +	U32					mNumberHighFreqMessages; +	U32					mNumberMediumFreqMessages; +	U32					mNumberLowFreqMessages; +	S32					mPort; +	S32					mSocket; -	U32										mNumberHighFreqMessages; -	U32										mNumberMediumFreqMessages; -	U32										mNumberLowFreqMessages; -	S32										mPort; -	S32										mSocket; +	U32					mPacketsIn;		    // total packets in, including compressed and uncompressed +	U32					mPacketsOut;		    // total packets out, including compressed and uncompressed -	U32										mPacketsIn;			// total packets in, including compressed and uncompressed -	U32										mPacketsOut;		// total packets out, including compressed and uncompressed - -	U64										mBytesIn;			// total bytes in, including compressed and uncompressed -	U64										mBytesOut;			// total bytes out, including compressed and uncompressed +	U64					mBytesIn;		    // total bytes in, including compressed and uncompressed +	U64					mBytesOut;		    // total bytes out, including compressed and uncompressed -	U32										mCompressedPacketsIn;		// total compressed packets in -	U32										mCompressedPacketsOut;	    // total compressed packets out +	U32					mCompressedPacketsIn;	    // total compressed packets in +	U32					mCompressedPacketsOut;	    // total compressed packets out -	U32										mReliablePacketsIn;		    // total reliable packets in -	U32										mReliablePacketsOut;	    // total reliable packets out +	U32					mReliablePacketsIn;	    // total reliable packets in +	U32					mReliablePacketsOut;	    // total reliable packets out  	U32                                     mDroppedPackets;            // total dropped packets in  	U32                                     mResentPackets;             // total resent packets out @@ -239,26 +242,26 @@ public:  	U32                                     mOffCircuitPackets;         // total # of off-circuit packets rejected  	U32                                     mInvalidOnCircuitPackets;   // total # of on-circuit but invalid packets rejected -	S64										mUncompressedBytesIn;		// total uncompressed size of compressed packets in -	S64										mUncompressedBytesOut;		// total uncompressed size of compressed packets out -	S64										mCompressedBytesIn;			// total compressed size of compressed packets in -	S64										mCompressedBytesOut;		// total compressed size of compressed packets out -	S64										mTotalBytesIn;			    // total size of all uncompressed packets in -	S64										mTotalBytesOut;				// total size of all uncompressed packets out +	S64					mUncompressedBytesIn;	    // total uncompressed size of compressed packets in +	S64					mUncompressedBytesOut;	    // total uncompressed size of compressed packets out +	S64					mCompressedBytesIn;	    // total compressed size of compressed packets in +	S64					mCompressedBytesOut;	    // total compressed size of compressed packets out +	S64					mTotalBytesIn;		    // total size of all uncompressed packets in +	S64					mTotalBytesOut;		    // total size of all uncompressed packets out  	BOOL                                    mSendReliable;              // does the outgoing message require a pos ack? -	LLCircuit								mCircuitInfo; -	F64										mCircuitPrintTime;			// used to print circuit debug info every couple minutes -	F32										mCircuitPrintFreq;			// seconds +	LLCircuit 	 			mCircuitInfo; +	F64					mCircuitPrintTime;	    // used to print circuit debug info every couple minutes +	F32					mCircuitPrintFreq;	    // seconds -	std::map<U64, U32>						mIPPortToCircuitCode; -	std::map<U32, U64>						mCircuitCodeToIPPort; -	U32										mOurCircuitCode; -	S32										mSendPacketFailureCount; -	S32										mUnackedListDepth; -	S32										mUnackedListSize; -	S32										mDSMaxListDepth; +	std::map<U64, U32>			mIPPortToCircuitCode; +	std::map<U32, U64>			mCircuitCodeToIPPort; +	U32					mOurCircuitCode; +	S32					mSendPacketFailureCount; +	S32					mUnackedListDepth; +	S32					mUnackedListSize; +	S32					mDSMaxListDepth;  public:  	// Read file and build message templates @@ -673,14 +676,14 @@ private:  	LLMessagePollInfo						*mPollInfop; -	U8										mEncodedRecvBuffer[MAX_BUFFER_SIZE]; -	U8										mTrueReceiveBuffer[MAX_BUFFER_SIZE]; -	S32										mTrueReceiveSize; +	U8	mEncodedRecvBuffer[MAX_BUFFER_SIZE]; +	U8	mTrueReceiveBuffer[MAX_BUFFER_SIZE]; +	S32	mTrueReceiveSize;  	// Must be valid during decode -	BOOL									mbError; -	S32 mErrorCode; +	BOOL	mbError; +	S32	mErrorCode;  	F64										mResendDumpTime; // The last time we dumped resends @@ -755,6 +758,10 @@ void null_message_callback(LLMessageSystem *msg, void **data);  // Inlines  // +#if !defined( LL_BIG_ENDIAN ) && !defined( LL_LITTLE_ENDIAN ) +#error Unknown endianness for htonmemcpy. Did you miss a common include? +#endif +  static inline void *htonmemcpy(void *vs, const void *vct, EMsgVariableType type, size_t n)  {  	char *s = (char *)vs;  | 
