mirror of
https://github.com/opensim/opensim.git
synced 2026-06-29 02:25:39 +08:00
Add regression test for http inventory fetch.
Involved some restructuring to allow regression tests to dequeue inventory requests and perform poll responses synchronously rather than async
This commit is contained in:
@@ -65,6 +65,15 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Control whether requests will be processed asynchronously.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Defaults to true. Can currently not be changed once a region has been added to the module.
|
||||
/// </remarks>
|
||||
public bool ProcessQueuedRequestsAsync { get; private set; }
|
||||
|
||||
private Scene m_scene;
|
||||
|
||||
private IInventoryService m_InventoryService;
|
||||
@@ -84,6 +93,13 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
|
||||
#region ISharedRegionModule Members
|
||||
|
||||
public WebFetchInvDescModule() : this(true) {}
|
||||
|
||||
public WebFetchInvDescModule(bool processQueuedResultsAsync)
|
||||
{
|
||||
ProcessQueuedRequestsAsync = processQueuedResultsAsync;
|
||||
}
|
||||
|
||||
public void Initialise(IConfigSource source)
|
||||
{
|
||||
IConfig config = source.Configs["ClientStack.LindenCaps"];
|
||||
@@ -114,8 +130,16 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
|
||||
m_scene.EventManager.OnRegisterCaps -= RegisterCaps;
|
||||
|
||||
foreach (Thread t in m_workerThreads)
|
||||
Watchdog.AbortThread(t.ManagedThreadId);
|
||||
if (ProcessQueuedRequestsAsync)
|
||||
{
|
||||
if (m_workerThreads != null)
|
||||
{
|
||||
foreach (Thread t in m_workerThreads)
|
||||
Watchdog.AbortThread(t.ManagedThreadId);
|
||||
|
||||
m_workerThreads = null;
|
||||
}
|
||||
}
|
||||
|
||||
m_scene = null;
|
||||
}
|
||||
@@ -133,7 +157,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
|
||||
m_scene.EventManager.OnRegisterCaps += RegisterCaps;
|
||||
|
||||
if (m_workerThreads == null)
|
||||
if (ProcessQueuedRequestsAsync && m_workerThreads == null)
|
||||
{
|
||||
m_workerThreads = new Thread[2];
|
||||
|
||||
@@ -358,11 +382,16 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
{
|
||||
Watchdog.UpdateThread();
|
||||
|
||||
aPollRequest poolreq = m_queue.Dequeue();
|
||||
|
||||
if (poolreq != null && poolreq.thepoll != null)
|
||||
poolreq.thepoll.Process(poolreq);
|
||||
WaitProcessQueuedInventoryRequest();
|
||||
}
|
||||
}
|
||||
|
||||
public void WaitProcessQueuedInventoryRequest()
|
||||
{
|
||||
aPollRequest poolreq = m_queue.Dequeue();
|
||||
|
||||
if (poolreq != null && poolreq.thepoll != null)
|
||||
poolreq.thepoll.Process(poolreq);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user