OnConnectionClosed listeners, retrieve data from IClientAPI.SceneAgent rather than scanning all scene for the presence with the right id

Stop checking IsLoggingOut on these listeners, if called with a root agent then we always want to perform these actions.
This covers cases where the client is closed due to manual kick, simulator shutdown, etc.
0.7.4.1
Justin Clark-Casey (justincc) 2012-06-12 02:43:33 +01:00
parent b099f26376
commit 1b1f0a2d77
6 changed files with 43 additions and 70 deletions

View File

@ -26,6 +26,7 @@
*/ */
using System; using System;
using OpenMetaverse;
namespace OpenSim.Framework namespace OpenSim.Framework
{ {
@ -71,5 +72,11 @@ namespace OpenSim.Framework
/// This includes scene object data and the appearance data of other avatars. /// This includes scene object data and the appearance data of other avatars.
/// </remarks> /// </remarks>
void SendInitialDataToMe(); void SendInitialDataToMe();
/// <summary>
/// Direction in which the scene presence is looking.
/// </summary>
/// <remarks>Will be Vector3.Zero for a child agent.</remarks>
Vector3 Lookat { get; }
} }
} }

View File

@ -325,34 +325,30 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
void OnConnectionClosed(IClientAPI obj) void OnConnectionClosed(IClientAPI obj)
{ {
if (obj.IsLoggingOut) if (obj.SceneAgent.IsChildAgent)
return;
// Let's find out if this is a foreign user or a local user
IUserManagement uMan = Scene.RequestModuleInterface<IUserManagement>();
// UserAccount account = Scene.UserAccountService.GetUserAccount(Scene.RegionInfo.ScopeID, obj.AgentId);
if (uMan != null && uMan.IsLocalGridUser(obj.AgentId))
{ {
object sp = null; // local grid user
if (obj.Scene.TryGetScenePresence(obj.AgentId, out sp)) return;
{ }
if (((ScenePresence)sp).IsChildAgent)
return;
}
// Let's find out if this is a foreign user or a local user AgentCircuitData aCircuit = ((Scene)(obj.Scene)).AuthenticateHandler.GetAgentCircuitData(obj.CircuitCode);
IUserManagement uMan = Scene.RequestModuleInterface<IUserManagement>();
// UserAccount account = Scene.UserAccountService.GetUserAccount(Scene.RegionInfo.ScopeID, obj.AgentId);
if (uMan != null && uMan.IsLocalGridUser(obj.AgentId))
{
// local grid user
return;
}
AgentCircuitData aCircuit = ((Scene)(obj.Scene)).AuthenticateHandler.GetAgentCircuitData(obj.CircuitCode); if (aCircuit.ServiceURLs.ContainsKey("HomeURI"))
{
if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) string url = aCircuit.ServiceURLs["HomeURI"].ToString();
{ IUserAgentService security = new UserAgentServiceConnector(url);
string url = aCircuit.ServiceURLs["HomeURI"].ToString(); security.LogoutAgent(obj.AgentId, obj.SessionId);
IUserAgentService security = new UserAgentServiceConnector(url); //m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Sent logout call to UserAgentService @ {0}", url);
security.LogoutAgent(obj.AgentId, obj.SessionId); }
//m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Sent logout call to UserAgentService @ {0}", url); else
} {
else
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: HomeURI not found for agent {0} logout", obj.AgentId); m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: HomeURI not found for agent {0} logout", obj.AgentId);
} }
} }

View File

@ -79,29 +79,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser
public void OnConnectionClose(IClientAPI client) public void OnConnectionClose(IClientAPI client)
{ {
if (client.IsLoggingOut) if (client.SceneAgent.IsChildAgent)
{ return;
object sp = null;
Vector3 position = new Vector3(128, 128, 0);
Vector3 lookat = new Vector3(0, 1, 0);
if (client.Scene.TryGetScenePresence(client.AgentId, out sp))
{
if (sp is ScenePresence)
{
if (((ScenePresence)sp).IsChildAgent)
return;
position = ((ScenePresence)sp).AbsolutePosition;
lookat = ((ScenePresence)sp).Lookat;
}
}
// m_log.DebugFormat("[ACTIVITY DETECTOR]: Detected client logout {0} in {1}", client.AgentId, client.Scene.RegionInfo.RegionName);
m_GridUserService.LoggedOut(client.AgentId.ToString(), client.SessionId, client.Scene.RegionInfo.RegionID, position, lookat);
}
// m_log.DebugFormat("[ACTIVITY DETECTOR]: Detected client logout {0} in {1}", client.AgentId, client.Scene.RegionInfo.RegionName);
m_GridUserService.LoggedOut(
client.AgentId.ToString(), client.SessionId, client.Scene.RegionInfo.RegionID,
client.SceneAgent.AbsolutePosition, client.SceneAgent.Lookat);
} }
} }
} }

View File

@ -79,7 +79,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
public void OnConnectionClose(IClientAPI client) public void OnConnectionClose(IClientAPI client)
{ {
if (client.IsLoggingOut && !client.SceneAgent.IsChildAgent) if (!client.SceneAgent.IsChildAgent)
{ {
// m_log.DebugFormat("[PRESENCE DETECTOR]: Detected client logout {0} in {1}", client.AgentId, client.Scene.RegionInfo.RegionName); // m_log.DebugFormat("[PRESENCE DETECTOR]: Detected client logout {0} in {1}", client.AgentId, client.Scene.RegionInfo.RegionName);
m_PresenceService.LogoutAgent(client.SessionId); m_PresenceService.LogoutAgent(client.SessionId);

View File

@ -137,7 +137,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
if (fh.Client.IsLoggingOut) if (!fh.Client.IsActive)
continue; continue;
// m_log.DebugFormat( // m_log.DebugFormat(

View File

@ -79,27 +79,13 @@ namespace OpenSim.Services.Connectors.SimianGrid
public void OnConnectionClose(IClientAPI client) public void OnConnectionClose(IClientAPI client)
{ {
if (client.IsLoggingOut) if (client.SceneAgent.IsChildAgent)
{ return;
object sp = null;
Vector3 position = new Vector3(128, 128, 0);
Vector3 lookat = new Vector3(0, 1, 0);
if (client.Scene.TryGetScenePresence(client.AgentId, out sp)) // m_log.DebugFormat("[ACTIVITY DETECTOR]: Detected client logout {0} in {1}", client.AgentId, client.Scene.RegionInfo.RegionName);
{ m_GridUserService.LoggedOut(
if (sp is ScenePresence) client.AgentId.ToString(), client.SessionId, client.Scene.RegionInfo.RegionID,
{ client.SceneAgent.AbsolutePosition, client.SceneAgent.Lookat);
if (((ScenePresence)sp).IsChildAgent)
return;
position = ((ScenePresence)sp).AbsolutePosition;
lookat = ((ScenePresence)sp).Lookat;
}
}
// m_log.DebugFormat("[SIMIAN ACTIVITY DETECTOR]: Detected client logout {0} in {1}", client.AgentId, client.Scene.RegionInfo.RegionName);
m_GridUserService.LoggedOut(client.AgentId.ToString(), client.SessionId, client.Scene.RegionInfo.RegionID, position, lookat);
}
} }
void OnEnteringNewParcel(ScenePresence sp, int localLandID, UUID regionID) void OnEnteringNewParcel(ScenePresence sp, int localLandID, UUID regionID)