diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 9d182b6f78..0e67095146 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -2066,6 +2066,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP while (base.IsRunningOutbound) { Scene.ThreadAlive(2); + + try { m_packetSent = false; @@ -2125,11 +2127,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP // If nothing was sent, sleep for the minimum amount of time before a // token bucket could get more tokens - if (!m_packetSent) - Thread.Sleep((int)TickCountResolution); - - // .... wrong core code removed - + if(Scene.GetNumberOfClients() == 0) + { + Thread.Sleep(250); // be friendly to PIs, but how long ?? + } + else if (!m_packetSent) +// Thread.Sleep((int)TickCountResolution); outch this is bad on linux + Thread.Sleep(15); // match the 16ms of windows7, dont ask 16 or win may decide to do 32ms. Watchdog.UpdateThread(); } diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index cf5705cf26..fac55479e4 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -5409,6 +5409,11 @@ Label_GroupsDone: m_clientManager.ForEachSync(action); } + public int GetNumberOfClients() + { + return m_clientManager.Count; + } + public bool TryGetClient(UUID avatarID, out IClientAPI client) { return m_clientManager.TryGetValue(avatarID, out client);