diff --git a/indra/llmessage/llcircuit.cpp b/indra/llmessage/llcircuit.cpp index 4b41abd45..56249db41 100644 --- a/indra/llmessage/llcircuit.cpp +++ b/indra/llmessage/llcircuit.cpp @@ -56,6 +56,7 @@ #include "llstl.h" #include "lltransfermanager.h" #include "llmodularmath.h" +#include "llpacketring.h" const S32 PING_START_BLOCK = 3; // How many pings behind we have to be to consider ourself blocked. const S32 PING_RELEASE_BLOCK = 2; // How many pings behind we have to be to consider ourself unblocked. @@ -346,7 +347,7 @@ S32 LLCircuitData::resendUnackedPackets(const F64 now) packetp->mBuffer[0] |= LL_RESENT_FLAG; // tag packet id as being a resend - gMessageSystem->mPacketRing.sendPacket(packetp->mSocket, + gMessageSystem->mPacketRing->sendPacket(packetp->mSocket, (char *)packetp->mBuffer, packetp->mBufferLength, packetp->mHost); diff --git a/indra/llmessage/llpacketring.h b/indra/llmessage/llpacketring.h index b214271e7..63d272308 100644 --- a/indra/llmessage/llpacketring.h +++ b/indra/llmessage/llpacketring.h @@ -32,7 +32,7 @@ #include "llhost.h" #include "llpacketbuffer.h" -#include "llproxy.h" +//#include "llproxy.h" #include "llthrottle.h" #include "net.h" diff --git a/indra/llmessage/message.cpp b/indra/llmessage/message.cpp index 7d21e35f9..7abfea8ef 100644 --- a/indra/llmessage/message.cpp +++ b/indra/llmessage/message.cpp @@ -81,6 +81,7 @@ #include "v4math.h" #include "lltransfertargetvfile.h" #include "llmemtype.h" +#include "llpacketring.h" // Constants //const char* MESSAGE_LOG_FILENAME = "message.log"; @@ -245,7 +246,8 @@ LLMessageSystem::LLMessageSystem(const std::string& filename, U32 port, bool failure_is_fatal, const F32 circuit_heartbeat_interval, const F32 circuit_timeout) : mCircuitInfo(circuit_heartbeat_interval, circuit_timeout), - mLastMessageFromTrustedMessageService(false) + mLastMessageFromTrustedMessageService(false), + mPacketRing(new LLPacketRing) { init(); @@ -383,6 +385,9 @@ LLMessageSystem::~LLMessageSystem() delete mPollInfop; mPollInfop = NULL; + delete mPacketRing; + mPacketRing = NULL; + mIncomingCompressedSize = 0; mCurrentRecvPacketID = 0; } @@ -548,13 +553,13 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count ) U8* buffer = mTrueReceiveBuffer; - mTrueReceiveSize = mPacketRing.receivePacket(mSocket, (char *)mTrueReceiveBuffer); + mTrueReceiveSize = mPacketRing->receivePacket(mSocket, (char *)mTrueReceiveBuffer); // If you want to dump all received packets into SecondLife.log, uncomment this //dumpPacketToLog(); receive_size = mTrueReceiveSize; - mLastSender = mPacketRing.getLastSender(); - mLastReceivingIF = mPacketRing.getLastReceivingInterface(); + mLastSender = mPacketRing->getLastSender(); + mLastReceivingIF = mPacketRing->getLastReceivingInterface(); if (receive_size < (S32) LL_MINIMUM_VALID_PACKET_SIZE) { @@ -1129,7 +1134,7 @@ S32 LLMessageSystem::flushReliable(const LLHost &host) return send_bytes; } -LLHTTPClient::ResponderPtr LLMessageSystem::createResponder(const std::string& name) +LLFnPtrResponder* LLMessageSystem::createResponder(const std::string& name) { if(mSendReliable) { @@ -1328,7 +1333,7 @@ S32 LLMessageSystem::sendMessage(const LLHost &host) } BOOL success; - success = mPacketRing.sendPacket(mSocket, (char *)buf_ptr, buffer_length, host); + success = mPacketRing->sendPacket(mSocket, (char *)buf_ptr, buffer_length, host); if (!success) { @@ -3361,7 +3366,7 @@ void LLMessageSystem::establishBidirectionalTrust(const LLHost &host, S64 frame_ void LLMessageSystem::dumpPacketToLog() { - LL_WARNS("Messaging") << "Packet Dump from:" << mPacketRing.getLastSender() << llendl; + LL_WARNS("Messaging") << "Packet Dump from:" << mPacketRing->getLastSender() << llendl; LL_WARNS("Messaging") << "Packet Size:" << mTrueReceiveSize << llendl; char line_buffer[256]; /* Flawfinder: ignore */ S32 i; diff --git a/indra/llmessage/message.h b/indra/llmessage/message.h index 1589ea29c..dee687d47 100644 --- a/indra/llmessage/message.h +++ b/indra/llmessage/message.h @@ -48,9 +48,9 @@ #include "string_table.h" #include "llcircuit.h" #include "lltimer.h" -#include "llpacketring.h" +//#include "llpacketring.h" #include "llhost.h" -#include "llhttpclient.h" +//#include "llhttpclient.h" #include "llhttpnode.h" #include "llpacketack.h" #include "llsingleton.h" @@ -61,6 +61,12 @@ #include "llstoredmessage.h" +class LLPacketRing; +namespace +{ + class LLFnPtrResponder; +} + const U32 MESSAGE_MAX_STRINGS_LENGTH = 64; const U32 MESSAGE_NUMBER_OF_HASH_BUCKETS = 8192; @@ -213,7 +219,7 @@ class LLMessageSystem : public LLMessageSenderInterface LLHost mUntrustedInterface; public: - LLPacketRing mPacketRing; + LLPacketRing* mPacketRing; LLReliablePacketParams mReliablePacketParams; // Set this flag to TRUE when you want *very* verbose logs. @@ -494,7 +500,7 @@ public: void (*callback)(void **,S32), void ** callback_data); - LLHTTPClient::ResponderPtr createResponder(const std::string& name); + LLFnPtrResponder* createResponder(const std::string& name); S32 sendMessage(const LLHost &host); S32 sendMessage(const U32 circuit); private: diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 1400da474..fcd46b82e 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -627,21 +627,21 @@ bool idle_startup() F32 dropPercent = gSavedSettings.getF32("PacketDropPercentage"); - msg->mPacketRing.setDropPercentage(dropPercent); + msg->mPacketRing->setDropPercentage(dropPercent); F32 inBandwidth = gSavedSettings.getF32("InBandwidth"); F32 outBandwidth = gSavedSettings.getF32("OutBandwidth"); if (inBandwidth != 0.f) { LL_DEBUGS("AppInit") << "Setting packetring incoming bandwidth to " << inBandwidth << LL_ENDL; - msg->mPacketRing.setUseInThrottle(TRUE); - msg->mPacketRing.setInBandwidth(inBandwidth); + msg->mPacketRing->setUseInThrottle(TRUE); + msg->mPacketRing->setInBandwidth(inBandwidth); } if (outBandwidth != 0.f) { LL_DEBUGS("AppInit") << "Setting packetring outgoing bandwidth to " << outBandwidth << LL_ENDL; - msg->mPacketRing.setUseOutThrottle(TRUE); - msg->mPacketRing.setOutBandwidth(outBandwidth); + msg->mPacketRing->setUseOutThrottle(TRUE); + msg->mPacketRing->setOutBandwidth(outBandwidth); } } diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 669c57d43..5d6134412 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -4035,7 +4035,7 @@ void print_packets_lost(void*) void drop_packet(void*) { - gMessageSystem->mPacketRing.dropPackets(1); + gMessageSystem->mPacketRing->dropPackets(1); } diff --git a/indra/newview/llviewerprecompiledheaders.h b/indra/newview/llviewerprecompiledheaders.h index 031e5fa6a..e838eaadd 100644 --- a/indra/newview/llviewerprecompiledheaders.h +++ b/indra/newview/llviewerprecompiledheaders.h @@ -169,7 +169,7 @@ #include "llnamevalue.h" #include "llpacketack.h" #include "llpacketbuffer.h" -#include "llpacketring.h" +//#include "llpacketring.h" #include "llpartdata.h" //#include "llqueryflags.h" //#include "llregionflags.h" diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index 6f92bedf9..ef77a099d 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -779,8 +779,8 @@ void LLWorld::updateNetStats() S32 packets_out = gMessageSystem->mPacketsOut - mLastPacketsOut; S32 packets_lost = gMessageSystem->mDroppedPackets - mLastPacketsLost; - S32 actual_in_bits = gMessageSystem->mPacketRing.getAndResetActualInBits(); - S32 actual_out_bits = gMessageSystem->mPacketRing.getAndResetActualOutBits(); + S32 actual_in_bits = gMessageSystem->mPacketRing->getAndResetActualInBits(); + S32 actual_out_bits = gMessageSystem->mPacketRing->getAndResetActualOutBits(); LLViewerStats::getInstance()->mActualInKBitStat.addValue(actual_in_bits/1024.f); LLViewerStats::getInstance()->mActualOutKBitStat.addValue(actual_out_bits/1024.f); LLViewerStats::getInstance()->mKBitStat.addValue(bits/1024.f); diff --git a/indra/newview/scriptcounter.cpp b/indra/newview/scriptcounter.cpp index 37acc1e37..f58d26b34 100644 --- a/indra/newview/scriptcounter.cpp +++ b/indra/newview/scriptcounter.cpp @@ -201,8 +201,8 @@ void ScriptCounter::serializeSelection(bool delScript) F32 throttle = gSavedSettings.getF32("OutBandwidth"); if((throttle == 0.f) || (throttle > 128000.f)) { - gMessageSystem->mPacketRing.setOutBandwidth(128000); - gMessageSystem->mPacketRing.setUseOutThrottle(TRUE); + gMessageSystem->mPacketRing->setOutBandwidth(128000); + gMessageSystem->mPacketRing->setUseOutThrottle(TRUE); } showResult(llformat("Counting scripts, please wait...")); if((objectCount == 1) && !(foo->isAvatar())) @@ -340,13 +340,13 @@ void ScriptCounter::completechk() F32 throttle = gSavedSettings.getF32("OutBandwidth"); if(throttle != 0.f) { - gMessageSystem->mPacketRing.setOutBandwidth(throttle); - gMessageSystem->mPacketRing.setUseOutThrottle(TRUE); + gMessageSystem->mPacketRing->setOutBandwidth(throttle); + gMessageSystem->mPacketRing->setUseOutThrottle(TRUE); } else { - gMessageSystem->mPacketRing.setOutBandwidth(0.0); - gMessageSystem->mPacketRing.setUseOutThrottle(FALSE); + gMessageSystem->mPacketRing->setOutBandwidth(0.0); + gMessageSystem->mPacketRing->setUseOutThrottle(FALSE); } llinfos << "Sending readout to chat..." << llendl; showResult(user_msg);