diff options
author | Justin Clark-Casey (justincc) | 2012-05-18 00:38:29 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-05-18 00:38:29 +0100 |
commit | 6501b1b1bb297eb5ed8a44447f771c7b73b0e905 (patch) | |
tree | 201d68d7835178897aa2f52d3d1edd64324fd14a /OpenSim/Region | |
parent | Don't eagerly clear frame collision events when physics actors subscribe and ... (diff) | |
download | opensim-SC_OLD-6501b1b1bb297eb5ed8a44447f771c7b73b0e905.zip opensim-SC_OLD-6501b1b1bb297eb5ed8a44447f771c7b73b0e905.tar.gz opensim-SC_OLD-6501b1b1bb297eb5ed8a44447f771c7b73b0e905.tar.bz2 opensim-SC_OLD-6501b1b1bb297eb5ed8a44447f771c7b73b0e905.tar.xz |
refactor: move EventQueueGet path generation into common method. Rename some local variables in line with code conventions. Add commented out EQG log lines for future use.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs | 53 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | 2 |
2 files changed, 34 insertions, 21 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs index 1a35d22..0054619 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs | |||
@@ -235,19 +235,19 @@ namespace OpenSim.Region.ClientStack.Linden | |||
235 | // ClientClosed(client.AgentId); | 235 | // ClientClosed(client.AgentId); |
236 | // } | 236 | // } |
237 | 237 | ||
238 | private void ClientClosed(UUID AgentID, Scene scene) | 238 | private void ClientClosed(UUID agentID, Scene scene) |
239 | { | 239 | { |
240 | // m_log.DebugFormat("[EVENTQUEUE]: Closed client {0} in region {1}", AgentID, m_scene.RegionInfo.RegionName); | 240 | // m_log.DebugFormat("[EVENTQUEUE]: Closed client {0} in region {1}", agentID, m_scene.RegionInfo.RegionName); |
241 | 241 | ||
242 | int count = 0; | 242 | int count = 0; |
243 | while (queues.ContainsKey(AgentID) && queues[AgentID].Count > 0 && count++ < 5) | 243 | while (queues.ContainsKey(agentID) && queues[agentID].Count > 0 && count++ < 5) |
244 | { | 244 | { |
245 | Thread.Sleep(1000); | 245 | Thread.Sleep(1000); |
246 | } | 246 | } |
247 | 247 | ||
248 | lock (queues) | 248 | lock (queues) |
249 | { | 249 | { |
250 | queues.Remove(AgentID); | 250 | queues.Remove(agentID); |
251 | } | 251 | } |
252 | 252 | ||
253 | List<UUID> removeitems = new List<UUID>(); | 253 | List<UUID> removeitems = new List<UUID>(); |
@@ -256,7 +256,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
256 | foreach (UUID ky in m_AvatarQueueUUIDMapping.Keys) | 256 | foreach (UUID ky in m_AvatarQueueUUIDMapping.Keys) |
257 | { | 257 | { |
258 | // m_log.DebugFormat("[EVENTQUEUE]: Found key {0} in m_AvatarQueueUUIDMapping while looking for {1}", ky, AgentID); | 258 | // m_log.DebugFormat("[EVENTQUEUE]: Found key {0} in m_AvatarQueueUUIDMapping while looking for {1}", ky, AgentID); |
259 | if (ky == AgentID) | 259 | if (ky == agentID) |
260 | { | 260 | { |
261 | removeitems.Add(ky); | 261 | removeitems.Add(ky); |
262 | } | 262 | } |
@@ -267,7 +267,10 @@ namespace OpenSim.Region.ClientStack.Linden | |||
267 | UUID eventQueueGetUuid = m_AvatarQueueUUIDMapping[ky]; | 267 | UUID eventQueueGetUuid = m_AvatarQueueUUIDMapping[ky]; |
268 | m_AvatarQueueUUIDMapping.Remove(ky); | 268 | m_AvatarQueueUUIDMapping.Remove(ky); |
269 | 269 | ||
270 | MainServer.Instance.RemovePollServiceHTTPHandler("","/CAPS/EQG/" + eventQueueGetUuid.ToString() + "/"); | 270 | string eqgPath = GenerateEqgCapPath(eventQueueGetUuid); |
271 | MainServer.Instance.RemovePollServiceHTTPHandler("", eqgPath); | ||
272 | |||
273 | // m_log.DebugFormat("[EVENT QUEUE GET MODULE]: Removed EQG handler {0} for {1}", eqgPath, agentID); | ||
271 | } | 274 | } |
272 | } | 275 | } |
273 | 276 | ||
@@ -281,7 +284,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
281 | { | 284 | { |
282 | searchval = m_QueueUUIDAvatarMapping[ky]; | 285 | searchval = m_QueueUUIDAvatarMapping[ky]; |
283 | 286 | ||
284 | if (searchval == AgentID) | 287 | if (searchval == agentID) |
285 | { | 288 | { |
286 | removeitems.Add(ky); | 289 | removeitems.Add(ky); |
287 | } | 290 | } |
@@ -305,6 +308,15 @@ namespace OpenSim.Region.ClientStack.Linden | |||
305 | //} | 308 | //} |
306 | } | 309 | } |
307 | 310 | ||
311 | /// <summary> | ||
312 | /// Generate an Event Queue Get handler path for the given eqg uuid. | ||
313 | /// </summary> | ||
314 | /// <param name='eqgUuid'></param> | ||
315 | private string GenerateEqgCapPath(UUID eqgUuid) | ||
316 | { | ||
317 | return string.Format("/CAPS/EQG/{0}/", eqgUuid); | ||
318 | } | ||
319 | |||
308 | public void OnRegisterCaps(UUID agentID, Caps caps) | 320 | public void OnRegisterCaps(UUID agentID, Caps caps) |
309 | { | 321 | { |
310 | // Register an event queue for the client | 322 | // Register an event queue for the client |
@@ -316,8 +328,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
316 | // Let's instantiate a Queue for this agent right now | 328 | // Let's instantiate a Queue for this agent right now |
317 | TryGetQueue(agentID); | 329 | TryGetQueue(agentID); |
318 | 330 | ||
319 | string capsBase = "/CAPS/EQG/"; | 331 | UUID eventQueueGetUUID; |
320 | UUID EventQueueGetUUID = UUID.Zero; | ||
321 | 332 | ||
322 | lock (m_AvatarQueueUUIDMapping) | 333 | lock (m_AvatarQueueUUIDMapping) |
323 | { | 334 | { |
@@ -325,37 +336,35 @@ namespace OpenSim.Region.ClientStack.Linden | |||
325 | if (m_AvatarQueueUUIDMapping.ContainsKey(agentID)) | 336 | if (m_AvatarQueueUUIDMapping.ContainsKey(agentID)) |
326 | { | 337 | { |
327 | //m_log.DebugFormat("[EVENTQUEUE]: Found Existing UUID!"); | 338 | //m_log.DebugFormat("[EVENTQUEUE]: Found Existing UUID!"); |
328 | EventQueueGetUUID = m_AvatarQueueUUIDMapping[agentID]; | 339 | eventQueueGetUUID = m_AvatarQueueUUIDMapping[agentID]; |
329 | } | 340 | } |
330 | else | 341 | else |
331 | { | 342 | { |
332 | EventQueueGetUUID = UUID.Random(); | 343 | eventQueueGetUUID = UUID.Random(); |
333 | //m_log.DebugFormat("[EVENTQUEUE]: Using random UUID!"); | 344 | //m_log.DebugFormat("[EVENTQUEUE]: Using random UUID!"); |
334 | } | 345 | } |
335 | } | 346 | } |
336 | 347 | ||
337 | lock (m_QueueUUIDAvatarMapping) | 348 | lock (m_QueueUUIDAvatarMapping) |
338 | { | 349 | { |
339 | if (!m_QueueUUIDAvatarMapping.ContainsKey(EventQueueGetUUID)) | 350 | if (!m_QueueUUIDAvatarMapping.ContainsKey(eventQueueGetUUID)) |
340 | m_QueueUUIDAvatarMapping.Add(EventQueueGetUUID, agentID); | 351 | m_QueueUUIDAvatarMapping.Add(eventQueueGetUUID, agentID); |
341 | } | 352 | } |
342 | 353 | ||
343 | lock (m_AvatarQueueUUIDMapping) | 354 | lock (m_AvatarQueueUUIDMapping) |
344 | { | 355 | { |
345 | if (!m_AvatarQueueUUIDMapping.ContainsKey(agentID)) | 356 | if (!m_AvatarQueueUUIDMapping.ContainsKey(agentID)) |
346 | m_AvatarQueueUUIDMapping.Add(agentID, EventQueueGetUUID); | 357 | m_AvatarQueueUUIDMapping.Add(agentID, eventQueueGetUUID); |
347 | } | 358 | } |
348 | 359 | ||
360 | string eventQueueGetPath = GenerateEqgCapPath(eventQueueGetUUID); | ||
361 | |||
349 | // Register this as a caps handler | 362 | // Register this as a caps handler |
350 | // FIXME: Confusingly, we need to register separate as a capability so that the client is told about | 363 | // FIXME: Confusingly, we need to register separate as a capability so that the client is told about |
351 | // EventQueueGet when it receive capability information, but then we replace the rest handler immediately | 364 | // EventQueueGet when it receive capability information, but then we replace the rest handler immediately |
352 | // afterwards with the poll service. So for now, we'll pass a null instead to simplify code reading, but | 365 | // afterwards with the poll service. So for now, we'll pass a null instead to simplify code reading, but |
353 | // really it should be possible to directly register the poll handler as a capability. | 366 | // really it should be possible to directly register the poll handler as a capability. |
354 | caps.RegisterHandler( | 367 | caps.RegisterHandler("EventQueueGet", new RestHTTPHandler("POST", eventQueueGetPath, null)); |
355 | "EventQueueGet", | ||
356 | new RestHTTPHandler( | ||
357 | "POST", capsBase + EventQueueGetUUID.ToString() + "/", null)); | ||
358 | |||
359 | // delegate(Hashtable m_dhttpMethod) | 368 | // delegate(Hashtable m_dhttpMethod) |
360 | // { | 369 | // { |
361 | // return ProcessQueue(m_dhttpMethod, agentID, caps); | 370 | // return ProcessQueue(m_dhttpMethod, agentID, caps); |
@@ -364,9 +373,13 @@ namespace OpenSim.Region.ClientStack.Linden | |||
364 | // This will persist this beyond the expiry of the caps handlers | 373 | // This will persist this beyond the expiry of the caps handlers |
365 | // TODO: Add EventQueueGet name/description for diagnostics | 374 | // TODO: Add EventQueueGet name/description for diagnostics |
366 | MainServer.Instance.AddPollServiceHTTPHandler( | 375 | MainServer.Instance.AddPollServiceHTTPHandler( |
367 | capsBase + EventQueueGetUUID.ToString() + "/", | 376 | eventQueueGetPath, |
368 | new PollServiceEventArgs(null, HasEvents, GetEvents, NoEvents, agentID)); | 377 | new PollServiceEventArgs(null, HasEvents, GetEvents, NoEvents, agentID)); |
369 | 378 | ||
379 | // m_log.DebugFormat( | ||
380 | // "[EVENT QUEUE GET MODULE]: Registered EQG handler {0} for {1} in {2}", | ||
381 | // eventQueueGetPath, agentID, m_scene.RegionInfo.RegionName); | ||
382 | |||
370 | Random rnd = new Random(Environment.TickCount); | 383 | Random rnd = new Random(Environment.TickCount); |
371 | lock (m_ids) | 384 | lock (m_ids) |
372 | { | 385 | { |
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index 1b1c44a..54b69a2 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | |||
@@ -1274,7 +1274,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1274 | 1274 | ||
1275 | // Don't clear collision event reporting here. This is called directly from scene code and so can lead | 1275 | // Don't clear collision event reporting here. This is called directly from scene code and so can lead |
1276 | // to a race condition with the simulate loop | 1276 | // to a race condition with the simulate loop |
1277 | 1277 | ||
1278 | m_requestedUpdateFrequency = 0; | 1278 | m_requestedUpdateFrequency = 0; |
1279 | m_eventsubscription = 0; | 1279 | m_eventsubscription = 0; |
1280 | } | 1280 | } |