* Added some code to prevent a spinlock.
parent
7861390f72
commit
b7629d7a3d
|
@ -246,7 +246,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
|
|
||||||
protected virtual void ClientLoop()
|
protected virtual void ClientLoop()
|
||||||
{
|
{
|
||||||
QueItem lastPacket = null;
|
bool queuedLast = false;
|
||||||
|
|
||||||
MainLog.Instance.Verbose("CLIENT", "Entered loop");
|
MainLog.Instance.Verbose("CLIENT", "Entered loop");
|
||||||
while (true)
|
while (true)
|
||||||
|
@ -254,6 +254,8 @@ namespace OpenSim.Region.ClientStack
|
||||||
QueItem nextPacket = PacketQueue.Dequeue();
|
QueItem nextPacket = PacketQueue.Dequeue();
|
||||||
if (nextPacket.Incoming)
|
if (nextPacket.Incoming)
|
||||||
{
|
{
|
||||||
|
queuedLast = false;
|
||||||
|
|
||||||
//is a incoming packet
|
//is a incoming packet
|
||||||
if (nextPacket.Packet.Type != PacketType.AgentUpdate)
|
if (nextPacket.Packet.Type != PacketType.AgentUpdate)
|
||||||
{
|
{
|
||||||
|
@ -269,15 +271,17 @@ namespace OpenSim.Region.ClientStack
|
||||||
{
|
{
|
||||||
PacketQueue.Enqueue(nextPacket);
|
PacketQueue.Enqueue(nextPacket);
|
||||||
|
|
||||||
if (lastPacket == nextPacket)
|
if (queuedLast)
|
||||||
{
|
{
|
||||||
Thread.Sleep(100); // Wait a little while if this was the last packet we saw
|
Thread.Sleep(100); // Wait a little while if this was the last packet we saw
|
||||||
}
|
}
|
||||||
|
queuedLast = true;
|
||||||
lastPacket = nextPacket;
|
lastPacket = nextPacket;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
queuedLast = false;
|
||||||
|
|
||||||
// TODO: May be a bit expensive doing this twice.
|
// TODO: May be a bit expensive doing this twice.
|
||||||
throttleSentPeriod += nextPacket.Packet.ToBytes().Length;
|
throttleSentPeriod += nextPacket.Packet.ToBytes().Length;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue