In PresenceDetector.OnConnectionClose(), use the IsChildAgent check already available on IClientAPI.SceneAgent rather than retrieving it again by scanning all scenes.
parent
48f47bb4c7
commit
d8c40ca462
|
@ -740,14 +740,24 @@ namespace OpenSim.Framework
|
||||||
/// </summary>
|
/// </summary>
|
||||||
string Name { get; }
|
string Name { get; }
|
||||||
|
|
||||||
/// <value>
|
/// <summary>
|
||||||
/// Determines whether the client thread is doing anything or not.
|
/// True if the client is active (sending and receiving new UDP messages). False if the client is closing.
|
||||||
/// </value>
|
/// </summary>
|
||||||
bool IsActive { get; set; }
|
bool IsActive { get; set; }
|
||||||
|
|
||||||
/// <value>
|
/// <summary>
|
||||||
/// Determines whether the client is or has been removed from a given scene
|
/// Set if the client is closing due to a logout request or because of too much time since last ack.
|
||||||
/// </value>
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Do not use this flag if you want to know if the client is closing, since it will not be set in other
|
||||||
|
/// circumstances (e.g. if a child agent is closed or the agent is kicked off the simulator). Use IsActive
|
||||||
|
/// instead.
|
||||||
|
///
|
||||||
|
/// Only set for root agents.
|
||||||
|
///
|
||||||
|
/// TODO: Too much time since last ack should probably be a separate property, or possibly part of a state
|
||||||
|
/// machine.
|
||||||
|
/// </remarks>
|
||||||
bool IsLoggingOut { get; set; }
|
bool IsLoggingOut { get; set; }
|
||||||
|
|
||||||
bool SendLogoutPacketWhenClosing { set; }
|
bool SendLogoutPacketWhenClosing { set; }
|
||||||
|
|
|
@ -494,12 +494,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Close()
|
public void Close()
|
||||||
{
|
{
|
||||||
|
IsActive = false;
|
||||||
|
|
||||||
m_log.DebugFormat(
|
m_log.DebugFormat(
|
||||||
"[CLIENT]: Close has been called for {0} attached to scene {1}",
|
"[CLIENT]: Close has been called for {0} attached to scene {1}",
|
||||||
Name, m_scene.RegionInfo.RegionName);
|
Name, m_scene.RegionInfo.RegionName);
|
||||||
|
|
||||||
IsActive = false;
|
|
||||||
|
|
||||||
// Shutdown the image manager
|
// Shutdown the image manager
|
||||||
ImageManager.Close();
|
ImageManager.Close();
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
|
||||||
scene.EventManager.OnNewClient -= OnNewClient;
|
scene.EventManager.OnNewClient -= OnNewClient;
|
||||||
|
|
||||||
m_PresenceService.LogoutRegionAgents(scene.RegionInfo.RegionID);
|
m_PresenceService.LogoutRegionAgents(scene.RegionInfo.RegionID);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnMakeRootAgent(ScenePresence sp)
|
public void OnMakeRootAgent(ScenePresence sp)
|
||||||
|
@ -80,18 +79,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
|
||||||
|
|
||||||
public void OnConnectionClose(IClientAPI client)
|
public void OnConnectionClose(IClientAPI client)
|
||||||
{
|
{
|
||||||
if (client.IsLoggingOut)
|
if (client.IsLoggingOut && !client.SceneAgent.IsChildAgent)
|
||||||
{
|
{
|
||||||
object sp = null;
|
|
||||||
if (client.Scene.TryGetScenePresence(client.AgentId, out sp))
|
|
||||||
{
|
|
||||||
if (sp is ScenePresence)
|
|
||||||
{
|
|
||||||
if (((ScenePresence)sp).IsChildAgent)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3436,7 +3436,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// We have a zombie from a crashed session.
|
// We have a zombie from a crashed session.
|
||||||
// Or the same user is trying to be root twice here, won't work.
|
// Or the same user is trying to be root twice here, won't work.
|
||||||
// Kill it.
|
// Kill it.
|
||||||
m_log.DebugFormat("[SCENE]: Zombie scene presence detected for {0} in {1}", agent.AgentID, RegionInfo.RegionName);
|
m_log.DebugFormat(
|
||||||
|
"[SCENE]: Zombie scene presence detected for {0} {1} in {2}",
|
||||||
|
sp.Name, sp.UUID, RegionInfo.RegionName);
|
||||||
|
|
||||||
sp.ControllingClient.Close();
|
sp.ControllingClient.Close();
|
||||||
sp = null;
|
sp = null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue