remove groups handlers onClientClose also on groups V2

avinationmerge
UbitUmarov 2015-09-28 21:03:20 +01:00
parent cf6856a8df
commit a580d945d1
1 changed files with 18 additions and 12 deletions

View File

@ -268,18 +268,24 @@ namespace OpenSim.Groups
remoteClient.SendAvatarGroupsReply(avatarID, avatarGroups); remoteClient.SendAvatarGroupsReply(avatarID, avatarGroups);
} }
/* private void OnClientClosed(UUID AgentId, Scene scene)
* This becomes very problematic in a shared module. In a shared module you may have more then one
* reference to IClientAPI's, one for 0 or 1 root connections, and 0 or more child connections.
* The OnClientClosed event does not provide anything to indicate which one of those should be closed
* nor does it provide what scene it was from so that the specific reference can be looked up.
* The InstantMessageModule.cs does not currently worry about unregistering the handles,
* and it should be an issue, since it's the client that references us not the other way around
* , so as long as we don't keep a reference to the client laying around, the client can still be GC'ed
private void OnClientClosed(UUID AgentId)
{ {
if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
if (scene == null)
return;
ScenePresence sp = scene.GetScenePresence(AgentId);
IClientAPI client = sp.ControllingClient;
if (client != null)
{
client.OnAgentDataUpdateRequest -= OnAgentDataUpdateRequest;
client.OnRequestAvatarProperties -= OnRequestAvatarProperties;
// make child possible not called?
client.OnUUIDGroupNameRequest -= HandleUUIDGroupNameRequest;
client.OnInstantMessage -= OnInstantMessage;
}
/*
lock (m_ActiveClients) lock (m_ActiveClients)
{ {
if (m_ActiveClients.ContainsKey(AgentId)) if (m_ActiveClients.ContainsKey(AgentId))
@ -297,11 +303,11 @@ namespace OpenSim.Groups
if (m_debugEnabled) m_log.WarnFormat("[Groups]: Client closed that wasn't registered here."); if (m_debugEnabled) m_log.WarnFormat("[Groups]: Client closed that wasn't registered here.");
} }
}
} }
*/ */
}
private void OnAgentDataUpdateRequest(IClientAPI remoteClient, UUID dataForAgentID, UUID sessionID) private void OnAgentDataUpdateRequest(IClientAPI remoteClient, UUID dataForAgentID, UUID sessionID)
{ {
// this a private message for own agent only // this a private message for own agent only