diff options
3 files changed, 10 insertions, 153 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 0e67095..8355f2b 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | |||
@@ -323,7 +323,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
323 | protected int m_elapsedMSSinceLastStatReport = 0; | 323 | protected int m_elapsedMSSinceLastStatReport = 0; |
324 | 324 | ||
325 | /// <summary>Environment.TickCount of the last time the outgoing packet handler executed</summary> | 325 | /// <summary>Environment.TickCount of the last time the outgoing packet handler executed</summary> |
326 | protected int m_tickLastOutgoingPacketHandler; | 326 | protected double m_tickLastOutgoingPacketHandler; |
327 | 327 | ||
328 | /// <summary>Keeps track of the number of elapsed milliseconds since the last time the outgoing packet handler looped</summary> | 328 | /// <summary>Keeps track of the number of elapsed milliseconds since the last time the outgoing packet handler looped</summary> |
329 | protected int m_elapsedMSOutgoingPacketHandler; | 329 | protected int m_elapsedMSOutgoingPacketHandler; |
@@ -356,20 +356,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
356 | } | 356 | } |
357 | } | 357 | } |
358 | 358 | ||
359 | |||
360 | |||
361 | protected ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>> m_pendingCache = new ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>>(); | 359 | protected ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>> m_pendingCache = new ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>>(); |
362 | 360 | ||
363 | /// <summary> | ||
364 | /// Event used to signal when queued packets are available for sending. | ||
365 | /// </summary> | ||
366 | /// <remarks> | ||
367 | /// This allows the outbound loop to only operate when there is data to send rather than continuously polling. | ||
368 | /// Some data is sent immediately and not queued. That data would not trigger this event. | ||
369 | /// WRONG use. May be usefull in future revision | ||
370 | /// </remarks> | ||
371 | // protected AutoResetEvent m_dataPresentEvent = new AutoResetEvent(false); | ||
372 | |||
373 | protected Pool<IncomingPacket> m_incomingPacketPool; | 361 | protected Pool<IncomingPacket> m_incomingPacketPool; |
374 | 362 | ||
375 | /// <summary> | 363 | /// <summary> |
@@ -467,8 +455,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
467 | int sceneThrottleBps = 0; | 455 | int sceneThrottleBps = 0; |
468 | bool usePools = false; | 456 | bool usePools = false; |
469 | 457 | ||
470 | |||
471 | |||
472 | IConfig config = configSource.Configs["ClientStack.LindenUDP"]; | 458 | IConfig config = configSource.Configs["ClientStack.LindenUDP"]; |
473 | if (config != null) | 459 | if (config != null) |
474 | { | 460 | { |
@@ -927,10 +913,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
927 | } | 913 | } |
928 | 914 | ||
929 | PacketPool.Instance.ReturnPacket(packet); | 915 | PacketPool.Instance.ReturnPacket(packet); |
930 | |||
931 | /// WRONG use. May be usefull in future revision | ||
932 | // if (packetQueued) | ||
933 | // m_dataPresentEvent.Set(); | ||
934 | } | 916 | } |
935 | 917 | ||
936 | /// <summary> | 918 | /// <summary> |
@@ -2079,14 +2061,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2079 | m_sendPing = false; | 2061 | m_sendPing = false; |
2080 | 2062 | ||
2081 | // Update elapsed time | 2063 | // Update elapsed time |
2082 | int thisTick = Environment.TickCount & Int32.MaxValue; | 2064 | double thisTick = Util.GetTimeStampMS(); |
2083 | if (m_tickLastOutgoingPacketHandler > thisTick) | 2065 | int deltaMS = (int)(thisTick - m_tickLastOutgoingPacketHandler); |
2084 | m_elapsedMSOutgoingPacketHandler += ((Int32.MaxValue - m_tickLastOutgoingPacketHandler) + thisTick); | ||
2085 | else | ||
2086 | m_elapsedMSOutgoingPacketHandler += (thisTick - m_tickLastOutgoingPacketHandler); | ||
2087 | |||
2088 | m_tickLastOutgoingPacketHandler = thisTick; | 2066 | m_tickLastOutgoingPacketHandler = thisTick; |
2089 | 2067 | ||
2068 | // update some 1ms resolution chained timers | ||
2069 | |||
2070 | m_elapsedMSOutgoingPacketHandler += deltaMS; | ||
2071 | |||
2090 | // Check for pending outgoing resends every 100ms | 2072 | // Check for pending outgoing resends every 100ms |
2091 | if (m_elapsedMSOutgoingPacketHandler >= 100) | 2073 | if (m_elapsedMSOutgoingPacketHandler >= 100) |
2092 | { | 2074 | { |
@@ -2109,15 +2091,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2109 | m_sendPing = true; | 2091 | m_sendPing = true; |
2110 | m_elapsed500MSOutgoingPacketHandler = 0; | 2092 | m_elapsed500MSOutgoingPacketHandler = 0; |
2111 | } | 2093 | } |
2112 | |||
2113 | #endregion Update Timers | 2094 | #endregion Update Timers |
2114 | 2095 | ||
2115 | // Use this for emergency monitoring -- bug hunting | ||
2116 | //if (m_scene.EmergencyMonitoring) | ||
2117 | // clientPacketHandler = MonitoredClientOutgoingPacketHandler; | ||
2118 | //else | ||
2119 | // clientPacketHandler = ClientOutgoingPacketHandler; | ||
2120 | |||
2121 | // Handle outgoing packets, resends, acknowledgements, and pings for each | 2096 | // Handle outgoing packets, resends, acknowledgements, and pings for each |
2122 | // client. m_packetSent will be set to true if a packet is sent | 2097 | // client. m_packetSent will be set to true if a packet is sent |
2123 | Scene.ForEachClient(clientPacketHandler); | 2098 | Scene.ForEachClient(clientPacketHandler); |
@@ -2129,7 +2104,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2129 | 2104 | ||
2130 | if(Scene.GetNumberOfClients() == 0) | 2105 | if(Scene.GetNumberOfClients() == 0) |
2131 | { | 2106 | { |
2132 | Thread.Sleep(250); // be friendly to PIs, but how long ?? | 2107 | Thread.Sleep(100); |
2133 | } | 2108 | } |
2134 | else if (!m_packetSent) | 2109 | else if (!m_packetSent) |
2135 | // Thread.Sleep((int)TickCountResolution); outch this is bad on linux | 2110 | // Thread.Sleep((int)TickCountResolution); outch this is bad on linux |
@@ -2204,99 +2179,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2204 | /// </summary> | 2179 | /// </summary> |
2205 | public long IncomingPacketsProcessed { get; protected set; } | 2180 | public long IncomingPacketsProcessed { get; protected set; } |
2206 | 2181 | ||
2207 | protected void MonitoredClientOutgoingPacketHandler(IClientAPI client) | ||
2208 | { | ||
2209 | nticks++; | ||
2210 | watch1.Start(); | ||
2211 | m_currentOutgoingClient = client; | ||
2212 | |||
2213 | try | ||
2214 | { | ||
2215 | if (client is LLClientView) | ||
2216 | { | ||
2217 | LLClientView llClient = (LLClientView)client; | ||
2218 | LLUDPClient udpClient = llClient.UDPClient; | ||
2219 | |||
2220 | if (udpClient.IsConnected) | ||
2221 | { | ||
2222 | if (m_resendUnacked) | ||
2223 | { | ||
2224 | nticksUnack++; | ||
2225 | watch2.Start(); | ||
2226 | |||
2227 | HandleUnacked(llClient); | ||
2228 | |||
2229 | watch2.Stop(); | ||
2230 | avgResendUnackedTicks = (nticksUnack - 1)/(float)nticksUnack * avgResendUnackedTicks + (watch2.ElapsedTicks / (float)nticksUnack); | ||
2231 | watch2.Reset(); | ||
2232 | } | ||
2233 | |||
2234 | if (m_sendAcks) | ||
2235 | { | ||
2236 | nticksAck++; | ||
2237 | watch2.Start(); | ||
2238 | |||
2239 | SendAcks(udpClient); | ||
2240 | |||
2241 | watch2.Stop(); | ||
2242 | avgSendAcksTicks = (nticksAck - 1) / (float)nticksAck * avgSendAcksTicks + (watch2.ElapsedTicks / (float)nticksAck); | ||
2243 | watch2.Reset(); | ||
2244 | } | ||
2245 | |||
2246 | if (m_sendPing) | ||
2247 | { | ||
2248 | nticksPing++; | ||
2249 | watch2.Start(); | ||
2250 | |||
2251 | SendPing(udpClient); | ||
2252 | |||
2253 | watch2.Stop(); | ||
2254 | avgSendPingTicks = (nticksPing - 1) / (float)nticksPing * avgSendPingTicks + (watch2.ElapsedTicks / (float)nticksPing); | ||
2255 | watch2.Reset(); | ||
2256 | } | ||
2257 | |||
2258 | watch2.Start(); | ||
2259 | // Dequeue any outgoing packets that are within the throttle limits | ||
2260 | if (udpClient.DequeueOutgoing()) | ||
2261 | { | ||
2262 | m_packetSent = true; | ||
2263 | npacksSent++; | ||
2264 | } | ||
2265 | else | ||
2266 | { | ||
2267 | npackNotSent++; | ||
2268 | } | ||
2269 | |||
2270 | watch2.Stop(); | ||
2271 | avgDequeueTicks = (nticks - 1) / (float)nticks * avgDequeueTicks + (watch2.ElapsedTicks / (float)nticks); | ||
2272 | watch2.Reset(); | ||
2273 | |||
2274 | } | ||
2275 | else | ||
2276 | { | ||
2277 | m_log.WarnFormat("[LLUDPSERVER]: Client is not connected"); | ||
2278 | } | ||
2279 | } | ||
2280 | } | ||
2281 | catch (Exception ex) | ||
2282 | { | ||
2283 | m_log.Error("[LLUDPSERVER]: OutgoingPacketHandler iteration for " + client.Name + | ||
2284 | " threw an exception: " + ex.Message, ex); | ||
2285 | } | ||
2286 | watch1.Stop(); | ||
2287 | avgProcessingTicks = (nticks - 1) / (float)nticks * avgProcessingTicks + (watch1.ElapsedTicks / (float)nticks); | ||
2288 | watch1.Reset(); | ||
2289 | |||
2290 | // reuse this -- it's every ~100ms | ||
2291 | if (Scene.EmergencyMonitoring && nticks % 100 == 0) | ||
2292 | { | ||
2293 | m_log.InfoFormat("[LLUDPSERVER]: avg processing ticks: {0} avg unacked: {1} avg acks: {2} avg ping: {3} avg dequeue: {4} (TickCountRes: {5} sent: {6} notsent: {7})", | ||
2294 | avgProcessingTicks, avgResendUnackedTicks, avgSendAcksTicks, avgSendPingTicks, avgDequeueTicks, TickCountResolution, npacksSent, npackNotSent); | ||
2295 | npackNotSent = npacksSent = 0; | ||
2296 | } | ||
2297 | |||
2298 | } | ||
2299 | |||
2300 | #endregion | 2182 | #endregion |
2301 | 2183 | ||
2302 | protected void ProcessInPacket(IncomingPacket incomingPacket) | 2184 | protected void ProcessInPacket(IncomingPacket incomingPacket) |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs b/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs index a476b91..6278e36 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs | |||
@@ -92,8 +92,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
92 | Asset = throttleConfig.GetInt("asset_default", 10500); | 92 | Asset = throttleConfig.GetInt("asset_default", 10500); |
93 | 93 | ||
94 | Total = Resend + Land + Wind + Cloud + Task + Texture + Asset; | 94 | Total = Resend + Land + Wind + Cloud + Task + Texture + Asset; |
95 | // 3000000 bps default max | 95 | // 5120000 bps default max |
96 | ClientMaxRate = throttleConfig.GetInt("client_throttle_max_bps", 375000); | 96 | ClientMaxRate = throttleConfig.GetInt("client_throttle_max_bps", 640000); |
97 | if (ClientMaxRate > 1000000) | 97 | if (ClientMaxRate > 1000000) |
98 | ClientMaxRate = 1000000; // no more than 8Mbps | 98 | ClientMaxRate = 1000000; // no more than 8Mbps |
99 | 99 | ||
diff --git a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs index 08d0fbf..071530b 100644 --- a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs +++ b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs | |||
@@ -126,13 +126,6 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden | |||
126 | (mod, cmd) => MainConsole.Instance.Output(GetThrottlesReport(cmd))); | 126 | (mod, cmd) => MainConsole.Instance.Output(GetThrottlesReport(cmd))); |
127 | 127 | ||
128 | scene.AddCommand( | 128 | scene.AddCommand( |
129 | "Comms", this, "emergency-monitoring", | ||
130 | "emergency-monitoring", | ||
131 | "Go on/off emergency monitoring mode", | ||
132 | "Go on/off emergency monitoring mode", | ||
133 | HandleEmergencyMonitoring); | ||
134 | |||
135 | scene.AddCommand( | ||
136 | "Comms", this, "show client stats", | 129 | "Comms", this, "show client stats", |
137 | "show client stats [first_name last_name]", | 130 | "show client stats [first_name last_name]", |
138 | "Show client request stats", | 131 | "Show client request stats", |
@@ -197,24 +190,6 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden | |||
197 | return report.ToString(); | 190 | return report.ToString(); |
198 | } | 191 | } |
199 | 192 | ||
200 | protected void HandleEmergencyMonitoring(string module, string[] cmd) | ||
201 | { | ||
202 | bool mode = true; | ||
203 | if (cmd.Length == 1 || (cmd.Length > 1 && cmd[1] == "on")) | ||
204 | { | ||
205 | mode = true; | ||
206 | MainConsole.Instance.Output("Emergency Monitoring ON"); | ||
207 | } | ||
208 | else | ||
209 | { | ||
210 | mode = false; | ||
211 | MainConsole.Instance.Output("Emergency Monitoring OFF"); | ||
212 | } | ||
213 | |||
214 | foreach (Scene s in m_scenes.Values) | ||
215 | s.EmergencyMonitoring = mode; | ||
216 | } | ||
217 | |||
218 | protected string GetColumnEntry(string entry, int maxLength, int columnPadding) | 193 | protected string GetColumnEntry(string entry, int maxLength, int columnPadding) |
219 | { | 194 | { |
220 | return string.Format( | 195 | return string.Format( |