mirror of
https://github.com/opensim/opensim.git
synced 2026-08-05 17:05:55 +08:00
Merge branch 'master' into careminster
Conflicts: OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
This commit is contained in:
@@ -387,6 +387,8 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
|
||||
if (TryGetPollServiceHTTPHandler(request.UriPath.ToString(), out psEvArgs))
|
||||
{
|
||||
psEvArgs.RequestsReceived++;
|
||||
|
||||
PollServiceHttpRequest psreq = new PollServiceHttpRequest(psEvArgs, context, request);
|
||||
|
||||
if (psEvArgs.Request != null)
|
||||
|
||||
@@ -50,25 +50,39 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
|
||||
public enum EventType : int
|
||||
{
|
||||
Normal = 0,
|
||||
LongPoll = 0,
|
||||
LslHttp = 1,
|
||||
Inventory = 2,
|
||||
Texture = 3,
|
||||
Mesh = 4
|
||||
}
|
||||
|
||||
public string Url { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Number of requests received for this poll service.
|
||||
/// </summary>
|
||||
public int RequestsReceived { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Number of requests handled by this poll service.
|
||||
/// </summary>
|
||||
public int RequestsHandled { get; set; }
|
||||
|
||||
public PollServiceEventArgs(
|
||||
RequestMethod pRequest,
|
||||
string pUrl,
|
||||
HasEventsMethod pHasEvents, GetEventsMethod pGetEvents, NoEventsMethod pNoEvents,
|
||||
UUID pId, int pTimeOutms)
|
||||
{
|
||||
Request = pRequest;
|
||||
Url = pUrl;
|
||||
HasEvents = pHasEvents;
|
||||
GetEvents = pGetEvents;
|
||||
NoEvents = pNoEvents;
|
||||
Id = pId;
|
||||
TimeOutms = pTimeOutms;
|
||||
Type = EventType.Normal;
|
||||
Type = EventType.LongPoll;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,13 +26,19 @@
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using HttpServer;
|
||||
using log4net;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
public class PollServiceHttpRequest
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public readonly PollServiceEventArgs PollServiceArgs;
|
||||
public readonly IHttpClientContext HttpContext;
|
||||
public readonly IHttpRequest Request;
|
||||
@@ -48,5 +54,44 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
RequestTime = System.Environment.TickCount;
|
||||
RequestID = UUID.Random();
|
||||
}
|
||||
|
||||
internal void DoHTTPGruntWork(BaseHttpServer server, Hashtable responsedata)
|
||||
{
|
||||
OSHttpResponse response
|
||||
= new OSHttpResponse(new HttpResponse(HttpContext, Request), HttpContext);
|
||||
|
||||
byte[] buffer = server.DoHTTPGruntWork(responsedata, response);
|
||||
|
||||
response.SendChunked = false;
|
||||
response.ContentLength64 = buffer.Length;
|
||||
response.ContentEncoding = Encoding.UTF8;
|
||||
|
||||
try
|
||||
{
|
||||
response.OutputStream.Write(buffer, 0, buffer.Length);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
m_log.Warn(string.Format("[POLL SERVICE WORKER THREAD]: Error ", ex));
|
||||
}
|
||||
finally
|
||||
{
|
||||
//response.OutputStream.Close();
|
||||
try
|
||||
{
|
||||
response.OutputStream.Flush();
|
||||
response.Send();
|
||||
|
||||
//if (!response.KeepAlive && response.ReuseContext)
|
||||
// response.FreeContext();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Warn(String.Format("[POLL SERVICE WORKER THREAD]: Error ", e));
|
||||
}
|
||||
|
||||
PollServiceArgs.RequestsHandled++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -105,7 +105,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
if (m_running)
|
||||
{
|
||||
if (req.PollServiceArgs.Type != PollServiceEventArgs.EventType.Normal)
|
||||
if (req.PollServiceArgs.Type != PollServiceEventArgs.EventType.LongPoll)
|
||||
{
|
||||
m_requests.Enqueue(req);
|
||||
}
|
||||
@@ -207,7 +207,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
if (responsedata == null)
|
||||
continue;
|
||||
|
||||
if (req.PollServiceArgs.Type == PollServiceEventArgs.EventType.Normal) // This is the event queue
|
||||
if (req.PollServiceArgs.Type == PollServiceEventArgs.EventType.LongPoll) // This is the event queue
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user