diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs index a7e62eb755..3f418f6de3 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs @@ -50,7 +50,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence public void AddRegion(Scene scene) { scene.EventManager.OnMakeRootAgent += OnMakeRootAgent; - scene.EventManager.OnNewClient += OnNewClient; m_PresenceService.LogoutRegionAgents(scene.RegionInfo.RegionID); @@ -61,7 +60,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence public void RemoveRegion(Scene scene) { scene.EventManager.OnMakeRootAgent -= OnMakeRootAgent; - scene.EventManager.OnNewClient -= OnNewClient; m_PresenceService.LogoutRegionAgents(scene.RegionInfo.RegionID); } @@ -71,7 +69,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence if (sp.IsNPC) return; - if(sp.gotCrossUpdate) + sp.ControllingClient.OnConnectionClosed += OnConnectionClose; + + if (sp.gotCrossUpdate) { Util.FireAndForget(delegate { @@ -89,11 +89,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence m_PresenceService.ReportAgent(sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID); } - public void OnNewClient(IClientAPI client) - { - client.OnConnectionClosed += OnConnectionClose; - } - public void OnConnectionClose(IClientAPI client) { if (client != null && client.SceneAgent != null && !client.SceneAgent.IsChildAgent)