diff options
author | John Hurliman | 2009-10-21 16:21:08 -0700 |
---|---|---|
committer | John Hurliman | 2009-10-21 16:21:08 -0700 |
commit | b06f258319f088bcf6658880ed371ef313bac3b6 (patch) | |
tree | 938a7e9b2b07e40627acd74723aa1d2c8f661a67 /OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs | |
parent | * Changed the timing calculations for sending resends/acks/pings from per-cli... (diff) | |
download | opensim-SC-b06f258319f088bcf6658880ed371ef313bac3b6.zip opensim-SC-b06f258319f088bcf6658880ed371ef313bac3b6.tar.gz opensim-SC-b06f258319f088bcf6658880ed371ef313bac3b6.tar.bz2 opensim-SC-b06f258319f088bcf6658880ed371ef313bac3b6.tar.xz |
* FireQueueEmpty now checks if a measurable amount of time has passed, and if not it sleeps for a small amount of time. This throttles OnQueueEmpty calls where there is no callback or the callback is doing very little work
* Changed HandleQueueEmpty()'s Monitor.TryEnter() calls to locks. We want to take our time in this function and do all the work necessary, since returning too fast will induce a sleep anyways
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs index 0a090b4..71f4c47 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs | |||
@@ -535,14 +535,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
535 | ThrottleOutPacketType type = (ThrottleOutPacketType)i; | 535 | ThrottleOutPacketType type = (ThrottleOutPacketType)i; |
536 | QueueEmpty callback = OnQueueEmpty; | 536 | QueueEmpty callback = OnQueueEmpty; |
537 | 537 | ||
538 | int start = Environment.TickCount; | ||
539 | |||
538 | if (callback != null) | 540 | if (callback != null) |
539 | { | 541 | { |
540 | try { callback(type); } | 542 | try { callback(type); } |
541 | catch (Exception e) { m_log.Error("[LLUDPCLIENT]: OnQueueEmpty(" + type + ") threw an exception: " + e.Message, e); } | 543 | catch (Exception e) { m_log.Error("[LLUDPCLIENT]: OnQueueEmpty(" + type + ") threw an exception: " + e.Message, e); } |
542 | } | 544 | } |
543 | 545 | ||
544 | // HACK: Try spending some extra time here to slow down OnQueueEmpty calls | 546 | // Make sure all queue empty calls take at least a measurable amount of time, |
545 | //System.Threading.Thread.Sleep(100); | 547 | // otherwise we'll peg a CPU trying to fire these too fast |
548 | if (Environment.TickCount == start) | ||
549 | System.Threading.Thread.Sleep((int)m_udpServer.TickCountResolution); | ||
546 | 550 | ||
547 | m_onQueueEmptyRunning[i] = false; | 551 | m_onQueueEmptyRunning[i] = false; |
548 | } | 552 | } |