avoid a null ref, plus some cleanup
parent
d5baeb4690
commit
ac7187eada
|
@ -48,18 +48,6 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
public DropMethod Drop;
|
public DropMethod Drop;
|
||||||
public UUID Id;
|
public UUID Id;
|
||||||
public int TimeOutms;
|
public int TimeOutms;
|
||||||
//public EventType Type;
|
|
||||||
|
|
||||||
public enum EventType : int
|
|
||||||
{
|
|
||||||
Poll = 0,
|
|
||||||
LslHttp = 1,
|
|
||||||
Inventory = 2,
|
|
||||||
Texture = 3,
|
|
||||||
Mesh = 4,
|
|
||||||
Mesh2 = 5,
|
|
||||||
Asset = 6
|
|
||||||
}
|
|
||||||
|
|
||||||
public string Url { get; set; }
|
public string Url { get; set; }
|
||||||
|
|
||||||
|
@ -87,7 +75,6 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
Drop = pDrop;
|
Drop = pDrop;
|
||||||
Id = pId;
|
Id = pId;
|
||||||
TimeOutms = pTimeOutms;
|
TimeOutms = pTimeOutms;
|
||||||
//Type = EventType.Poll;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -177,10 +177,10 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
|
|
||||||
if(buffer == null)
|
if(buffer == null)
|
||||||
{
|
{
|
||||||
if (!(contentType.Contains("image")
|
if (contentType != null && (!(contentType.Contains("image")
|
||||||
|| contentType.Contains("x-shockwave-flash")
|
|| contentType.Contains("x-shockwave-flash")
|
||||||
|| contentType.Contains("application/x-oar")
|
|| contentType.Contains("application/x-oar")
|
||||||
|| contentType.Contains("application/vnd.ll.mesh")))
|
|| contentType.Contains("application/vnd.ll.mesh"))))
|
||||||
{
|
{
|
||||||
// Text
|
// Text
|
||||||
buffer = Encoding.UTF8.GetBytes(responseString);
|
buffer = Encoding.UTF8.GetBytes(responseString);
|
||||||
|
|
|
@ -50,25 +50,11 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
|
|
||||||
private bool m_running = false;
|
private bool m_running = false;
|
||||||
|
|
||||||
//private SmartThreadPool m_threadPool;
|
|
||||||
|
|
||||||
public PollServiceRequestManager(
|
public PollServiceRequestManager(
|
||||||
bool performResponsesAsync, uint pWorkerThreadCount, int pTimeout)
|
bool performResponsesAsync, uint pWorkerThreadCount, int pTimeout)
|
||||||
{
|
{
|
||||||
m_WorkerThreadCount = pWorkerThreadCount;
|
m_WorkerThreadCount = pWorkerThreadCount;
|
||||||
m_workerThreads = new Thread[m_WorkerThreadCount];
|
m_workerThreads = new Thread[m_WorkerThreadCount];
|
||||||
|
|
||||||
/*
|
|
||||||
STPStartInfo startInfo = new STPStartInfo();
|
|
||||||
startInfo.IdleTimeout = 30000;
|
|
||||||
startInfo.MaxWorkerThreads = 20;
|
|
||||||
startInfo.MinWorkerThreads = 1;
|
|
||||||
startInfo.ThreadPriority = ThreadPriority.Normal;
|
|
||||||
startInfo.StartSuspended = true;
|
|
||||||
startInfo.ThreadPoolName = "PoolService";
|
|
||||||
|
|
||||||
m_threadPool = new SmartThreadPool(startInfo);
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Start()
|
public void Start()
|
||||||
|
@ -76,7 +62,6 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
if(m_running)
|
if(m_running)
|
||||||
return;
|
return;
|
||||||
m_running = true;
|
m_running = true;
|
||||||
//m_threadPool.Start();
|
|
||||||
//startup worker threads
|
//startup worker threads
|
||||||
for (uint i = 0; i < m_WorkerThreadCount; i++)
|
for (uint i = 0; i < m_WorkerThreadCount; i++)
|
||||||
{
|
{
|
||||||
|
@ -137,10 +122,6 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
foreach (Thread t in m_workerThreads)
|
foreach (Thread t in m_workerThreads)
|
||||||
Watchdog.AbortThread(t.ManagedThreadId);
|
Watchdog.AbortThread(t.ManagedThreadId);
|
||||||
|
|
||||||
//m_threadPool.Shutdown();
|
|
||||||
|
|
||||||
// any entry in m_bycontext should have a active request on the other queues
|
|
||||||
// so just delete contents to easy GC
|
|
||||||
PollServiceHttpRequest req;
|
PollServiceHttpRequest req;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -199,40 +180,22 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
|
|
||||||
if (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id))
|
if (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id))
|
||||||
{
|
{
|
||||||
PollServiceHttpRequest nreq = req;
|
try
|
||||||
//m_threadPool.QueueWorkItem(x =>
|
{
|
||||||
//{
|
Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id);
|
||||||
try
|
req.DoHTTPGruntWork(responsedata);
|
||||||
{
|
}
|
||||||
Hashtable responsedata = nreq.PollServiceArgs.GetEvents(nreq.RequestID, nreq.PollServiceArgs.Id);
|
catch (ObjectDisposedException) { }
|
||||||
nreq.DoHTTPGruntWork(responsedata);
|
|
||||||
}
|
|
||||||
catch (ObjectDisposedException) { }
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
nreq = null;
|
|
||||||
}
|
|
||||||
//return null;
|
|
||||||
//}, null);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((Environment.TickCount - req.RequestTime) > req.PollServiceArgs.TimeOutms)
|
if ((Environment.TickCount - req.RequestTime) > req.PollServiceArgs.TimeOutms)
|
||||||
{
|
{
|
||||||
PollServiceHttpRequest nreq = req;
|
try
|
||||||
//m_threadPool.QueueWorkItem(x =>
|
{
|
||||||
//{
|
req.DoHTTPGruntWork(req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id));
|
||||||
try
|
}
|
||||||
{
|
catch (ObjectDisposedException) { }
|
||||||
nreq.DoHTTPGruntWork(nreq.PollServiceArgs.NoEvents(nreq.RequestID, nreq.PollServiceArgs.Id));
|
|
||||||
}
|
|
||||||
catch (ObjectDisposedException) { }
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
nreq = null;
|
|
||||||
}
|
|
||||||
//return null;
|
|
||||||
//}, null);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -57,7 +57,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
private Commands m_commands = new Commands();
|
private Commands m_commands = new Commands();
|
||||||
public ICommands Commands { get { return m_commands; } }
|
public ICommands Commands { get { return m_commands; } }
|
||||||
|
|
||||||
ConcurrentDictionary<UUID,OnOutputDelegate> currentConsoles = new ConcurrentDictionary<UUID, OnOutputDelegate>();
|
ConcurrentDictionary<UUID, OnOutputDelegate> currentConsoles = new ConcurrentDictionary<UUID, OnOutputDelegate>();
|
||||||
|
|
||||||
public event ConsoleMessage OnConsoleMessage;
|
public event ConsoleMessage OnConsoleMessage;
|
||||||
|
|
||||||
|
@ -101,7 +101,6 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
{
|
{
|
||||||
//if (!m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(agentID) && !m_scene.Permissions.IsGod(agentID))
|
//if (!m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(agentID) && !m_scene.Permissions.IsGod(agentID))
|
||||||
// return;
|
// return;
|
||||||
//m_log.DebugFormat("[REGION CONSOLE]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName);
|
|
||||||
caps.RegisterSimpleHandler("SimConsoleAsync",
|
caps.RegisterSimpleHandler("SimConsoleAsync",
|
||||||
new ConsoleHandler("/" + UUID.Random(), "SimConsoleAsync", agentID, this, m_scene));
|
new ConsoleHandler("/" + UUID.Random(), "SimConsoleAsync", agentID, this, m_scene));
|
||||||
}
|
}
|
||||||
|
@ -125,14 +124,9 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
RemoveConsole(agentID);
|
RemoveConsole(agentID);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
OSD osd = OSD.FromString(message);
|
|
||||||
|
|
||||||
m_eventQueue.Enqueue(EventQueueHelper.BuildEvent("SimConsoleResponse", osd), agentID);
|
m_eventQueue.Enqueue(m_eventQueue.BuildEvent("SimConsoleResponse", OSD.FromString(message)), agentID);
|
||||||
|
OnConsoleMessage?.Invoke( agentID, message);
|
||||||
ConsoleMessage handlerConsoleMessage = OnConsoleMessage;
|
|
||||||
|
|
||||||
if (handlerConsoleMessage != null)
|
|
||||||
handlerConsoleMessage( agentID, message);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool RunCommand(string command, UUID invokerID)
|
public bool RunCommand(string command, UUID invokerID)
|
||||||
|
|
|
@ -104,9 +104,6 @@ namespace OpenSim.Services.HypergridService
|
||||||
m_log.ErrorFormat("[HGASSETS]: Failed to load backing service {0}", str);
|
m_log.ErrorFormat("[HGASSETS]: Failed to load backing service {0}", str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#region IAssetService
|
#region IAssetService
|
||||||
|
|
Loading…
Reference in New Issue