Merge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork

avinationmerge
ubit 2012-07-06 02:10:05 +02:00
commit a2c0de4c10
5 changed files with 56 additions and 17 deletions

View File

@ -226,7 +226,9 @@ namespace OpenSim.Capabilities.Handlers
// sending back the last byte instead of an error status
if (start >= texture.Data.Length)
{
response.StatusCode = (int)System.Net.HttpStatusCode.RequestedRangeNotSatisfiable;
// response.StatusCode = (int)System.Net.HttpStatusCode.RequestedRangeNotSatisfiable;
// viewers don't seem to handle RequestedRangeNotSatisfiable and keep retrying with same parameters
response.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
}
else
{

View File

@ -45,6 +45,13 @@ namespace OpenSim.Framework.Servers.HttpServer
public RequestMethod Request;
public UUID Id;
public int TimeOutms;
public EventType Type;
public enum EventType : int
{
Normal = 0,
LslHttp = 1
}
public PollServiceEventArgs(RequestMethod pRequest, HasEventsMethod pHasEvents, GetEventsMethod pGetEvents, NoEventsMethod pNoEvents, UUID pId, int pTimeOutms)
{
@ -54,6 +61,7 @@ namespace OpenSim.Framework.Servers.HttpServer
NoEvents = pNoEvents;
Id = pId;
TimeOutms = pTimeOutms;
Type = EventType.Normal;
}
}
}

View File

@ -174,13 +174,15 @@ namespace OpenSim.Framework.Servers.HttpServer
private readonly BaseHttpServer m_server;
private BlockingQueue<PollServiceHttpRequest> m_requests = new BlockingQueue<PollServiceHttpRequest>();
private static Queue<PollServiceHttpRequest> m_retry_requests = new Queue<PollServiceHttpRequest>();
private static Queue<PollServiceHttpRequest> m_slowRequests = new Queue<PollServiceHttpRequest>();
private static Queue<PollServiceHttpRequest> m_retryRequests = new Queue<PollServiceHttpRequest>();
private uint m_WorkerThreadCount = 0;
private Thread[] m_workerThreads;
private Thread m_retrysThread;
private bool m_running = true;
private int slowCount = 0;
// private int m_timeout = 1000; // increase timeout 250; now use the event one
@ -195,7 +197,7 @@ namespace OpenSim.Framework.Servers.HttpServer
{
m_workerThreads[i]
= Watchdog.StartThread(
poolWorkerJob,
PoolWorkerJob,
String.Format("PollServiceWorkerThread{0}", i),
ThreadPriority.Normal,
false,
@ -217,15 +219,25 @@ namespace OpenSim.Framework.Servers.HttpServer
{
if (m_running)
{
lock (m_retry_requests)
m_retry_requests.Enqueue(req);
lock (m_retryRequests)
m_retryRequests.Enqueue(req);
}
}
public void Enqueue(PollServiceHttpRequest req)
{
if (m_running)
m_requests.Enqueue(req);
{
if (req.PollServiceArgs.Type == PollServiceEventArgs.EventType.LslHttp)
{
m_requests.Enqueue(req);
}
else
{
lock (m_slowRequests)
m_slowRequests.Enqueue(req);
}
}
}
private void CheckRetries()
@ -234,10 +246,21 @@ namespace OpenSim.Framework.Servers.HttpServer
{
Thread.Sleep(100); // let the world move .. back to faster rate
Watchdog.UpdateThread();
lock (m_retry_requests)
lock (m_retryRequests)
{
while (m_retry_requests.Count > 0 && m_running)
Enqueue(m_retry_requests.Dequeue());
while (m_retryRequests.Count > 0 && m_running)
m_requests.Enqueue(m_retryRequests.Dequeue());
}
slowCount++;
if (slowCount >= 10)
{
slowCount = 0;
lock (m_slowRequests)
{
while (m_slowRequests.Count > 0 && m_running)
m_requests.Enqueue(m_slowRequests.Dequeue());
}
}
}
}
@ -261,7 +284,7 @@ namespace OpenSim.Framework.Servers.HttpServer
try
{
foreach (PollServiceHttpRequest req in m_retry_requests)
foreach (PollServiceHttpRequest req in m_retryRequests)
{
m_server.DoHTTPGruntWork(
req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id),
@ -273,7 +296,13 @@ namespace OpenSim.Framework.Servers.HttpServer
}
PollServiceHttpRequest wreq;
m_retry_requests.Clear();
m_retryRequests.Clear();
lock (m_slowRequests)
{
while (m_slowRequests.Count > 0 && m_running)
m_requests.Enqueue(m_slowRequests.Dequeue());
}
while (m_requests.Count() > 0)
{
@ -294,7 +323,7 @@ namespace OpenSim.Framework.Servers.HttpServer
// work threads
private void poolWorkerJob()
private void PoolWorkerJob()
{
PollServiceHttpRequest req;
StreamReader str;

View File

@ -172,9 +172,9 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
string uri = "/lslhttp/" + urlcode.ToString();
m_HttpServer.AddPollServiceHTTPHandler(
uri,
new PollServiceEventArgs(HttpRequestHandler, HasEvents, GetEvents, NoEvents, urlcode,25000));
PollServiceEventArgs args = new PollServiceEventArgs(HttpRequestHandler, HasEvents, GetEvents, NoEvents, urlcode, 25000);
args.Type = PollServiceEventArgs.EventType.LslHttp;
m_HttpServer.AddPollServiceHTTPHandler(uri, args);
engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_GRANTED", url });
}
@ -422,7 +422,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
}
private Hashtable GetEvents(UUID requestID, UUID sessionID, string request)
{
UrlData url = null;
UrlData url = null;
RequestData requestData = null;
lock (m_RequestMap)

View File

@ -7479,7 +7479,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_String llSHA1String(string src)
{
m_host.AddScriptLPS(1);
return Util.SHA1Hash(src, Encoding.UTF8).ToUpper();
return Util.SHA1Hash(src, Encoding.UTF8).ToLower();
}
protected ObjectShapePacket.ObjectDataBlock SetPrimitiveBlockShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, byte profileshape, byte pathcurve)