Merge branch 'httptests' of opensimulator.org:/var/git/opensim into httptests

This commit is contained in:
UbitUmarov
2016-08-07 00:24:17 +01:00
14 changed files with 355 additions and 5918 deletions

View File

@@ -372,7 +372,7 @@ namespace OpenSim.Region.ClientStack.Linden
caps.RegisterPollHandler(
"EventQueueGet",
new PollServiceEventArgs(null, GenerateEqgCapPath(eventQueueGetUUID), HasEvents, GetEvents, NoEvents, agentID, SERVER_EQ_TIME_NO_EVENTS));
new PollServiceEventArgs(null, GenerateEqgCapPath(eventQueueGetUUID), HasEvents, GetEvents, NoEvents, Drop, agentID, SERVER_EQ_TIME_NO_EVENTS));
}
public bool HasEvents(UUID requestID, UUID agentID)

View File

@@ -222,11 +222,12 @@ namespace OpenSim.Region.ClientStack.Linden
new List<Hashtable>();
private Dictionary<UUID, aPollResponse> responses =
new Dictionary<UUID, aPollResponse>();
private HashSet<UUID> dropedResponses = new HashSet<UUID>();
private Scene m_scene;
private MeshCapsDataThrottler m_throttler;
public PollServiceMeshEventArgs(string uri, UUID pId, Scene scene) :
base(null, uri, null, null, null, pId, int.MaxValue)
base(null, uri, null, null, null, null, pId, int.MaxValue)
{
m_scene = scene;
m_throttler = new MeshCapsDataThrottler(100000, 1400000, 10000, scene, pId);
@@ -241,6 +242,17 @@ namespace OpenSim.Region.ClientStack.Linden
}
};
Drop = (x, y) =>
{
lock (responses)
{
responses.Remove(x);
lock(dropedResponses)
dropedResponses.Add(x);
}
};
GetEvents = (x, y) =>
{
lock (responses)
@@ -298,26 +310,47 @@ namespace OpenSim.Region.ClientStack.Linden
if(m_scene.ShuttingDown)
return;
// If the avatar is gone, don't bother to get the texture
if (m_scene.GetScenePresence(Id) == null)
lock(responses)
{
response = new Hashtable();
lock(dropedResponses)
{
if(dropedResponses.Contains(requestID))
{
dropedResponses.Remove(requestID);
return;
}
}
// If the avatar is gone, don't bother to get the texture
if (m_scene.GetScenePresence(Id) == null)
{
response = new Hashtable();
response["int_response_code"] = 500;
response["str_response_string"] = "Script timeout";
response["content_type"] = "text/plain";
response["keepalive"] = false;
response["reusecontext"] = false;
response["int_response_code"] = 500;
response["str_response_string"] = "Script timeout";
response["content_type"] = "text/plain";
response["keepalive"] = false;
response["reusecontext"] = false;
lock (responses)
responses[requestID] = new aPollResponse() { bytes = 0, response = response, lod = 0 };
return;
return;
}
}
response = m_getMeshHandler.Handle(requestinfo.request);
lock (responses)
{
lock(dropedResponses)
{
if(dropedResponses.Contains(requestID))
{
dropedResponses.Remove(requestID);
return;
}
}
responses[requestID] = new aPollResponse()
{
bytes = (int)response["int_bytes"],

View File

@@ -218,11 +218,12 @@ namespace OpenSim.Region.ClientStack.Linden
new List<Hashtable>();
private Dictionary<UUID, aPollResponse> responses =
new Dictionary<UUID, aPollResponse>();
private HashSet<UUID> dropedResponses = new HashSet<UUID>();
private Scene m_scene;
private CapsDataThrottler m_throttler = new CapsDataThrottler(100000, 1400000,10000);
public PollServiceTextureEventArgs(UUID pId, Scene scene) :
base(null, "", null, null, null, pId, int.MaxValue)
base(null, "", null, null, null, null, pId, int.MaxValue)
{
m_scene = scene;
// x is request id, y is userid
@@ -236,6 +237,16 @@ namespace OpenSim.Region.ClientStack.Linden
}
};
Drop = (x, y) =>
{
lock (responses)
{
responses.Remove(x);
dropedResponses.Add(x);
}
};
GetEvents = (x, y) =>
{
lock (responses)
@@ -304,52 +315,71 @@ namespace OpenSim.Region.ClientStack.Linden
if(m_scene.ShuttingDown)
return;
if (requestinfo.send503)
{
response = new Hashtable();
response["int_response_code"] = 503;
response["str_response_string"] = "Throttled";
response["content_type"] = "text/plain";
response["keepalive"] = false;
response["reusecontext"] = false;
Hashtable headers = new Hashtable();
headers["Retry-After"] = 30;
response["headers"] = headers;
lock (responses)
responses[requestID] = new aPollResponse() {bytes = 0, response = response};
return;
}
// If the avatar is gone, don't bother to get the texture
if (m_scene.GetScenePresence(Id) == null)
{
response = new Hashtable();
response["int_response_code"] = 500;
response["str_response_string"] = "Script timeout";
response["content_type"] = "text/plain";
response["keepalive"] = false;
response["reusecontext"] = false;
lock (responses)
responses[requestID] = new aPollResponse() {bytes = 0, response = response};
return;
}
response = m_getTextureHandler.Handle(requestinfo.request);
lock (responses)
{
responses[requestID] = new aPollResponse()
{
bytes = (int) response["int_bytes"],
response = response
};
lock(dropedResponses)
{
if(dropedResponses.Contains(requestID))
{
dropedResponses.Remove(requestID);
return;
}
}
if (requestinfo.send503)
{
response = new Hashtable();
response["int_response_code"] = 503;
response["str_response_string"] = "Throttled";
response["content_type"] = "text/plain";
response["keepalive"] = false;
response["reusecontext"] = false;
Hashtable headers = new Hashtable();
headers["Retry-After"] = 30;
response["headers"] = headers;
responses[requestID] = new aPollResponse() {bytes = 0, response = response};
return;
}
// If the avatar is gone, don't bother to get the texture
if (m_scene.GetScenePresence(Id) == null)
{
response = new Hashtable();
response["int_response_code"] = 500;
response["str_response_string"] = "Script timeout";
response["content_type"] = "text/plain";
response["keepalive"] = false;
response["reusecontext"] = false;
responses[requestID] = new aPollResponse() {bytes = 0, response = response};
return;
}
}
response = m_getTextureHandler.Handle(requestinfo.request);
lock (responses)
{
lock(dropedResponses)
{
if(dropedResponses.Contains(requestID))
{
dropedResponses.Remove(requestID);
m_throttler.ProcessTime();
return;
}
}
responses[requestID] = new aPollResponse()
{
bytes = (int) response["int_bytes"],
response = response
};
}
m_throttler.ProcessTime();
}
@@ -423,7 +453,6 @@ namespace OpenSim.Region.ClientStack.Linden
internal sealed class CapsDataThrottler
{
private volatile int currenttime = 0;
private volatile int lastTimeElapsed = 0;
private volatile int BytesSent = 0;

View File

@@ -61,7 +61,6 @@ namespace OpenSim.Region.ClientStack.Linden
public UUID reqID;
public Hashtable request;
public ScenePresence presence;
public List<UUID> folders;
}
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -250,17 +249,28 @@ namespace OpenSim.Region.ClientStack.Linden
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private Dictionary<UUID, Hashtable> responses =
new Dictionary<UUID, Hashtable>();
private Dictionary<UUID, Hashtable> responses = new Dictionary<UUID, Hashtable>();
private HashSet<UUID> dropedResponses = new HashSet<UUID>();
private WebFetchInvDescModule m_module;
public PollServiceInventoryEventArgs(WebFetchInvDescModule module, string url, UUID pId) :
base(null, url, null, null, null, pId, int.MaxValue)
base(null, url, null, null, null, null, pId, int.MaxValue)
{
m_module = module;
HasEvents = (x, y) => { lock (responses) return responses.ContainsKey(x); };
Drop = (x, y) =>
{
lock (responses)
{
responses.Remove(x);
lock(dropedResponses)
dropedResponses.Add(x);
}
};
GetEvents = (x, y) =>
{
lock (responses)
@@ -285,8 +295,10 @@ namespace OpenSim.Region.ClientStack.Linden
reqinfo.reqID = x;
reqinfo.request = y;
reqinfo.presence = sp;
reqinfo.folders = new List<UUID>();
/* why where we doing this? just to get cof ?
List<UUID> folders = new List<UUID>();
// Decode the request here
string request = y["body"].ToString();
@@ -322,11 +334,11 @@ namespace OpenSim.Region.ClientStack.Linden
UUID folderID;
if (UUID.TryParse(folder, out folderID))
{
if (!reqinfo.folders.Contains(folderID))
if (!folders.Contains(folderID))
{
if (sp.COF != UUID.Zero && sp.COF == folderID)
highPriority = true;
reqinfo.folders.Add(folderID);
folders.Add(folderID);
}
}
}
@@ -334,6 +346,7 @@ namespace OpenSim.Region.ClientStack.Linden
if (highPriority)
m_queue.PriorityEnqueue(reqinfo);
else
*/
m_queue.Enqueue(reqinfo);
};
@@ -365,6 +378,19 @@ namespace OpenSim.Region.ClientStack.Linden
UUID requestID = requestinfo.reqID;
lock(responses)
{
lock(dropedResponses)
{
if(dropedResponses.Contains(requestID))
{
dropedResponses.Remove(requestID);
return;
}
}
}
Hashtable response = new Hashtable();
response["int_response_code"] = 200;
@@ -377,11 +403,21 @@ namespace OpenSim.Region.ClientStack.Linden
lock (responses)
{
lock(dropedResponses)
{
if(dropedResponses.Contains(requestID))
{
dropedResponses.Remove(requestID);
requestinfo.request.Clear();
WebFetchInvDescModule.ProcessedRequestsCount++;
return;
}
}
if (responses.ContainsKey(requestID))
m_log.WarnFormat("[FETCH INVENTORY DESCENDENTS2 MODULE]: Caught in the act of loosing responses! Please report this on mantis #7054");
responses[requestID] = response;
}
requestinfo.folders.Clear();
requestinfo.request.Clear();
WebFetchInvDescModule.ProcessedRequestsCount++;
}