aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llmessage/llcircuit.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2009-04-30 13:04:20 -0500
committerJacek Antonelli2009-04-30 13:07:16 -0500
commitca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e (patch)
tree8348301d0ac44a524f1819b777686bf086907d76 /linden/indra/llmessage/llcircuit.cpp
parentSecond Life viewer sources 1.22.11 (diff)
downloadmeta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.zip
meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.gz
meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.bz2
meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.xz
Second Life viewer sources 1.23.0-RC
Diffstat (limited to '')
-rw-r--r--linden/indra/llmessage/llcircuit.cpp36
1 files changed, 19 insertions, 17 deletions
diff --git a/linden/indra/llmessage/llcircuit.cpp b/linden/indra/llmessage/llcircuit.cpp
index c58628b..725425c 100644
--- a/linden/indra/llmessage/llcircuit.cpp
+++ b/linden/indra/llmessage/llcircuit.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -62,7 +63,6 @@
62#include "lltransfermanager.h" 63#include "lltransfermanager.h"
63#include "llmodularmath.h" 64#include "llmodularmath.h"
64 65
65const F32 PING_INTERVAL = 5.f; // seconds
66const S32 PING_START_BLOCK = 3; // How many pings behind we have to be to consider ourself blocked. 66const S32 PING_START_BLOCK = 3; // How many pings behind we have to be to consider ourself blocked.
67const S32 PING_RELEASE_BLOCK = 2; // How many pings behind we have to be to consider ourself unblocked. 67const S32 PING_RELEASE_BLOCK = 2; // How many pings behind we have to be to consider ourself unblocked.
68 68
@@ -70,7 +70,8 @@ const F32 TARGET_PERIOD_LENGTH = 5.f; // seconds
70const F32 LL_DUPLICATE_SUPPRESSION_TIMEOUT = 60.f; //seconds - this can be long, as time-based cleanup is 70const F32 LL_DUPLICATE_SUPPRESSION_TIMEOUT = 60.f; //seconds - this can be long, as time-based cleanup is
71 // only done when wrapping packetids, now... 71 // only done when wrapping packetids, now...
72 72
73LLCircuitData::LLCircuitData(const LLHost &host, TPACKETID in_id) 73LLCircuitData::LLCircuitData(const LLHost &host, TPACKETID in_id,
74 const F32 circuit_heartbeat_interval, const F32 circuit_timeout)
74: mHost (host), 75: mHost (host),
75 mWrapID(0), 76 mWrapID(0),
76 mPacketsOutID(0), 77 mPacketsOutID(0),
@@ -105,7 +106,9 @@ LLCircuitData::LLCircuitData(const LLHost &host, TPACKETID in_id)
105 mPeakBPSOut(0), 106 mPeakBPSOut(0),
106 mPeriodTime(0.0), 107 mPeriodTime(0.0),
107 mExistenceTimer(), 108 mExistenceTimer(),
108 mCurrentResendCount(0) 109 mCurrentResendCount(0),
110 mHeartbeatInterval(circuit_heartbeat_interval),
111 mHeartbeatTimeout(circuit_timeout)
109{ 112{
110 // Need to guarantee that this time is up to date, we may be creating a circuit even though we haven't been 113 // Need to guarantee that this time is up to date, we may be creating a circuit even though we haven't been
111 // running a message system loop. 114 // running a message system loop.
@@ -113,9 +116,9 @@ LLCircuitData::LLCircuitData(const LLHost &host, TPACKETID in_id)
113 F32 distribution_offset = ll_frand(); 116 F32 distribution_offset = ll_frand();
114 117
115 mPingTime = mt_sec; 118 mPingTime = mt_sec;
116 mLastPingSendTime = mt_sec + PING_INTERVAL * distribution_offset; 119 mLastPingSendTime = mt_sec + mHeartbeatInterval * distribution_offset;
117 mLastPingReceivedTime = mt_sec; 120 mLastPingReceivedTime = mt_sec;
118 mNextPingSendTime = mLastPingSendTime + 0.95*PING_INTERVAL + ll_frand(0.1f*PING_INTERVAL); 121 mNextPingSendTime = mLastPingSendTime + 0.95*mHeartbeatInterval + ll_frand(0.1f*mHeartbeatInterval);
119 mPeriodTime = mt_sec; 122 mPeriodTime = mt_sec;
120 123
121 mTimeoutCallback = NULL; 124 mTimeoutCallback = NULL;
@@ -429,7 +432,8 @@ S32 LLCircuitData::resendUnackedPackets(const F64 now)
429} 432}
430 433
431 434
432LLCircuit::LLCircuit() : mLastCircuit(NULL) 435LLCircuit::LLCircuit(const F32 circuit_heartbeat_interval, const F32 circuit_timeout) : mLastCircuit(NULL),
436 mHeartbeatInterval(circuit_heartbeat_interval), mHeartbeatTimeout(circuit_timeout)
433{ 437{
434} 438}
435 439
@@ -447,7 +451,7 @@ LLCircuitData *LLCircuit::addCircuitData(const LLHost &host, TPACKETID in_id)
447{ 451{
448 // This should really validate if one already exists 452 // This should really validate if one already exists
449 llinfos << "LLCircuit::addCircuitData for " << host << llendl; 453 llinfos << "LLCircuit::addCircuitData for " << host << llendl;
450 LLCircuitData *tempp = new LLCircuitData(host, in_id); 454 LLCircuitData *tempp = new LLCircuitData(host, in_id, mHeartbeatInterval, mHeartbeatTimeout);
451 mCircuitData.insert(circuit_data_map::value_type(host, tempp)); 455 mCircuitData.insert(circuit_data_map::value_type(host, tempp));
452 mPingSet.insert(tempp); 456 mPingSet.insert(tempp);
453 457
@@ -801,7 +805,7 @@ void LLCircuit::updateWatchDogTimers(LLMessageSystem *msgsys)
801 // Always remember to remove it from the set before changing the sorting 805 // Always remember to remove it from the set before changing the sorting
802 // key (mNextPingSendTime) 806 // key (mNextPingSendTime)
803 mPingSet.erase(psit); 807 mPingSet.erase(psit);
804 cdp->mNextPingSendTime = cur_time + PING_INTERVAL; 808 cdp->mNextPingSendTime = cur_time + mHeartbeatInterval;
805 mPingSet.insert(cdp); 809 mPingSet.insert(cdp);
806 continue; 810 continue;
807 } 811 }
@@ -819,7 +823,7 @@ void LLCircuit::updateWatchDogTimers(LLMessageSystem *msgsys)
819 if (cdp->updateWatchDogTimers(msgsys)) 823 if (cdp->updateWatchDogTimers(msgsys))
820 { 824 {
821 // Randomize our pings a bit by doing some up to 5% early or late 825 // Randomize our pings a bit by doing some up to 5% early or late
822 F64 dt = 0.95f*PING_INTERVAL + ll_frand(0.1f*PING_INTERVAL); 826 F64 dt = 0.95f*mHeartbeatInterval + ll_frand(0.1f*mHeartbeatInterval);
823 827
824 // Remove it, and reinsert it with the new next ping time. 828 // Remove it, and reinsert it with the new next ping time.
825 // Always remove before changing the sorting key. 829 // Always remove before changing the sorting key.
@@ -1047,7 +1051,7 @@ BOOL LLCircuitData::checkCircuitTimeout()
1047 F64 time_since_last_ping = LLMessageSystem::getMessageTimeSeconds() - mLastPingReceivedTime; 1051 F64 time_since_last_ping = LLMessageSystem::getMessageTimeSeconds() - mLastPingReceivedTime;
1048 1052
1049 // Nota Bene: This needs to be turned off if you are debugging multiple simulators 1053 // Nota Bene: This needs to be turned off if you are debugging multiple simulators
1050 if (time_since_last_ping > PING_INTERVAL_MAX) 1054 if (time_since_last_ping > mHeartbeatTimeout)
1051 { 1055 {
1052 llwarns << "LLCircuitData::checkCircuitTimeout for " << mHost << " last ping " << time_since_last_ping << " seconds ago." <<llendl; 1056 llwarns << "LLCircuitData::checkCircuitTimeout for " << mHost << " last ping " << time_since_last_ping << " seconds ago." <<llendl;
1053 setAlive(FALSE); 1057 setAlive(FALSE);
@@ -1063,10 +1067,7 @@ BOOL LLCircuitData::checkCircuitTimeout()
1063 return FALSE; 1067 return FALSE;
1064 } 1068 }
1065 } 1069 }
1066 else if (time_since_last_ping > PING_INTERVAL_ALARM) 1070
1067 {
1068 //llwarns << "Unresponsive circuit: " << mHost << ": " << time_since_last_ping << " seconds since last ping."<< llendl;
1069 }
1070 return TRUE; 1071 return TRUE;
1071} 1072}
1072 1073
@@ -1280,7 +1281,7 @@ void LLCircuitData::pingTimerStop(const U8 ping_id)
1280 delta_ping += 256; 1281 delta_ping += 256;
1281 } 1282 }
1282 1283
1283 U32 msec = (U32) ((delta_ping*PING_INTERVAL + time) * 1000.f); 1284 U32 msec = (U32) ((delta_ping*mHeartbeatInterval + time) * 1000.f);
1284 setPingDelay(msec); 1285 setPingDelay(msec);
1285 1286
1286 mPingsInTransit = delta_ping; 1287 mPingsInTransit = delta_ping;
@@ -1371,7 +1372,8 @@ F32 LLCircuitData::getPingInTransitTime()
1371 1372
1372 if (mPingsInTransit) 1373 if (mPingsInTransit)
1373 { 1374 {
1374 time_since_ping_was_sent = (F32)((mPingsInTransit*PING_INTERVAL - 1) + (LLMessageSystem::getMessageTimeSeconds() - mPingTime))*1000.f; 1375 time_since_ping_was_sent = (F32)((mPingsInTransit*mHeartbeatInterval - 1)
1376 + (LLMessageSystem::getMessageTimeSeconds() - mPingTime))*1000.f;
1375 } 1377 }
1376 1378
1377 return time_since_ping_was_sent; 1379 return time_since_ping_was_sent;