Experimental test to rate limit the incoming packet handler and try to always leave a worker thread available for other tasks

This commit is contained in:
John Hurliman
2009-10-27 14:16:01 -07:00
parent 27ee49f198
commit f89c2cac0f
2 changed files with 29 additions and 0 deletions

View File

@@ -801,6 +801,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
IncomingPacket incomingPacket = null;
// HACK: This is a test to try and rate limit packet handling on Mono.
// If it works, a more elegant solution can be devised
if (Util.FireAndForgetCount() < 2)
{
//m_log.Debug("[LLUDPSERVER]: Incoming packet handler is sleeping");
Thread.Sleep(30);
}
if (packetInbox.Dequeue(100, ref incomingPacket))
Util.FireAndForget(ProcessInPacket, incomingPacket);
}