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:
Justin Clark-Casey (justincc)
2014-03-17 20:51:35 +00:00
parent 873eee5431
commit f3e177814a
11 changed files with 784 additions and 407 deletions

View File

@@ -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);
}
}
}