diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs | 58 |
1 files changed, 25 insertions, 33 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs index f76ea74..0f305b1 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs | |||
@@ -52,6 +52,13 @@ namespace OpenSim.Region.ClientStack.Linden | |||
52 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] | 52 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] |
53 | public class WebFetchInvDescModule : INonSharedRegionModule | 53 | public class WebFetchInvDescModule : INonSharedRegionModule |
54 | { | 54 | { |
55 | struct aPollRequest | ||
56 | { | ||
57 | public PollServiceInventoryEventArgs thepoll; | ||
58 | public UUID reqID; | ||
59 | public Hashtable request; | ||
60 | } | ||
61 | |||
55 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 62 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
56 | 63 | ||
57 | private Scene m_scene; | 64 | private Scene m_scene; |
@@ -64,8 +71,8 @@ namespace OpenSim.Region.ClientStack.Linden | |||
64 | private Dictionary<UUID, string> m_capsDict = new Dictionary<UUID, string>(); | 71 | private Dictionary<UUID, string> m_capsDict = new Dictionary<UUID, string>(); |
65 | private static Thread[] m_workerThreads = null; | 72 | private static Thread[] m_workerThreads = null; |
66 | 73 | ||
67 | private static OpenMetaverse.BlockingQueue<PollServiceInventoryEventArgs> m_queue = | 74 | private static OpenMetaverse.BlockingQueue<aPollRequest> m_queue = |
68 | new OpenMetaverse.BlockingQueue<PollServiceInventoryEventArgs>(); | 75 | new OpenMetaverse.BlockingQueue<aPollRequest>(); |
69 | 76 | ||
70 | #region ISharedRegionModule Members | 77 | #region ISharedRegionModule Members |
71 | 78 | ||
@@ -131,18 +138,16 @@ namespace OpenSim.Region.ClientStack.Linden | |||
131 | ~WebFetchInvDescModule() | 138 | ~WebFetchInvDescModule() |
132 | { | 139 | { |
133 | foreach (Thread t in m_workerThreads) | 140 | foreach (Thread t in m_workerThreads) |
134 | t.Abort(); | 141 | Watchdog.AbortThread(t.ManagedThreadId); |
135 | } | 142 | } |
136 | 143 | ||
137 | private class PollServiceInventoryEventArgs : PollServiceEventArgs | 144 | private class PollServiceInventoryEventArgs : PollServiceEventArgs |
138 | { | 145 | { |
139 | private List<Hashtable> requests = | ||
140 | new List<Hashtable>(); | ||
141 | private Dictionary<UUID, Hashtable> responses = | 146 | private Dictionary<UUID, Hashtable> responses = |
142 | new Dictionary<UUID, Hashtable>(); | 147 | new Dictionary<UUID, Hashtable>(); |
143 | 148 | ||
144 | public PollServiceInventoryEventArgs(UUID pId) : | 149 | public PollServiceInventoryEventArgs(UUID pId) : |
145 | base(null, null, null, null, pId, 30000) | 150 | base(null, null, null, null, pId, int.MaxValue) |
146 | { | 151 | { |
147 | HasEvents = (x, y) => { lock (responses) return responses.ContainsKey(x); }; | 152 | HasEvents = (x, y) => { lock (responses) return responses.ContainsKey(x); }; |
148 | GetEvents = (x, y, s) => | 153 | GetEvents = (x, y, s) => |
@@ -162,21 +167,23 @@ namespace OpenSim.Region.ClientStack.Linden | |||
162 | 167 | ||
163 | Request = (x, y) => | 168 | Request = (x, y) => |
164 | { | 169 | { |
165 | y["RequestID"] = x.ToString(); | 170 | aPollRequest reqinfo = new aPollRequest(); |
166 | lock (requests) | 171 | reqinfo.thepoll = this; |
167 | requests.Add(y); | 172 | reqinfo.reqID = x; |
173 | reqinfo.request = y; | ||
168 | 174 | ||
169 | m_queue.Enqueue(this); | 175 | m_queue.Enqueue(reqinfo); |
170 | }; | 176 | }; |
171 | 177 | ||
172 | NoEvents = (x, y) => | 178 | NoEvents = (x, y) => |
173 | { | 179 | { |
180 | /* | ||
174 | lock (requests) | 181 | lock (requests) |
175 | { | 182 | { |
176 | Hashtable request = requests.Find(id => id["RequestID"].ToString() == x.ToString()); | 183 | Hashtable request = requests.Find(id => id["RequestID"].ToString() == x.ToString()); |
177 | requests.Remove(request); | 184 | requests.Remove(request); |
178 | } | 185 | } |
179 | 186 | */ | |
180 | Hashtable response = new Hashtable(); | 187 | Hashtable response = new Hashtable(); |
181 | 188 | ||
182 | response["int_response_code"] = 500; | 189 | response["int_response_code"] = 500; |
@@ -189,24 +196,9 @@ namespace OpenSim.Region.ClientStack.Linden | |||
189 | }; | 196 | }; |
190 | } | 197 | } |
191 | 198 | ||
192 | public void Process() | 199 | public void Process(aPollRequest requestinfo) |
193 | { | 200 | { |
194 | Hashtable request = null; | 201 | UUID requestID = requestinfo.reqID; |
195 | |||
196 | try | ||
197 | { | ||
198 | lock (requests) | ||
199 | { | ||
200 | request = requests[0]; | ||
201 | requests.RemoveAt(0); | ||
202 | } | ||
203 | } | ||
204 | catch | ||
205 | { | ||
206 | return; | ||
207 | } | ||
208 | |||
209 | UUID requestID = new UUID(request["RequestID"].ToString()); | ||
210 | 202 | ||
211 | Hashtable response = new Hashtable(); | 203 | Hashtable response = new Hashtable(); |
212 | 204 | ||
@@ -215,7 +207,8 @@ namespace OpenSim.Region.ClientStack.Linden | |||
215 | response["keepalive"] = false; | 207 | response["keepalive"] = false; |
216 | response["reusecontext"] = false; | 208 | response["reusecontext"] = false; |
217 | 209 | ||
218 | response["str_response_string"] = m_webFetchHandler.FetchInventoryDescendentsRequest(request["body"].ToString(), String.Empty, String.Empty, null, null); | 210 | response["str_response_string"] = m_webFetchHandler.FetchInventoryDescendentsRequest( |
211 | requestinfo.request["body"].ToString(), String.Empty, String.Empty, null, null); | ||
219 | 212 | ||
220 | lock (responses) | 213 | lock (responses) |
221 | responses[requestID] = response; | 214 | responses[requestID] = response; |
@@ -226,8 +219,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
226 | { | 219 | { |
227 | string capUrl = "/CAPS/" + UUID.Random() + "/"; | 220 | string capUrl = "/CAPS/" + UUID.Random() + "/"; |
228 | 221 | ||
229 | // Register this as a poll service | 222 | // Register this as a poll service |
230 | // absurd large timeout to tune later to make a bit less than viewer | ||
231 | PollServiceInventoryEventArgs args = new PollServiceInventoryEventArgs(agentID); | 223 | PollServiceInventoryEventArgs args = new PollServiceInventoryEventArgs(agentID); |
232 | 224 | ||
233 | args.Type = PollServiceEventArgs.EventType.Inventory; | 225 | args.Type = PollServiceEventArgs.EventType.Inventory; |
@@ -263,9 +255,9 @@ namespace OpenSim.Region.ClientStack.Linden | |||
263 | { | 255 | { |
264 | while (true) | 256 | while (true) |
265 | { | 257 | { |
266 | PollServiceInventoryEventArgs args = m_queue.Dequeue(); | 258 | aPollRequest poolreq = m_queue.Dequeue(); |
267 | 259 | ||
268 | args.Process(); | 260 | poolreq.thepoll.Process(poolreq); |
269 | } | 261 | } |
270 | } | 262 | } |
271 | } | 263 | } |