diff options
author | Adam Frisby | 2007-11-09 02:31:40 +0000 |
---|---|---|
committer | Adam Frisby | 2007-11-09 02:31:40 +0000 |
commit | b7629d7a3ddef18674be34f465237490e9ddcd83 (patch) | |
tree | 7937a4c87a7805c45f324d2207658095ded6ce60 /OpenSim | |
parent | * Tweaked how the throttle works. (diff) | |
download | opensim-SC_OLD-b7629d7a3ddef18674be34f465237490e9ddcd83.zip opensim-SC_OLD-b7629d7a3ddef18674be34f465237490e9ddcd83.tar.gz opensim-SC_OLD-b7629d7a3ddef18674be34f465237490e9ddcd83.tar.bz2 opensim-SC_OLD-b7629d7a3ddef18674be34f465237490e9ddcd83.tar.xz |
* Added some code to prevent a spinlock.
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/ClientStack/ClientView.cs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index 75c69c2..5aaffcd 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs | |||
@@ -246,7 +246,7 @@ namespace OpenSim.Region.ClientStack | |||
246 | 246 | ||
247 | protected virtual void ClientLoop() | 247 | protected virtual void ClientLoop() |
248 | { | 248 | { |
249 | QueItem lastPacket = null; | 249 | bool queuedLast = false; |
250 | 250 | ||
251 | MainLog.Instance.Verbose("CLIENT", "Entered loop"); | 251 | MainLog.Instance.Verbose("CLIENT", "Entered loop"); |
252 | while (true) | 252 | while (true) |
@@ -254,6 +254,8 @@ namespace OpenSim.Region.ClientStack | |||
254 | QueItem nextPacket = PacketQueue.Dequeue(); | 254 | QueItem nextPacket = PacketQueue.Dequeue(); |
255 | if (nextPacket.Incoming) | 255 | if (nextPacket.Incoming) |
256 | { | 256 | { |
257 | queuedLast = false; | ||
258 | |||
257 | //is a incoming packet | 259 | //is a incoming packet |
258 | if (nextPacket.Packet.Type != PacketType.AgentUpdate) | 260 | if (nextPacket.Packet.Type != PacketType.AgentUpdate) |
259 | { | 261 | { |
@@ -269,15 +271,17 @@ namespace OpenSim.Region.ClientStack | |||
269 | { | 271 | { |
270 | PacketQueue.Enqueue(nextPacket); | 272 | PacketQueue.Enqueue(nextPacket); |
271 | 273 | ||
272 | if (lastPacket == nextPacket) | 274 | if (queuedLast) |
273 | { | 275 | { |
274 | Thread.Sleep(100); // Wait a little while if this was the last packet we saw | 276 | Thread.Sleep(100); // Wait a little while if this was the last packet we saw |
275 | } | 277 | } |
276 | 278 | queuedLast = true; | |
277 | lastPacket = nextPacket; | 279 | lastPacket = nextPacket; |
278 | } | 280 | } |
279 | else | 281 | else |
280 | { | 282 | { |
283 | queuedLast = false; | ||
284 | |||
281 | // TODO: May be a bit expensive doing this twice. | 285 | // TODO: May be a bit expensive doing this twice. |
282 | throttleSentPeriod += nextPacket.Packet.ToBytes().Length; | 286 | throttleSentPeriod += nextPacket.Packet.ToBytes().Length; |
283 | 287 | ||