mirror of
https://github.com/opensim/opensim.git
synced 2026-07-31 22:05:36 +08:00
* Consolidated adding / removing ClientManager IClientAPIs to two places in Scene
* Added some missing implementations of IClientAPI.RemoteEndPoint * Added a ClientManager.Remove(UUID) overload * Removed a reference to a missing project from prebuild.xml
This commit is contained in:
@@ -324,6 +324,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
#region Properties
|
||||
|
||||
public LLUDPClient UDPClient { get { return m_udpClient; } }
|
||||
public IPEndPoint RemoteEndPoint { get { return m_udpClient.RemoteEndPoint; } }
|
||||
public UUID SecureSessionId { get { return m_secureSessionId; } }
|
||||
public IScene Scene { get { return m_scene; } }
|
||||
public UUID SessionId { get { return m_sessionId; } }
|
||||
@@ -431,7 +432,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
|
||||
// Remove ourselves from the scene
|
||||
m_scene.RemoveClient(AgentId);
|
||||
m_scene.ClientManager.Remove(this);
|
||||
|
||||
//m_log.InfoFormat("[CLIENTVIEW] Memory pre GC {0}", System.GC.GetTotalMemory(false));
|
||||
//GC.Collect();
|
||||
@@ -586,11 +586,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
|
||||
# region Setup
|
||||
|
||||
/// <summary>
|
||||
/// Starts up the timers to check the client and resend unacked packets
|
||||
/// Adds the client to the OpenSim.Region.Framework.Scenes.Scene
|
||||
/// </summary>
|
||||
protected virtual void InitNewClient()
|
||||
public virtual void Start()
|
||||
{
|
||||
m_avatarTerseUpdateTimer = new Timer(m_avatarTerseUpdateRate);
|
||||
m_avatarTerseUpdateTimer.Elapsed += new ElapsedEventHandler(ProcessAvatarTerseUpdates);
|
||||
@@ -609,59 +605,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
RefreshGroupMembership();
|
||||
}
|
||||
|
||||
public virtual void Start()
|
||||
{
|
||||
// This sets up all the timers
|
||||
InitNewClient();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Run a user session. This method lies at the base of the entire client thread.
|
||||
/// </summary>
|
||||
protected void RunUserSession()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (e is ThreadAbortException)
|
||||
throw;
|
||||
|
||||
if (StatsManager.SimExtraStats != null)
|
||||
StatsManager.SimExtraStats.AddAbnormalClientThreadTermination();
|
||||
|
||||
// Don't let a failure in an individual client thread crash the whole sim.
|
||||
m_log.ErrorFormat(
|
||||
"[CLIENT]: Client thread for {0} {1} crashed. Logging them out.", Name, AgentId);
|
||||
m_log.Error(e.ToString());
|
||||
|
||||
try
|
||||
{
|
||||
// Make an attempt to alert the user that their session has crashed
|
||||
AgentAlertMessagePacket packet
|
||||
= BuildAgentAlertPacket(
|
||||
"Unfortunately the session for this client on the server has crashed.\n"
|
||||
+ "Any further actions taken will not be processed.\n"
|
||||
+ "Please relog", true);
|
||||
|
||||
OutPacket(packet, ThrottleOutPacketType.Unknown);
|
||||
|
||||
// There may be a better way to do this. Perhaps kick? Not sure this propogates notifications to
|
||||
// listeners yet, though.
|
||||
Logout(this);
|
||||
}
|
||||
catch (Exception e2)
|
||||
{
|
||||
if (e2 is ThreadAbortException)
|
||||
throw;
|
||||
|
||||
m_log.ErrorFormat("[CLIENT]: Further exception thrown on forced session logout. {0}", e2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# endregion
|
||||
|
||||
public void ActivateGesture(UUID assetId, UUID gestureId)
|
||||
|
||||
@@ -646,7 +646,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
client.OnConnectionClosed += ConnectionClosedHandler;
|
||||
|
||||
// Start the IClientAPI
|
||||
m_scene.ClientManager.Add(client);
|
||||
client.Start();
|
||||
}
|
||||
else
|
||||
@@ -658,10 +657,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
|
||||
private void RemoveClient(LLUDPClient udpClient)
|
||||
{
|
||||
// Remove this client from the scene ClientManager
|
||||
// Remove this client from the scene
|
||||
IClientAPI client;
|
||||
if (m_scene.ClientManager.TryGetValue(udpClient.AgentID, out client))
|
||||
Util.FireAndForget(delegate(object o) { client.Close(); });
|
||||
client.Close();
|
||||
}
|
||||
|
||||
private void AcknowledgePacket(LLUDPClient client, uint ack, int currentTime, bool fromResend)
|
||||
@@ -810,19 +809,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
private void LogoutHandler(IClientAPI client)
|
||||
{
|
||||
client.OnLogout -= LogoutHandler;
|
||||
|
||||
client.SendLogoutPacket();
|
||||
|
||||
if (client is LLClientView)
|
||||
RemoveClient(((LLClientView)client).UDPClient);
|
||||
}
|
||||
|
||||
private void ConnectionClosedHandler(IClientAPI client)
|
||||
{
|
||||
client.OnConnectionClosed -= ConnectionClosedHandler;
|
||||
|
||||
if (client is LLClientView)
|
||||
RemoveClient(((LLClientView)client).UDPClient);
|
||||
RemoveClient(((LLClientView)client).UDPClient);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user