* 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.xmlprioritization
parent
395a8680c3
commit
dc11643c00
|
@ -339,12 +339,6 @@ namespace OpenSim.Client.MXP.PacketHandler
|
|||
m_clients.Add(client);
|
||||
m_log.Debug("[MXP ClientStack]: Created ClientView.");
|
||||
|
||||
|
||||
m_log.Debug("[MXP ClientStack]: Adding ClientView to Scene...");
|
||||
scene.ClientManager.Add(client.AgentId, client.RemoteEndPoint, client);
|
||||
m_log.Debug("[MXP ClientStack]: Added ClientView to Scene.");
|
||||
|
||||
|
||||
client.MXPSendSynchronizationBegin(m_scenes[new UUID(joinRequestMessage.BubbleId)].SceneContents.GetTotalObjectsCount());
|
||||
|
||||
m_log.Debug("[MXP ClientStack]: Starting ClientView...");
|
||||
|
|
|
@ -207,6 +207,11 @@ namespace OpenSim.Client.VWoHTTP.ClientStack
|
|||
get { throw new System.NotImplementedException(); }
|
||||
}
|
||||
|
||||
public IPEndPoint RemoteEndPoint
|
||||
{
|
||||
get { throw new System.NotImplementedException(); }
|
||||
}
|
||||
|
||||
public event GenericMessage OnGenericMessage = delegate { };
|
||||
public event ImprovedInstantMessage OnInstantMessage = delegate { };
|
||||
public event ChatMessage OnChatFromClient = delegate { };
|
||||
|
|
|
@ -134,6 +134,20 @@ namespace OpenSim.Framework
|
|||
}
|
||||
}
|
||||
|
||||
public void Remove(UUID key)
|
||||
{
|
||||
lock (m_writeLock)
|
||||
{
|
||||
IClientAPI client;
|
||||
|
||||
if (m_dict.TryGetValue(key, out client))
|
||||
{
|
||||
m_dict = m_dict.Delete(key);
|
||||
m_dict2 = m_dict2.Delete(client.RemoteEndPoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets the client collection
|
||||
/// </summary>
|
||||
|
|
|
@ -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,18 +809,12 @@ 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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -833,6 +833,11 @@ namespace OpenSim.Region.Examples.SimpleModule
|
|||
set { m_circuitCode = value; }
|
||||
}
|
||||
|
||||
public IPEndPoint RemoteEndPoint
|
||||
{
|
||||
get { return new IPEndPoint(IPAddress.Loopback, (ushort)m_circuitCode); }
|
||||
}
|
||||
|
||||
public void SendBlueBoxMessage(UUID FromAvatarID, String FromAvatarName, String Message)
|
||||
{
|
||||
|
||||
|
|
|
@ -2363,6 +2363,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// <param name="client"></param>
|
||||
public override void AddNewClient(IClientAPI client)
|
||||
{
|
||||
ClientManager.Add(client);
|
||||
|
||||
CheckHeartbeat();
|
||||
SubscribeToClientEvents(client);
|
||||
ScenePresence presence;
|
||||
|
@ -3002,7 +3004,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
agentTransactions.RemoveAgentAssetTransactions(agentID);
|
||||
}
|
||||
|
||||
// Remove the avatar from the scene
|
||||
m_sceneGraph.RemoveScenePresence(agentID);
|
||||
ClientManager.Remove(agentID);
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -64,7 +64,6 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView
|
|||
void user_OnIRCReady(IRCClientView cv)
|
||||
{
|
||||
m_log.Info("[IRCd] Adding user...");
|
||||
m_scene.ClientManager.Add(cv.AgentId, cv.RemoteEndPoint, cv);
|
||||
cv.Start();
|
||||
m_log.Info("[IRCd] Added user to Scene");
|
||||
}
|
||||
|
|
|
@ -155,7 +155,6 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
|||
NPCAvatar npcAvatar = new NPCAvatar(p_firstname, p_lastname, p_position, p_scene);
|
||||
npcAvatar.CircuitCode = (uint) Util.RandomClass.Next(0, int.MaxValue);
|
||||
|
||||
p_scene.ClientManager.Add(npcAvatar.AgentId, npcAvatar.RemoteEndPoint, npcAvatar);
|
||||
p_scene.AddNewClient(npcAvatar);
|
||||
|
||||
ScenePresence sp;
|
||||
|
|
|
@ -393,6 +393,11 @@ namespace OpenSim.Tests.Common.Mock
|
|||
set { m_circuitCode = value; }
|
||||
}
|
||||
|
||||
public IPEndPoint RemoteEndPoint
|
||||
{
|
||||
get { return new IPEndPoint(IPAddress.Loopback, (ushort)m_circuitCode); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
|
|
|
@ -3497,7 +3497,6 @@
|
|||
<Reference name="OpenSim.Tests.Common"/>
|
||||
<Reference name="OpenSim.Framework"/>
|
||||
<Reference name="OpenSim.Framework.Serialization"/>
|
||||
<Reference name="OpenSim.Framework.Serialization.External"/>
|
||||
<Reference name="log4net.dll"/>
|
||||
<Reference name="nunit.framework.dll" />
|
||||
|
||||
|
|
Loading…
Reference in New Issue