summaryrefslogtreecommitdiff
path: root/indra/llmessage
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2015-04-14 13:46:01 -0700
committerMerov Linden <merov@lindenlab.com>2015-04-14 13:46:01 -0700
commitd631f2fd4daed5e3b10fc6dc290aa16f3d0591f0 (patch)
treeafc5139a2d530bdca9233308d2b6d6d4532bc6c4 /indra/llmessage
parent5411f349e5ed8835d5c99dbfb19a0934a6e5e28f (diff)
parenta49e11efd9e249cc6d3cf5bcffaafe1e831f2fa9 (diff)
Pull merge from lindenlab/viewer-tools-update (includes viewer-release)
Diffstat (limited to 'indra/llmessage')
-rwxr-xr-xindra/llmessage/llcircuit.cpp78
-rwxr-xr-xindra/llmessage/llcircuit.h5
-rwxr-xr-xindra/llmessage/llhttpclient.cpp2
-rwxr-xr-xindra/llmessage/llmessageconfig.cpp2
-rwxr-xr-xindra/llmessage/llservicebuilder.cpp2
-rwxr-xr-xindra/llmessage/message.cpp4
-rwxr-xr-xindra/llmessage/message.h2
7 files changed, 54 insertions, 41 deletions
diff --git a/indra/llmessage/llcircuit.cpp b/indra/llmessage/llcircuit.cpp
index 3eb0e0d057..8dbe2f8411 100755
--- a/indra/llmessage/llcircuit.cpp
+++ b/indra/llmessage/llcircuit.cpp
@@ -103,6 +103,7 @@ LLCircuitData::LLCircuitData(const LLHost &host, TPACKETID in_id,
mPeakBPSOut(0.f),
mPeriodTime(0.0),
mExistenceTimer(),
+ mAckCreationTime(0.f),
mCurrentResendCount(0),
mLastPacketGap(0),
mHeartbeatInterval(circuit_heartbeat_interval),
@@ -1078,60 +1079,69 @@ BOOL LLCircuitData::collectRAck(TPACKETID packet_num)
}
mAcks.push_back(packet_num);
+ if (mAckCreationTime == 0)
+ {
+ mAckCreationTime = getAgeInSeconds();
+ }
return TRUE;
}
// this method is called during the message system processAcks() to
// send out any acks that did not get sent already.
-void LLCircuit::sendAcks()
+void LLCircuit::sendAcks(F32 collect_time)
{
+ collect_time = llclamp(collect_time, 0.f, LL_COLLECT_ACK_TIME_MAX);
LLCircuitData* cd;
- circuit_data_map::iterator end = mSendAckMap.end();
- for(circuit_data_map::iterator it = mSendAckMap.begin(); it != end; ++it)
+ circuit_data_map::iterator it = mSendAckMap.begin();
+ while (it != mSendAckMap.end())
{
- cd = (*it).second;
-
+ circuit_data_map::iterator cur_it = it++;
+ cd = (*cur_it).second;
S32 count = (S32)cd->mAcks.size();
- if(count > 0)
+ F32 age = cd->getAgeInSeconds() - cd->mAckCreationTime;
+ if (age > collect_time || count == 0)
{
- // send the packet acks
- S32 acks_this_packet = 0;
- for(S32 i = 0; i < count; ++i)
+ if (count>0)
{
- if(acks_this_packet == 0)
+ // send the packet acks
+ S32 acks_this_packet = 0;
+ for(S32 i = 0; i < count; ++i)
{
- gMessageSystem->newMessageFast(_PREHASH_PacketAck);
+ if(acks_this_packet == 0)
+ {
+ gMessageSystem->newMessageFast(_PREHASH_PacketAck);
+ }
+ gMessageSystem->nextBlockFast(_PREHASH_Packets);
+ gMessageSystem->addU32Fast(_PREHASH_ID, cd->mAcks[i]);
+ ++acks_this_packet;
+ if(acks_this_packet > 250)
+ {
+ gMessageSystem->sendMessage(cd->mHost);
+ acks_this_packet = 0;
+ }
}
- gMessageSystem->nextBlockFast(_PREHASH_Packets);
- gMessageSystem->addU32Fast(_PREHASH_ID, cd->mAcks[i]);
- ++acks_this_packet;
- if(acks_this_packet > 250)
+ if(acks_this_packet > 0)
{
gMessageSystem->sendMessage(cd->mHost);
- acks_this_packet = 0;
}
- }
- if(acks_this_packet > 0)
- {
- gMessageSystem->sendMessage(cd->mHost);
- }
- if(gMessageSystem->mVerboseLog)
- {
- std::ostringstream str;
- str << "MSG: -> " << cd->mHost << "\tPACKET ACKS:\t";
- std::ostream_iterator<TPACKETID> append(str, " ");
- std::copy(cd->mAcks.begin(), cd->mAcks.end(), append);
- LL_INFOS() << str.str() << LL_ENDL;
- }
+ if(gMessageSystem->mVerboseLog)
+ {
+ std::ostringstream str;
+ str << "MSG: -> " << cd->mHost << "\tPACKET ACKS:\t";
+ std::ostream_iterator<TPACKETID> append(str, " ");
+ std::copy(cd->mAcks.begin(), cd->mAcks.end(), append);
+ LL_INFOS() << str.str() << LL_ENDL;
+ }
- // empty out the acks list
- cd->mAcks.clear();
+ // empty out the acks list
+ cd->mAcks.clear();
+ cd->mAckCreationTime = 0.f;
+ }
+ // remove data map
+ mSendAckMap.erase(cur_it);
}
}
-
- // All acks have been sent, clear the map
- mSendAckMap.clear();
}
diff --git a/indra/llmessage/llcircuit.h b/indra/llmessage/llcircuit.h
index 5b109fc218..b8021bc9f0 100755
--- a/indra/llmessage/llcircuit.h
+++ b/indra/llmessage/llcircuit.h
@@ -60,6 +60,7 @@ const U8 LL_PACKET_ID_SIZE = 6;
const S32 LL_MAX_RESENT_PACKETS_PER_FRAME = 100;
const S32 LL_MAX_ACKED_PACKETS_PER_FRAME = 200;
+const F32 LL_COLLECT_ACK_TIME_MAX = 2.f;
//
// Prototypes and Predefines
@@ -237,6 +238,7 @@ protected:
packet_time_map mPotentialLostPackets;
packet_time_map mRecentlyReceivedReliablePackets;
std::vector<TPACKETID> mAcks;
+ F32 mAckCreationTime; // first ack creation time
typedef std::map<TPACKETID, LLReliablePacket *> reliable_map;
typedef reliable_map::iterator reliable_iter;
@@ -302,7 +304,7 @@ public:
// this method is called during the message system processAcks()
// to send out any acks that did not get sent already.
- void sendAcks();
+ void sendAcks(F32 collect_time);
friend std::ostream& operator<<(std::ostream& s, LLCircuit &circuit);
void getInfo(LLSD& info) const;
@@ -333,6 +335,7 @@ protected:
circuit_data_map mCircuitData;
typedef std::set<LLCircuitData *, LLCircuitData::less> ping_set_t; // Circuits sorted by next ping time
+
ping_set_t mPingSet;
// This variable points to the last circuit data we found to
diff --git a/indra/llmessage/llhttpclient.cpp b/indra/llmessage/llhttpclient.cpp
index 57cb572b34..60f17e6870 100755
--- a/indra/llmessage/llhttpclient.cpp
+++ b/indra/llmessage/llhttpclient.cpp
@@ -157,7 +157,7 @@ namespace
{
LLBufferStream ostream(channels, buffer.get());
- std::ifstream fstream(mFilename.c_str(), std::iostream::binary | std::iostream::out);
+ llifstream fstream(mFilename.c_str(), std::iostream::binary | std::iostream::out);
if(fstream.is_open())
{
fstream.seekg(0, std::ios::end);
diff --git a/indra/llmessage/llmessageconfig.cpp b/indra/llmessage/llmessageconfig.cpp
index e91051b73e..64e79d6767 100755
--- a/indra/llmessage/llmessageconfig.cpp
+++ b/indra/llmessage/llmessageconfig.cpp
@@ -96,7 +96,7 @@ bool LLMessageConfigFile::loadFile()
{
LLSD data;
{
- std::ifstream file(filename().c_str());
+ llifstream file(filename().c_str());
if (file.is_open())
{
diff --git a/indra/llmessage/llservicebuilder.cpp b/indra/llmessage/llservicebuilder.cpp
index 34ab891830..cf2e42f95c 100755
--- a/indra/llmessage/llservicebuilder.cpp
+++ b/indra/llmessage/llservicebuilder.cpp
@@ -34,7 +34,7 @@
void LLServiceBuilder::loadServiceDefinitionsFromFile(
const std::string& service_filename)
{
- std::ifstream service_file(service_filename.c_str(), std::ios::binary);
+ llifstream service_file(service_filename.c_str(), std::ios::binary);
if(service_file.is_open())
{
LLSD service_data;
diff --git a/indra/llmessage/message.cpp b/indra/llmessage/message.cpp
index 0c3c14969b..e9ce94ab3b 100755
--- a/indra/llmessage/message.cpp
+++ b/indra/llmessage/message.cpp
@@ -787,7 +787,7 @@ S32 LLMessageSystem::getReceiveBytes() const
}
-void LLMessageSystem::processAcks()
+void LLMessageSystem::processAcks(F32 collect_time)
{
F64Seconds mt_sec = getMessageTimeSeconds();
{
@@ -813,7 +813,7 @@ void LLMessageSystem::processAcks()
mCircuitInfo.resendUnackedPackets(mUnackedListDepth, mUnackedListSize);
//cycle through ack list for each host we need to send acks to
- mCircuitInfo.sendAcks();
+ mCircuitInfo.sendAcks(collect_time);
if (!mDenyTrustedCircuitSet.empty())
{
diff --git a/indra/llmessage/message.h b/indra/llmessage/message.h
index da06b64506..348b09b992 100755
--- a/indra/llmessage/message.h
+++ b/indra/llmessage/message.h
@@ -331,7 +331,7 @@ public:
BOOL poll(F32 seconds); // Number of seconds that we want to block waiting for data, returns if data was received
BOOL checkMessages( S64 frame_count = 0 );
- void processAcks();
+ void processAcks(F32 collect_time = 0.f);
BOOL isMessageFast(const char *msg);
BOOL isMessage(const char *msg)