From 2f581c0d0d1bf5ddbd7954b7ddb76e53bded6e41 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Fri, 19 Jun 2009 20:51:56 +0000 Subject: [PATCH] When a shared module hooks OnClientClosed, it has no way of finding out which client connection has closed. So, in multi-region sims, things can get messy fast. This introduces a second parameters, which is a Scene object ref. Minor adjustments to custom modules may be required due to this change. --- OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | 2 +- OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs | 2 +- .../Avatar/Inventory/Transfer/InventoryTransferModule.cs | 2 +- .../CoreModules/Framework/EventQueue/EventQueueGetModule.cs | 2 +- OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | 2 +- OpenSim/Region/Framework/Scenes/EventManager.cs | 6 +++--- OpenSim/Region/Framework/Scenes/Scene.cs | 2 +- .../ReplaceableModules/MoneyModule/SampleMoneyModule.cs | 6 +++--- OpenSim/Region/UserStatistics/WebStatsModule.cs | 2 +- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index e46545c982..2d763b2a38 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs @@ -381,7 +381,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends client.OnLogout += OnLogout; } - private void ClientClosed(UUID AgentId) + private void ClientClosed(UUID AgentId, Scene scene) { // agent's client was closed. As we handle logout in OnLogout, this here has only to handle // TPing away (root agent is closed) or TPing/crossing in a region far enough away (client diff --git a/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs b/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs index 02ea4cde79..05ea73d0bb 100644 --- a/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs @@ -198,7 +198,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups remote_client.SendGroupNameReply(groupUUID, groupnamereply); } - private void OnClientClosed(UUID agentID) + private void OnClientClosed(UUID agentID, Scene scene) { lock (m_ClientMap) { diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index b8e4f08a5c..e8e5497746 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs @@ -368,7 +368,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer return false; } - public void ClientLoggedOut(UUID agentID) + public void ClientLoggedOut(UUID agentID, Scene scene) { if (m_AgentRegions.ContainsKey(agentID)) m_AgentRegions.Remove(agentID); diff --git a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs index 2d0ed470d2..6c51ece2eb 100644 --- a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs @@ -198,7 +198,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue // ClientClosed(client.AgentId); // } - private void ClientClosed(UUID AgentID) + private void ClientClosed(UUID AgentID, Scene scene) { m_log.DebugFormat("[EVENTQUEUE]: Closed client {0} in region {1}", AgentID, m_scene.RegionInfo.RegionName); diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index 30f35d053d..88d4921081 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -287,7 +287,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap /// Event handler /// /// AgentID that logged out - private void ClientLoggedOut(UUID AgentId) + private void ClientLoggedOut(UUID AgentId, Scene scene) { List presences = m_scene.GetAvatars(); int rootcount = 0; diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 469f13950c..3e4641a4b6 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -162,7 +162,7 @@ namespace OpenSim.Region.Framework.Scenes public event IncomingInstantMessage OnUnhandledInstantMessage; - public delegate void ClientClosed(UUID clientID); + public delegate void ClientClosed(UUID clientID, Scene scene); public event ClientClosed OnClientClosed; @@ -733,12 +733,12 @@ namespace OpenSim.Region.Framework.Scenes } } - public void TriggerClientClosed(UUID ClientID) + public void TriggerClientClosed(UUID ClientID, Scene scene) { handlerClientClosed = OnClientClosed; if (handlerClientClosed != null) { - handlerClientClosed(ClientID); + handlerClientClosed(ClientID, scene); } } diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 733c062910..acad033921 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2224,7 +2224,7 @@ namespace OpenSim.Region.Framework.Scenes m_sceneGridService.SendCloseChildAgentConnections(agentID, regions); } - m_eventManager.TriggerClientClosed(agentID); + m_eventManager.TriggerClientClosed(agentID, this); } catch (NullReferenceException) { diff --git a/OpenSim/Region/ReplaceableModules/MoneyModule/SampleMoneyModule.cs b/OpenSim/Region/ReplaceableModules/MoneyModule/SampleMoneyModule.cs index cd68541c59..f9ca5fc75f 100644 --- a/OpenSim/Region/ReplaceableModules/MoneyModule/SampleMoneyModule.cs +++ b/OpenSim/Region/ReplaceableModules/MoneyModule/SampleMoneyModule.cs @@ -697,7 +697,7 @@ namespace OpenSim.Region.ReplaceableModules.MoneyModule /// When the client closes the connection we remove their accounting info from memory to free up resources. /// /// - public void ClientClosed(UUID AgentID) + public void ClientClosed(UUID AgentID, Scene scene) { } @@ -759,7 +759,7 @@ namespace OpenSim.Region.ReplaceableModules.MoneyModule /// Event Handler for when the client logs out. /// /// - private void ClientLoggedOut(UUID AgentId) + private void ClientLoggedOut(UUID AgentId, Scene scene) { } @@ -770,7 +770,7 @@ namespace OpenSim.Region.ReplaceableModules.MoneyModule /// public void ClientClosed(IClientAPI client) { - ClientClosed(client.AgentId); + ClientClosed(client.AgentId, null); } /// diff --git a/OpenSim/Region/UserStatistics/WebStatsModule.cs b/OpenSim/Region/UserStatistics/WebStatsModule.cs index 715d295a08..939248f4f5 100644 --- a/OpenSim/Region/UserStatistics/WebStatsModule.cs +++ b/OpenSim/Region/UserStatistics/WebStatsModule.cs @@ -386,7 +386,7 @@ namespace OpenSim.Region.UserStatistics } - public void OnClientClosed(UUID agentID) + public void OnClientClosed(UUID agentID, Scene scene) { lock (m_sessions) {