some cleanup

httptests
UbitUmarov 2016-12-27 12:26:08 +00:00
parent 52e7fc31f7
commit 5c79e03f18
2 changed files with 3 additions and 45 deletions

View File

@ -64,10 +64,7 @@ namespace OpenSim.Capabilities.Handlers
Hashtable ret = new Hashtable();
ret["int_response_code"] = (int)System.Net.HttpStatusCode.NotFound;
ret["content_type"] = "text/plain";
ret["keepalive"] = false;
ret["reusecontext"] = false;
ret["int_bytes"] = 0;
ret["int_lod"] = 0;
string MeshStr = (string)request["mesh_id"];
@ -76,6 +73,8 @@ namespace OpenSim.Capabilities.Handlers
if (m_assetService == null)
{
m_log.Error("[GETMESH]: Cannot fetch mesh " + MeshStr + " without an asset service");
ret["keepalive"] = false;
return ret;
}
UUID meshID;
@ -101,10 +100,7 @@ namespace OpenSim.Capabilities.Handlers
Hashtable responsedata = new Hashtable();
responsedata["int_response_code"] = 400; //501; //410; //404;
responsedata["content_type"] = "text/plain";
responsedata["keepalive"] = false;
responsedata["str_response_string"] = "Request wasn't what was expected";
responsedata["reusecontext"] = false;
responsedata["int_lod"] = 0;
responsedata["int_bytes"] = 0;
string meshStr = string.Empty;
@ -118,10 +114,8 @@ namespace OpenSim.Capabilities.Handlers
if (m_assetService == null)
{
responsedata["int_response_code"] = 404; //501; //410; //404;
responsedata["content_type"] = "text/plain";
responsedata["keepalive"] = false;
responsedata["str_response_string"] = "The asset service is unavailable. So is your mesh.";
responsedata["reusecontext"] = false;
return responsedata;
}
@ -155,10 +149,7 @@ namespace OpenSim.Capabilities.Handlers
{
responsedata["int_response_code"] = 404; //501; //410; //404;
responsedata["content_type"] = "text/plain";
responsedata["keepalive"] = false;
responsedata["str_response_string"] = "This range doesnt exist.";
responsedata["reusecontext"] = false;
responsedata["int_lod"] = 3;
return responsedata;
}
else
@ -169,28 +160,11 @@ namespace OpenSim.Capabilities.Handlers
//m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID);
if (start > 20000)
{
responsedata["int_lod"] = 3;
}
else if (start < 4097)
{
responsedata["int_lod"] = 1;
}
else
{
responsedata["int_lod"] = 2;
}
if (start == 0 && len == mesh.Data.Length) // well redudante maybe
{
responsedata["int_response_code"] = (int)System.Net.HttpStatusCode.OK;
responsedata["bin_response_data"] = mesh.Data;
responsedata["int_bytes"] = mesh.Data.Length;
responsedata["reusecontext"] = false;
responsedata["int_lod"] = 3;
}
else
{
@ -203,7 +177,6 @@ namespace OpenSim.Capabilities.Handlers
Array.Copy(mesh.Data, start, d, 0, len);
responsedata["bin_response_data"] = d;
responsedata["int_bytes"] = len;
responsedata["reusecontext"] = false;
}
}
}
@ -213,8 +186,6 @@ namespace OpenSim.Capabilities.Handlers
responsedata["str_response_string"] = Convert.ToBase64String(mesh.Data);
responsedata["content_type"] = "application/vnd.ll.mesh";
responsedata["int_response_code"] = 200;
responsedata["reusecontext"] = false;
responsedata["int_lod"] = 3;
}
}
else
@ -222,8 +193,6 @@ namespace OpenSim.Capabilities.Handlers
responsedata["str_response_string"] = Convert.ToBase64String(mesh.Data);
responsedata["content_type"] = "application/vnd.ll.mesh";
responsedata["int_response_code"] = 200;
responsedata["reusecontext"] = false;
responsedata["int_lod"] = 3;
}
}
// Optionally add additional mesh types here
@ -231,10 +200,7 @@ namespace OpenSim.Capabilities.Handlers
{
responsedata["int_response_code"] = 404; //501; //410; //404;
responsedata["content_type"] = "text/plain";
responsedata["keepalive"] = false;
responsedata["str_response_string"] = "Unfortunately, this asset isn't a mesh.";
responsedata["reusecontext"] = false;
responsedata["int_lod"] = 1;
return responsedata;
}
}
@ -242,10 +208,7 @@ namespace OpenSim.Capabilities.Handlers
{
responsedata["int_response_code"] = 404; //501; //410; //404;
responsedata["content_type"] = "text/plain";
responsedata["keepalive"] = false;
responsedata["str_response_string"] = "Your Mesh wasn't found. Sorry!";
responsedata["reusecontext"] = false;
responsedata["int_lod"] = 0;
return responsedata;
}
}

View File

@ -76,7 +76,6 @@ namespace OpenSim.Region.ClientStack.Linden
{
public Hashtable response;
public int bytes;
public int lod;
}
@ -330,9 +329,7 @@ namespace OpenSim.Region.ClientStack.Linden
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, lod = 0 };
responses[requestID] = new aPollResponse() { bytes = 0, response = response};
return;
}
@ -354,7 +351,6 @@ namespace OpenSim.Region.ClientStack.Linden
responses[requestID] = new aPollResponse()
{
bytes = (int)response["int_bytes"],
lod = (int)response["int_lod"],
response = response
};
@ -423,7 +419,6 @@ namespace OpenSim.Region.ClientStack.Linden
private volatile int lastTimeElapsed = 0;
private volatile int BytesSent = 0;
private int CapSetThrottle = 0;
private float CapThrottleDistributon = 0.30f;
private readonly Scene m_scene;
private ThrottleOutPacketType Throttle;
private readonly UUID User;