aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ClientStack')
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/GetDisplayNamesModule.cs7
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs41
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs4
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs152
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs4
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs24
6 files changed, 79 insertions, 153 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetDisplayNamesModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetDisplayNamesModule.cs
index eabacb4..bf559d3 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/GetDisplayNamesModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/GetDisplayNamesModule.cs
@@ -120,14 +120,13 @@ namespace OpenSim.Region.ClientStack.Linden
120 120
121 public virtual void RegisterCaps(UUID agentID, Caps caps) 121 public virtual void RegisterCaps(UUID agentID, Caps caps)
122 { 122 {
123 UUID capID = UUID.Random();
124
125 if (m_URL == "localhost") 123 if (m_URL == "localhost")
126 { 124 {
127 m_log.DebugFormat("[GET_DISPLAY_NAMES]: /CAPS/agents/{0} in region {1}", capID, m_scene.RegionInfo.RegionName); 125 string capUrl = "/CAPS/" + UUID.Random() + "/";
126// m_log.DebugFormat("[GET_DISPLAY_NAMES]: {0} in region {1}", capUrl, m_scene.RegionInfo.RegionName);
128 caps.RegisterHandler( 127 caps.RegisterHandler(
129 "GetDisplayNames", 128 "GetDisplayNames",
130 new GetDisplayNamesHandler("/CAPS/agents" + capID + "/", m_UserManager, "GetDisplayNames", agentID.ToString())); 129 new GetDisplayNamesHandler(capUrl, m_UserManager, "GetDisplayNames", agentID.ToString()));
131 } 130 }
132 else 131 else
133 { 132 {
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 276b367..46c6a19 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -2856,6 +2856,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2856 2856
2857 public void SendSelectedPartsProprieties(List<ISceneEntity> parts) 2857 public void SendSelectedPartsProprieties(List<ISceneEntity> parts)
2858 { 2858 {
2859/* not in use
2859 // udp part 2860 // udp part
2860 ObjectPropertiesPacket packet = 2861 ObjectPropertiesPacket packet =
2861 (ObjectPropertiesPacket)PacketPool.Instance.GetPacket(PacketType.ObjectProperties); 2862 (ObjectPropertiesPacket)PacketPool.Instance.GetPacket(PacketType.ObjectProperties);
@@ -2893,6 +2894,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2893 llsdBody.Add("ObjectData", array); 2894 llsdBody.Add("ObjectData", array);
2894 2895
2895 eq.Enqueue(BuildEvent("ObjectPhysicsProperties", llsdBody),AgentId); 2896 eq.Enqueue(BuildEvent("ObjectPhysicsProperties", llsdBody),AgentId);
2897*/
2896 } 2898 }
2897 2899
2898 2900
@@ -4839,7 +4841,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4839 4841
4840 OpenSim.Framework.Lazy<List<ObjectPropertyUpdate>> propertyUpdates = 4842 OpenSim.Framework.Lazy<List<ObjectPropertyUpdate>> propertyUpdates =
4841 new OpenSim.Framework.Lazy<List<ObjectPropertyUpdate>>(); 4843 new OpenSim.Framework.Lazy<List<ObjectPropertyUpdate>>();
4842 4844
4845 List<SceneObjectPart> needPhysics = new List<SceneObjectPart>();
4846
4843 EntityUpdate iupdate; 4847 EntityUpdate iupdate;
4844 Int32 timeinqueue; // this is just debugging code & can be dropped later 4848 Int32 timeinqueue; // this is just debugging code & can be dropped later
4845 4849
@@ -4867,6 +4871,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4867 if (update.Entity is SceneObjectPart) 4871 if (update.Entity is SceneObjectPart)
4868 { 4872 {
4869 SceneObjectPart sop = (SceneObjectPart)update.Entity; 4873 SceneObjectPart sop = (SceneObjectPart)update.Entity;
4874 needPhysics.Add(sop);
4870 ObjectPropertiesPacket.ObjectDataBlock objPropDB = CreateObjectPropertiesBlock(sop); 4875 ObjectPropertiesPacket.ObjectDataBlock objPropDB = CreateObjectPropertiesBlock(sop);
4871 objectPropertiesBlocks.Value.Add(objPropDB); 4876 objectPropertiesBlocks.Value.Add(objPropDB);
4872 propertyUpdates.Value.Add(update); 4877 propertyUpdates.Value.Add(update);
@@ -4932,7 +4937,31 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4932 // fpcnt++; 4937 // fpcnt++;
4933 // fbcnt++; 4938 // fbcnt++;
4934 } 4939 }
4935 4940 }
4941
4942 if(needPhysics.Count > 0)
4943 {
4944 IEventQueue eq = Scene.RequestModuleInterface<IEventQueue>();
4945 if(eq != null)
4946 {
4947 OSDArray array = new OSDArray();
4948 foreach(SceneObjectPart sop in needPhysics)
4949 {
4950 OSDMap physinfo = new OSDMap(6);
4951 physinfo["LocalID"] = sop.LocalId;
4952 physinfo["Density"] = sop.Density;
4953 physinfo["Friction"] = sop.Friction;
4954 physinfo["GravityMultiplier"] = sop.GravityModifier;
4955 physinfo["Restitution"] = sop.Restitution;
4956 physinfo["PhysicsShapeType"] = (int)sop.PhysicsShapeType;
4957 array.Add(physinfo);
4958 }
4959
4960 OSDMap llsdBody = new OSDMap(1);
4961 llsdBody.Add("ObjectData", array);
4962
4963 eq.Enqueue(BuildEvent("ObjectPhysicsProperties", llsdBody),AgentId);
4964 }
4936 } 4965 }
4937 4966
4938 // m_log.WarnFormat("[PACKETCOUNTS] queued {0} property packets with {1} blocks",ppcnt,pbcnt); 4967 // m_log.WarnFormat("[PACKETCOUNTS] queued {0} property packets with {1} blocks",ppcnt,pbcnt);
@@ -6234,7 +6263,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6234 6263
6235 bool movement = CheckAgentMovementUpdateSignificance(x); 6264 bool movement = CheckAgentMovementUpdateSignificance(x);
6236 bool camera = CheckAgentCameraUpdateSignificance(x); 6265 bool camera = CheckAgentCameraUpdateSignificance(x);
6237 6266
6238 // Was there a significant movement/state change? 6267 // Was there a significant movement/state change?
6239 if (movement) 6268 if (movement)
6240 { 6269 {
@@ -6245,6 +6274,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6245 m_thisAgentUpdateArgs.HeadRotation = x.HeadRotation; 6274 m_thisAgentUpdateArgs.HeadRotation = x.HeadRotation;
6246 m_thisAgentUpdateArgs.State = x.State; 6275 m_thisAgentUpdateArgs.State = x.State;
6247 6276
6277 m_thisAgentUpdateArgs.NeedsCameraCollision = !camera;
6278
6248 UpdateAgent handlerAgentUpdate = OnAgentUpdate; 6279 UpdateAgent handlerAgentUpdate = OnAgentUpdate;
6249 UpdateAgent handlerPreAgentUpdate = OnPreAgentUpdate; 6280 UpdateAgent handlerPreAgentUpdate = OnPreAgentUpdate;
6250 6281
@@ -6253,7 +6284,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6253 6284
6254 if (handlerAgentUpdate != null) 6285 if (handlerAgentUpdate != null)
6255 OnAgentUpdate(this, m_thisAgentUpdateArgs); 6286 OnAgentUpdate(this, m_thisAgentUpdateArgs);
6256 6287
6257 } 6288 }
6258 6289
6259 // Was there a significant camera(s) change? 6290 // Was there a significant camera(s) change?
@@ -6264,6 +6295,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6264 m_thisAgentUpdateArgs.CameraLeftAxis = x.CameraLeftAxis; 6295 m_thisAgentUpdateArgs.CameraLeftAxis = x.CameraLeftAxis;
6265 m_thisAgentUpdateArgs.CameraUpAxis = x.CameraUpAxis; 6296 m_thisAgentUpdateArgs.CameraUpAxis = x.CameraUpAxis;
6266 6297
6298 m_thisAgentUpdateArgs.NeedsCameraCollision = true;
6299
6267 UpdateAgent handlerAgentCameraUpdate = OnAgentCameraUpdate; 6300 UpdateAgent handlerAgentCameraUpdate = OnAgentCameraUpdate;
6268 6301
6269 if (handlerAgentCameraUpdate != null) 6302 if (handlerAgentCameraUpdate != null)
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs
index 246f003..d59b761 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs
@@ -161,6 +161,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
161 /// <summary>Total byte count of unacked packets sent to this client</summary> 161 /// <summary>Total byte count of unacked packets sent to this client</summary>
162 public int UnackedBytes; 162 public int UnackedBytes;
163 163
164 private int m_packetsUnAckReported;
164 /// <summary>Total number of received packets that we have reported to the OnPacketStats event(s)</summary> 165 /// <summary>Total number of received packets that we have reported to the OnPacketStats event(s)</summary>
165 private int m_packetsReceivedReported; 166 private int m_packetsReceivedReported;
166 /// <summary>Total number of sent packets that we have reported to the OnPacketStats event(s)</summary> 167 /// <summary>Total number of sent packets that we have reported to the OnPacketStats event(s)</summary>
@@ -389,11 +390,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
389 { 390 {
390 int newPacketsReceived = PacketsReceived - m_packetsReceivedReported; 391 int newPacketsReceived = PacketsReceived - m_packetsReceivedReported;
391 int newPacketsSent = PacketsSent - m_packetsSentReported; 392 int newPacketsSent = PacketsSent - m_packetsSentReported;
392 393 int newPacketUnAck = UnackedBytes - m_packetsUnAckReported;
393 callback(newPacketsReceived, newPacketsSent, UnackedBytes); 394 callback(newPacketsReceived, newPacketsSent, UnackedBytes);
394 395
395 m_packetsReceivedReported += newPacketsReceived; 396 m_packetsReceivedReported += newPacketsReceived;
396 m_packetsSentReported += newPacketsSent; 397 m_packetsSentReported += newPacketsSent;
398 m_packetsUnAckReported += newPacketUnAck;
397 } 399 }
398 } 400 }
399 401
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
index 0e67095..ffdb639 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>
@@ -456,10 +444,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
456 int now = start; 444 int now = start;
457 while (now == start) 445 while (now == start)
458 now = Environment.TickCount; 446 now = Environment.TickCount;
459 TickCountResolution += (float)(now - start) * 0.1f; 447 TickCountResolution += (float)(now - start);
448 }
449 m_log.Info("[LLUDPSERVER]: Average Environment.TickCount resolution: " + TickCountResolution * 0.1f + "ms");
450
451 TickCountResolution = 0f;
452 for (int i = 0; i < 100; i++)
453 {
454 double start = Util.GetTimeStampMS();
455 double now = start;
456 while (now == start)
457 now = Util.GetTimeStampMS();
458 TickCountResolution += (float)((now - start));
460 } 459 }
461 TickCountResolution = (float)Math.Ceiling(TickCountResolution); 460
462 m_log.Info("[LLUDPSERVER]: Average Environment.TickCount resolution: " + TickCountResolution + "ms"); 461 TickCountResolution = (float)Math.Round(TickCountResolution * 0.01f,6,MidpointRounding.AwayFromZero);
462 m_log.Info("[LLUDPSERVER]: Average Util.GetTimeStampMS resolution: " + TickCountResolution + "ms");
463 463
464 #endregion Environment.TickCount Measurement 464 #endregion Environment.TickCount Measurement
465 465
@@ -467,8 +467,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
467 int sceneThrottleBps = 0; 467 int sceneThrottleBps = 0;
468 bool usePools = false; 468 bool usePools = false;
469 469
470
471
472 IConfig config = configSource.Configs["ClientStack.LindenUDP"]; 470 IConfig config = configSource.Configs["ClientStack.LindenUDP"];
473 if (config != null) 471 if (config != null)
474 { 472 {
@@ -927,10 +925,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
927 } 925 }
928 926
929 PacketPool.Instance.ReturnPacket(packet); 927 PacketPool.Instance.ReturnPacket(packet);
930
931 /// WRONG use. May be usefull in future revision
932// if (packetQueued)
933// m_dataPresentEvent.Set();
934 } 928 }
935 929
936 /// <summary> 930 /// <summary>
@@ -2079,14 +2073,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2079 m_sendPing = false; 2073 m_sendPing = false;
2080 2074
2081 // Update elapsed time 2075 // Update elapsed time
2082 int thisTick = Environment.TickCount & Int32.MaxValue; 2076 double thisTick = Util.GetTimeStampMS();
2083 if (m_tickLastOutgoingPacketHandler > thisTick) 2077 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; 2078 m_tickLastOutgoingPacketHandler = thisTick;
2089 2079
2080 // update some 1ms resolution chained timers
2081
2082 m_elapsedMSOutgoingPacketHandler += deltaMS;
2083
2090 // Check for pending outgoing resends every 100ms 2084 // Check for pending outgoing resends every 100ms
2091 if (m_elapsedMSOutgoingPacketHandler >= 100) 2085 if (m_elapsedMSOutgoingPacketHandler >= 100)
2092 { 2086 {
@@ -2109,15 +2103,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2109 m_sendPing = true; 2103 m_sendPing = true;
2110 m_elapsed500MSOutgoingPacketHandler = 0; 2104 m_elapsed500MSOutgoingPacketHandler = 0;
2111 } 2105 }
2112
2113 #endregion Update Timers 2106 #endregion Update Timers
2114 2107
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 2108 // Handle outgoing packets, resends, acknowledgements, and pings for each
2122 // client. m_packetSent will be set to true if a packet is sent 2109 // client. m_packetSent will be set to true if a packet is sent
2123 Scene.ForEachClient(clientPacketHandler); 2110 Scene.ForEachClient(clientPacketHandler);
@@ -2129,7 +2116,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2129 2116
2130 if(Scene.GetNumberOfClients() == 0) 2117 if(Scene.GetNumberOfClients() == 0)
2131 { 2118 {
2132 Thread.Sleep(250); // be friendly to PIs, but how long ?? 2119 Thread.Sleep(100);
2133 } 2120 }
2134 else if (!m_packetSent) 2121 else if (!m_packetSent)
2135// Thread.Sleep((int)TickCountResolution); outch this is bad on linux 2122// Thread.Sleep((int)TickCountResolution); outch this is bad on linux
@@ -2204,99 +2191,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2204 /// </summary> 2191 /// </summary>
2205 public long IncomingPacketsProcessed { get; protected set; } 2192 public long IncomingPacketsProcessed { get; protected set; }
2206 2193
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 2194 #endregion
2301 2195
2302 protected void ProcessInPacket(IncomingPacket incomingPacket) 2196 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/ClientStack/Linden/UDP/TokenBucket.cs b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs
index 0ac573a..7b9661b 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs
@@ -62,8 +62,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
62 /// </summary> 62 /// </summary>
63 protected const float m_minimumDripRate = 1500; 63 protected const float m_minimumDripRate = 1500;
64 64
65 /// <summary>Time of the last drip, in system ticks</summary> 65 /// <summary>Time of the last drip</summary>
66 protected Int32 m_lastDrip; 66 protected double m_lastDrip;
67 67
68 /// <summary> 68 /// <summary>
69 /// The number of bytes that can be sent at this moment. This is the 69 /// The number of bytes that can be sent at this moment. This is the
@@ -166,10 +166,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
166 /// </summary> 166 /// </summary>
167 protected float m_totalDripRequest; 167 protected float m_totalDripRequest;
168 public float TotalDripRequest 168 public float TotalDripRequest
169 { 169 {
170 get { return m_totalDripRequest; } 170 get { return m_totalDripRequest; }
171 set { m_totalDripRequest = value; } 171 set { m_totalDripRequest = value; }
172 } 172 }
173 173
174#endregion Properties 174#endregion Properties
175 175
@@ -193,9 +193,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
193 Parent = parent; 193 Parent = parent;
194 RequestedDripRate = dripRate; 194 RequestedDripRate = dripRate;
195 RequestedBurst = MaxBurst; 195 RequestedBurst = MaxBurst;
196 // TotalDripRequest = dripRate; // this will be overwritten when a child node registers 196 m_lastDrip = Util.GetTimeStampMS() + 50.0;
197 // MaxBurst = (Int64)((double)dripRate * m_quantumsPerBurst);
198 m_lastDrip = Util.EnvironmentTickCount() + 100000;
199 } 197 }
200 198
201#endregion Constructor 199#endregion Constructor
@@ -210,7 +208,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
210 protected float DripRateModifier() 208 protected float DripRateModifier()
211 { 209 {
212 float driprate = DripRate; 210 float driprate = DripRate;
213 return driprate >= TotalDripRequest ? 1.0f : driprate / TotalDripRequest; 211 return driprate >= TotalDripRequest ? 1.0f : (driprate / TotalDripRequest);
214 } 212 }
215 213
216 /// <summary> 214 /// <summary>
@@ -313,14 +311,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
313 return; 311 return;
314 } 312 }
315 313
316 Int32 now = Util.EnvironmentTickCount(); 314 double now = Util.GetTimeStampMS();
317 Int32 deltaMS = now - m_lastDrip; 315 double deltaMS = now - m_lastDrip;
318 m_lastDrip = now; 316 m_lastDrip = now;
319 317
320 if (deltaMS <= 0) 318 if (deltaMS <= 0)
321 return; 319 return;
322 320
323 m_tokenCount += deltaMS * DripRate * m_timeScale; 321 m_tokenCount += (float)deltaMS * DripRate * m_timeScale;
324 322
325 float burst = Burst; 323 float burst = Burst;
326 if (m_tokenCount > burst) 324 if (m_tokenCount > burst)