Add an EventType enum and Type field to the poll service event args. This allows

the manager to tell what type of event it is. All events except for lsl http in
go to the "slow queue" which is run once per second as before.
avinationmerge
Melanie 2012-07-05 23:09:20 +02:00
parent bc5d554f54
commit 4854d77904
4 changed files with 39 additions and 16 deletions

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 BlockingQueue<PollServiceHttpRequest> m_slowRequests = new BlockingQueue<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,20 @@ 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_slowRequests.Enqueue(req);
else
m_requests.Enqueue(req);
}
}
private void CheckRetries()
@ -234,10 +241,18 @@ 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;
while (m_slowRequests.Count() > 0 && m_running)
m_requests.Enqueue(m_retryRequests.Dequeue());
}
}
}
@ -261,7 +276,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 +288,7 @@ namespace OpenSim.Framework.Servers.HttpServer
}
PollServiceHttpRequest wreq;
m_retry_requests.Clear();
m_retryRequests.Clear();
while (m_requests.Count() > 0)
{
@ -294,7 +309,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)