aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
diff options
context:
space:
mode:
authorJohn Hurliman2009-10-21 17:02:55 -0700
committerJohn Hurliman2009-10-21 17:02:55 -0700
commit4e04f6b3a5a875c7d8820c679bcbcdcfba1227bf (patch)
tree945740c616461327a5378365d1fa37b5ca9790ab /OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
parentMerged master into prioritization (diff)
downloadopensim-SC-4e04f6b3a5a875c7d8820c679bcbcdcfba1227bf.zip
opensim-SC-4e04f6b3a5a875c7d8820c679bcbcdcfba1227bf.tar.gz
opensim-SC-4e04f6b3a5a875c7d8820c679bcbcdcfba1227bf.tar.bz2
opensim-SC-4e04f6b3a5a875c7d8820c679bcbcdcfba1227bf.tar.xz
* Clarified what FireQueueEmpty is doing with a MIN_CALLBACK_MS constant and upped it to 30ms
* Removed the unused PacketSent() function * Switched UnackedPacketCollection from a SortedDictionary to a Dictionary now that the sorting is no longer needed. Big performance improvement for ResendUnacked()
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs11
1 files changed, 7 insertions, 4 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
index 71f4c47..2d86a40 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
@@ -531,11 +531,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
531 /// as an object to match the WaitCallback delegate signature</param> 531 /// as an object to match the WaitCallback delegate signature</param>
532 private void FireQueueEmpty(object o) 532 private void FireQueueEmpty(object o)
533 { 533 {
534 const int MIN_CALLBACK_MS = 30;
535
534 int i = (int)o; 536 int i = (int)o;
535 ThrottleOutPacketType type = (ThrottleOutPacketType)i; 537 ThrottleOutPacketType type = (ThrottleOutPacketType)i;
536 QueueEmpty callback = OnQueueEmpty; 538 QueueEmpty callback = OnQueueEmpty;
537 539
538 int start = Environment.TickCount; 540 int start = Environment.TickCount & Int32.MaxValue;
539 541
540 if (callback != null) 542 if (callback != null)
541 { 543 {
@@ -543,10 +545,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
543 catch (Exception e) { m_log.Error("[LLUDPCLIENT]: OnQueueEmpty(" + type + ") threw an exception: " + e.Message, e); } 545 catch (Exception e) { m_log.Error("[LLUDPCLIENT]: OnQueueEmpty(" + type + ") threw an exception: " + e.Message, e); }
544 } 546 }
545 547
546 // Make sure all queue empty calls take at least a measurable amount of time, 548 // Make sure all queue empty calls take at least some amount of time,
547 // otherwise we'll peg a CPU trying to fire these too fast 549 // otherwise we'll peg a CPU trying to fire these too fast
548 if (Environment.TickCount == start) 550 int elapsedMS = (Environment.TickCount & Int32.MaxValue) - start;
549 System.Threading.Thread.Sleep((int)m_udpServer.TickCountResolution); 551 if (elapsedMS < MIN_CALLBACK_MS)
552 System.Threading.Thread.Sleep(MIN_CALLBACK_MS - elapsedMS);
550 553
551 m_onQueueEmptyRunning[i] = false; 554 m_onQueueEmptyRunning[i] = false;
552 } 555 }