more changes to PollService
parent
5d986002fd
commit
654dd289f2
|
@ -47,6 +47,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
public UUID Id;
|
public UUID Id;
|
||||||
public int TimeOutms;
|
public int TimeOutms;
|
||||||
public EventType Type;
|
public EventType Type;
|
||||||
|
public bool GetEventsNeedsRequest = true;
|
||||||
|
|
||||||
public enum EventType : int
|
public enum EventType : int
|
||||||
{
|
{
|
||||||
|
|
|
@ -205,7 +205,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
String.Format("PollServiceWorkerThread{0}", i),
|
String.Format("PollServiceWorkerThread{0}", i),
|
||||||
ThreadPriority.Normal,
|
ThreadPriority.Normal,
|
||||||
false,
|
false,
|
||||||
true,
|
false,
|
||||||
null,
|
null,
|
||||||
int.MaxValue);
|
int.MaxValue);
|
||||||
}
|
}
|
||||||
|
@ -343,36 +343,37 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id))
|
if (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id))
|
||||||
|
{
|
||||||
|
string strreq = "";
|
||||||
|
if (req.PollServiceArgs.GetEventsNeedsRequest)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
str = new StreamReader(req.Request.Body);
|
str = new StreamReader(req.Request.Body);
|
||||||
|
strreq = str.ReadToEnd();
|
||||||
|
str.Close();
|
||||||
}
|
}
|
||||||
catch (System.ArgumentException)
|
catch
|
||||||
{
|
{
|
||||||
// Stream was not readable means a child agent
|
|
||||||
// was closed due to logout, leaving the
|
|
||||||
// Event Queue request orphaned.
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, strreq);
|
||||||
|
|
||||||
|
if (responsedata == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
// "Normal" means the viewer evebt queue. We need to push these out fast.
|
|
||||||
// Process them inline. The rest go to the thread pool.
|
|
||||||
if (req.PollServiceArgs.Type == PollServiceEventArgs.EventType.Normal)
|
if (req.PollServiceArgs.Type == PollServiceEventArgs.EventType.Normal)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, str.ReadToEnd());
|
|
||||||
DoHTTPGruntWork(m_server, req, responsedata);
|
DoHTTPGruntWork(m_server, req, responsedata);
|
||||||
}
|
}
|
||||||
catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream
|
catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream
|
||||||
{
|
{
|
||||||
// Ignore it, no need to reply
|
// Ignore it, no need to reply
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
{
|
|
||||||
str.Close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -380,27 +381,19 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, str.ReadToEnd());
|
|
||||||
DoHTTPGruntWork(m_server, req, responsedata);
|
DoHTTPGruntWork(m_server, req, responsedata);
|
||||||
}
|
}
|
||||||
catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream
|
catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream
|
||||||
{
|
{
|
||||||
// Ignore it, no need to reply
|
// Ignore it, no need to reply
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
{
|
|
||||||
str.Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}, null);
|
}, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// if ((Environment.TickCount - req.RequestTime) > m_timeout)
|
|
||||||
|
|
||||||
if ((Environment.TickCount - req.RequestTime) > req.PollServiceArgs.TimeOutms)
|
if ((Environment.TickCount - req.RequestTime) > req.PollServiceArgs.TimeOutms)
|
||||||
{
|
{
|
||||||
DoHTTPGruntWork(m_server, req,
|
DoHTTPGruntWork(m_server, req,
|
||||||
|
|
|
@ -160,7 +160,11 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
{
|
{
|
||||||
m_scene = scene;
|
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) =>
|
GetEvents = (x, y, s) =>
|
||||||
{
|
{
|
||||||
lock (responses)
|
lock (responses)
|
||||||
|
@ -247,6 +251,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
PollServiceTextureEventArgs args = new PollServiceTextureEventArgs(agentID, m_scene);
|
PollServiceTextureEventArgs args = new PollServiceTextureEventArgs(agentID, m_scene);
|
||||||
|
|
||||||
args.Type = PollServiceEventArgs.EventType.Texture;
|
args.Type = PollServiceEventArgs.EventType.Texture;
|
||||||
|
args.GetEventsNeedsRequest = false;
|
||||||
MainServer.Instance.AddPollServiceHTTPHandler(capUrl, args);
|
MainServer.Instance.AddPollServiceHTTPHandler(capUrl, args);
|
||||||
|
|
||||||
string hostName = m_scene.RegionInfo.ExternalHostName;
|
string hostName = m_scene.RegionInfo.ExternalHostName;
|
||||||
|
|
|
@ -223,6 +223,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
PollServiceInventoryEventArgs args = new PollServiceInventoryEventArgs(agentID);
|
PollServiceInventoryEventArgs args = new PollServiceInventoryEventArgs(agentID);
|
||||||
|
|
||||||
args.Type = PollServiceEventArgs.EventType.Inventory;
|
args.Type = PollServiceEventArgs.EventType.Inventory;
|
||||||
|
args.GetEventsNeedsRequest = false;
|
||||||
MainServer.Instance.AddPollServiceHTTPHandler(capUrl, args);
|
MainServer.Instance.AddPollServiceHTTPHandler(capUrl, args);
|
||||||
|
|
||||||
string hostName = m_scene.RegionInfo.ExternalHostName;
|
string hostName = m_scene.RegionInfo.ExternalHostName;
|
||||||
|
|
Loading…
Reference in New Issue