diff --git a/OpenSim/Framework/PriorityQueue.cs b/OpenSim/Framework/PriorityQueue.cs
index e7a7f7f13c..e4f1111e02 100644
--- a/OpenSim/Framework/PriorityQueue.cs
+++ b/OpenSim/Framework/PriorityQueue.cs
@@ -45,7 +45,8 @@ namespace OpenSim.Framework
///
/// Total number of queues (priorities) available
///
- public const uint NumberOfQueues = 12;
+
+ public const uint NumberOfQueues = 12; // includes immediate queues, m_queueCounts need to be set acording
///
/// Number of queuest (priorities) that are processed immediately
@@ -60,7 +61,8 @@ namespace OpenSim.Framework
// each pass. weighted towards the higher priority queues
private uint m_nextQueue = 0;
private uint m_countFromQueue = 0;
- private uint[] m_queueCounts = { 8, 4, 4, 2, 2, 2, 2, 1, 1, 1, 1, 1 };
+ // first queues are imediate, so no counts
+ private uint[] m_queueCounts = {0, 0, 8, 4, 4, 2, 2, 2, 2, 1, 1, 1};
// next request is a counter of the number of updates queued, it provides
// a total ordering on the updates coming through the queue and is more
@@ -137,7 +139,7 @@ namespace OpenSim.Framework
///
public bool TryDequeue(out IEntityUpdate value, out Int32 timeinqueue)
{
- // If there is anything in priority queue 0, return it first no
+ // If there is anything in imediate queues, return it first no
// matter what else. Breaks fairness. But very useful.
for (int iq = 0; iq < NumberOfImmediateQueues; iq++)
{
@@ -172,14 +174,13 @@ namespace OpenSim.Framework
}
// Find the next non-immediate queue with updates in it
- for (int i = 0; i < NumberOfQueues; ++i)
+ for (uint i = NumberOfImmediateQueues; i < NumberOfQueues; ++i)
{
- m_nextQueue = (uint)((m_nextQueue + 1) % NumberOfQueues);
- m_countFromQueue = m_queueCounts[m_nextQueue];
+ m_nextQueue++;
+ if(m_nextQueue >= NumberOfQueues)
+ m_nextQueue = NumberOfImmediateQueues;
- // if this is one of the immediate queues, just skip it
- if (m_nextQueue < NumberOfImmediateQueues)
- continue;
+ m_countFromQueue = m_queueCounts[m_nextQueue];
if (m_heaps[m_nextQueue].Count > 0)
{
@@ -189,7 +190,6 @@ namespace OpenSim.Framework
m_lookupTable.Remove(item.Value.Entity.LocalId);
timeinqueue = Util.EnvironmentTickCountSubtract(item.EntryTime);
value = item.Value;
-
return true;
}
}
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs
index a80b1d79fa..9b27a6e05d 100644
--- a/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs
+++ b/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs
@@ -47,6 +47,7 @@ namespace OpenSim.Framework.Servers.HttpServer
public UUID Id;
public int TimeOutms;
public EventType Type;
+ public bool GetEventsNeedsRequest = true;
public enum EventType : int
{
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
index c13c65bc37..c234537794 100644
--- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
+++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
@@ -205,7 +205,7 @@ namespace OpenSim.Framework.Servers.HttpServer
String.Format("PollServiceWorkerThread{0}", i),
ThreadPriority.Normal,
false,
- true,
+ false,
null,
int.MaxValue);
}
@@ -344,35 +344,36 @@ namespace OpenSim.Framework.Servers.HttpServer
{
if (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id))
{
- try
+ string strreq = "";
+ if (req.PollServiceArgs.GetEventsNeedsRequest)
{
- str = new StreamReader(req.Request.Body);
- }
- catch (System.ArgumentException)
- {
- // Stream was not readable means a child agent
- // was closed due to logout, leaving the
- // Event Queue request orphaned.
- continue;
+ try
+ {
+ str = new StreamReader(req.Request.Body);
+ strreq = str.ReadToEnd();
+ str.Close();
+ }
+ catch
+ {
+ continue;
+ }
}
- // "Normal" means the viewer evebt queue. We need to push these out fast.
- // Process them inline. The rest go to the thread pool.
+ Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, strreq);
+
+ if (responsedata == null)
+ continue;
+
if (req.PollServiceArgs.Type == PollServiceEventArgs.EventType.Normal)
{
try
{
- Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, str.ReadToEnd());
DoHTTPGruntWork(m_server, req, responsedata);
}
catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream
{
// Ignore it, no need to reply
}
- finally
- {
- str.Close();
- }
}
else
{
@@ -380,27 +381,19 @@ namespace OpenSim.Framework.Servers.HttpServer
{
try
{
- Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, str.ReadToEnd());
DoHTTPGruntWork(m_server, req, responsedata);
}
catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream
{
// Ignore it, no need to reply
}
- finally
- {
- str.Close();
- }
return null;
}, null);
}
-
}
else
{
-// if ((Environment.TickCount - req.RequestTime) > m_timeout)
-
if ((Environment.TickCount - req.RequestTime) > req.PollServiceArgs.TimeOutms)
{
DoHTTPGruntWork(m_server, req,
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
index b16076d57a..8a607fb3dc 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
@@ -160,7 +160,11 @@ namespace OpenSim.Region.ClientStack.Linden
{
m_scene = scene;
- HasEvents = (x, y) => { lock (responses) return responses.ContainsKey(x); };
+ HasEvents = (x, y) =>
+ {
+ lock (responses)
+ return responses.ContainsKey(x);
+ };
GetEvents = (x, y, s) =>
{
lock (responses)
@@ -247,6 +251,7 @@ namespace OpenSim.Region.ClientStack.Linden
PollServiceTextureEventArgs args = new PollServiceTextureEventArgs(agentID, m_scene);
args.Type = PollServiceEventArgs.EventType.Texture;
+ args.GetEventsNeedsRequest = false;
MainServer.Instance.AddPollServiceHTTPHandler(capUrl, args);
string hostName = m_scene.RegionInfo.ExternalHostName;
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs
index 0f305b117b..56070c6ccb 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs
@@ -223,6 +223,7 @@ namespace OpenSim.Region.ClientStack.Linden
PollServiceInventoryEventArgs args = new PollServiceInventoryEventArgs(agentID);
args.Type = PollServiceEventArgs.EventType.Inventory;
+ args.GetEventsNeedsRequest = false;
MainServer.Instance.AddPollServiceHTTPHandler(capUrl, args);
string hostName = m_scene.RegionInfo.ExternalHostName;