aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs61
1 files changed, 32 insertions, 29 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
index 7f58528..e0402fd 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
@@ -208,9 +208,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
208 scene.EventManager.OnMakeRootAgent += OnMakeRoot; 208 scene.EventManager.OnMakeRootAgent += OnMakeRoot;
209 scene.EventManager.OnMakeChildAgent += OnMakeChild; 209 scene.EventManager.OnMakeChildAgent += OnMakeChild;
210 scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; 210 scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
211 // The InstantMessageModule itself doesn't do this, 211 scene.EventManager.OnClientClosed += OnClientClosed;
212 // so lets see if things explode if we don't do it
213 // scene.EventManager.OnClientClosed += OnClientClosed;
214 212
215 } 213 }
216 214
@@ -295,39 +293,44 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
295 remoteClient.SendAvatarGroupsReply(avatarID, avatarGroups); 293 remoteClient.SendAvatarGroupsReply(avatarID, avatarGroups);
296 } 294 }
297 295
298 /* 296
299 * This becomes very problematic in a shared module. In a shared module you may have more then one 297 private void OnClientClosed(UUID AgentId, Scene scene)
300 * reference to IClientAPI's, one for 0 or 1 root connections, and 0 or more child connections.
301 * The OnClientClosed event does not provide anything to indicate which one of those should be closed
302 * nor does it provide what scene it was from so that the specific reference can be looked up.
303 * The InstantMessageModule.cs does not currently worry about unregistering the handles,
304 * and it should be an issue, since it's the client that references us not the other way around
305 * , so as long as we don't keep a reference to the client laying around, the client can still be GC'ed
306 private void OnClientClosed(UUID AgentId)
307 { 298 {
308 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 299 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
300 if (scene == null)
301 return;
309 302
310 lock (m_ActiveClients) 303 ScenePresence sp = scene.GetScenePresence(AgentId);
304 IClientAPI client = sp.ControllingClient;
305 if (client != null)
311 { 306 {
312 if (m_ActiveClients.ContainsKey(AgentId)) 307 client.OnAgentDataUpdateRequest -= OnAgentDataUpdateRequest;
313 { 308 client.OnRequestAvatarProperties -= OnRequestAvatarProperties;
314 IClientAPI client = m_ActiveClients[AgentId]; 309 // make child possible not called?
315 client.OnUUIDGroupNameRequest -= HandleUUIDGroupNameRequest; 310 client.OnUUIDGroupNameRequest -= HandleUUIDGroupNameRequest;
316 client.OnAgentDataUpdateRequest -= OnAgentDataUpdateRequest; 311 client.OnInstantMessage -= OnInstantMessage;
317 client.OnDirFindQuery -= OnDirFindQuery; 312 }
318 client.OnInstantMessage -= OnInstantMessage;
319 313
320 m_ActiveClients.Remove(AgentId); 314 /*
321 } 315 lock (m_ActiveClients)
322 else 316 {
323 { 317 if (m_ActiveClients.ContainsKey(AgentId))
324 if (m_debugEnabled) m_log.WarnFormat("[GROUPS]: Client closed that wasn't registered here."); 318 {
325 } 319 IClientAPI client = m_ActiveClients[AgentId];
320 client.OnUUIDGroupNameRequest -= HandleUUIDGroupNameRequest;
321 client.OnAgentDataUpdateRequest -= OnAgentDataUpdateRequest;
322 client.OnDirFindQuery -= OnDirFindQuery;
323 client.OnInstantMessage -= OnInstantMessage;
326 324
327 325 m_ActiveClients.Remove(AgentId);
328 } 326 }
327 else
328 {
329 if (m_debugEnabled) m_log.WarnFormat("[GROUPS]: Client closed that wasn't registered here.");
330 }
331 }
332 */
329 } 333 }
330 */
331 334
332 private void OnAgentDataUpdateRequest(IClientAPI remoteClient, UUID dataForAgentID, UUID sessionID) 335 private void OnAgentDataUpdateRequest(IClientAPI remoteClient, UUID dataForAgentID, UUID sessionID)
333 { 336 {