diff options
author | Justin Clark-Casey (justincc) | 2014-03-17 20:51:35 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-03-17 20:51:35 +0000 |
commit | f3e177814a30ee91a2fdd27f2a1aebf06a39cd15 (patch) | |
tree | c511df5ec9e48d961241341e30adce3e33eb7ad7 /OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs | |
parent | Implement osForceBreakAllLinks(). (diff) | |
download | opensim-SC_OLD-f3e177814a30ee91a2fdd27f2a1aebf06a39cd15.zip opensim-SC_OLD-f3e177814a30ee91a2fdd27f2a1aebf06a39cd15.tar.gz opensim-SC_OLD-f3e177814a30ee91a2fdd27f2a1aebf06a39cd15.tar.bz2 opensim-SC_OLD-f3e177814a30ee91a2fdd27f2a1aebf06a39cd15.tar.xz |
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
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs | 43 |
1 files changed, 36 insertions, 7 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs index 340d2e7..f0dccda 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs | |||
@@ -65,6 +65,15 @@ namespace OpenSim.Region.ClientStack.Linden | |||
65 | 65 | ||
66 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 66 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
67 | 67 | ||
68 | |||
69 | /// <summary> | ||
70 | /// Control whether requests will be processed asynchronously. | ||
71 | /// </summary> | ||
72 | /// <remarks> | ||
73 | /// Defaults to true. Can currently not be changed once a region has been added to the module. | ||
74 | /// </remarks> | ||
75 | public bool ProcessQueuedRequestsAsync { get; private set; } | ||
76 | |||
68 | private Scene m_scene; | 77 | private Scene m_scene; |
69 | 78 | ||
70 | private IInventoryService m_InventoryService; | 79 | private IInventoryService m_InventoryService; |
@@ -84,6 +93,13 @@ namespace OpenSim.Region.ClientStack.Linden | |||
84 | 93 | ||
85 | #region ISharedRegionModule Members | 94 | #region ISharedRegionModule Members |
86 | 95 | ||
96 | public WebFetchInvDescModule() : this(true) {} | ||
97 | |||
98 | public WebFetchInvDescModule(bool processQueuedResultsAsync) | ||
99 | { | ||
100 | ProcessQueuedRequestsAsync = processQueuedResultsAsync; | ||
101 | } | ||
102 | |||
87 | public void Initialise(IConfigSource source) | 103 | public void Initialise(IConfigSource source) |
88 | { | 104 | { |
89 | IConfig config = source.Configs["ClientStack.LindenCaps"]; | 105 | IConfig config = source.Configs["ClientStack.LindenCaps"]; |
@@ -114,8 +130,16 @@ namespace OpenSim.Region.ClientStack.Linden | |||
114 | 130 | ||
115 | m_scene.EventManager.OnRegisterCaps -= RegisterCaps; | 131 | m_scene.EventManager.OnRegisterCaps -= RegisterCaps; |
116 | 132 | ||
117 | foreach (Thread t in m_workerThreads) | 133 | if (ProcessQueuedRequestsAsync) |
118 | Watchdog.AbortThread(t.ManagedThreadId); | 134 | { |
135 | if (m_workerThreads != null) | ||
136 | { | ||
137 | foreach (Thread t in m_workerThreads) | ||
138 | Watchdog.AbortThread(t.ManagedThreadId); | ||
139 | |||
140 | m_workerThreads = null; | ||
141 | } | ||
142 | } | ||
119 | 143 | ||
120 | m_scene = null; | 144 | m_scene = null; |
121 | } | 145 | } |
@@ -133,7 +157,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
133 | 157 | ||
134 | m_scene.EventManager.OnRegisterCaps += RegisterCaps; | 158 | m_scene.EventManager.OnRegisterCaps += RegisterCaps; |
135 | 159 | ||
136 | if (m_workerThreads == null) | 160 | if (ProcessQueuedRequestsAsync && m_workerThreads == null) |
137 | { | 161 | { |
138 | m_workerThreads = new Thread[2]; | 162 | m_workerThreads = new Thread[2]; |
139 | 163 | ||
@@ -358,11 +382,16 @@ namespace OpenSim.Region.ClientStack.Linden | |||
358 | { | 382 | { |
359 | Watchdog.UpdateThread(); | 383 | Watchdog.UpdateThread(); |
360 | 384 | ||
361 | aPollRequest poolreq = m_queue.Dequeue(); | 385 | WaitProcessQueuedInventoryRequest(); |
362 | |||
363 | if (poolreq != null && poolreq.thepoll != null) | ||
364 | poolreq.thepoll.Process(poolreq); | ||
365 | } | 386 | } |
366 | } | 387 | } |
388 | |||
389 | public void WaitProcessQueuedInventoryRequest() | ||
390 | { | ||
391 | aPollRequest poolreq = m_queue.Dequeue(); | ||
392 | |||
393 | if (poolreq != null && poolreq.thepoll != null) | ||
394 | poolreq.thepoll.Process(poolreq); | ||
395 | } | ||
367 | } | 396 | } |
368 | } | 397 | } |