mirror of
https://github.com/opensim/opensim.git
synced 2026-08-06 09:16:28 +08:00
* Fixed a bug where clients were being added to ClientManager twice
* Changed the ClientManager interface to reduce potential errors with duplicate or mismatched keys * Added IClientAPI.RemoteEndPoint, which can (hopefully) eventually replace IClientAPI.CircuitCode * Changed the order of operations during client shutdown
This commit is contained in:
@@ -411,38 +411,34 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
"[CLIENT]: Close has been called for {0} attached to scene {1}",
|
||||
Name, m_scene.RegionInfo.RegionName);
|
||||
|
||||
// Remove ourselves from the scene
|
||||
m_scene.ClientManager.Remove(m_agentId, m_udpClient.RemoteEndPoint);
|
||||
|
||||
if (m_imageManager != null)
|
||||
{
|
||||
m_imageManager.Close();
|
||||
m_imageManager = null;
|
||||
}
|
||||
|
||||
if (m_udpServer != null)
|
||||
{
|
||||
m_udpServer.Flush();
|
||||
}
|
||||
|
||||
if (OnConnectionClosed != null)
|
||||
OnConnectionClosed(this);
|
||||
|
||||
CloseCleanup();
|
||||
}
|
||||
|
||||
private void CloseCleanup()
|
||||
{
|
||||
m_scene.RemoveClient(AgentId);
|
||||
|
||||
//m_log.InfoFormat("[CLIENTVIEW] Memory pre GC {0}", System.GC.GetTotalMemory(false));
|
||||
//m_log.InfoFormat("[CLIENTVIEW] Memory post GC {0}", System.GC.GetTotalMemory(true));
|
||||
|
||||
// Send the STOP packet
|
||||
DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator);
|
||||
OutPacket(disable, ThrottleOutPacketType.Unknown);
|
||||
|
||||
Thread.Sleep(2000);
|
||||
IsActive = false;
|
||||
|
||||
// Shutdown the image manager
|
||||
if (m_imageManager != null)
|
||||
m_imageManager.Close();
|
||||
|
||||
// Fire the callback for this connection closing
|
||||
if (OnConnectionClosed != null)
|
||||
OnConnectionClosed(this);
|
||||
|
||||
// Flush all of the packets out of the UDP server for this client
|
||||
if (m_udpServer != null)
|
||||
m_udpServer.Flush(m_udpClient);
|
||||
|
||||
// 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();
|
||||
//m_log.InfoFormat("[CLIENTVIEW] Memory post GC {0}", System.GC.GetTotalMemory(true));
|
||||
|
||||
// FIXME: Is this still necessary?
|
||||
//Thread.Sleep(2000);
|
||||
|
||||
// Shut down timers. Thread Context of this method is murky. Lock all timers
|
||||
if (m_avatarTerseUpdateTimer.Enabled)
|
||||
@@ -459,8 +455,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
// We need to do this over grid communications
|
||||
//m_scene.CloseAllAgents(CircuitCode);
|
||||
|
||||
IsActive = false;
|
||||
|
||||
m_avatarTerseUpdateTimer.Dispose();
|
||||
m_primTerseUpdateTimer.Dispose();
|
||||
m_primFullUpdateTimer.Dispose();
|
||||
|
||||
@@ -167,39 +167,39 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
J2KImage imagereq;
|
||||
int numCollected = 0;
|
||||
|
||||
//lock (m_syncRoot)
|
||||
//{
|
||||
m_lastloopprocessed = DateTime.Now.Ticks;
|
||||
m_lastloopprocessed = DateTime.Now.Ticks;
|
||||
|
||||
// This can happen during Close()
|
||||
if (m_client == null)
|
||||
return false;
|
||||
|
||||
while ((imagereq = GetHighestPriorityImage()) != null)
|
||||
// This can happen during Close()
|
||||
if (m_client == null)
|
||||
return false;
|
||||
|
||||
while ((imagereq = GetHighestPriorityImage()) != null)
|
||||
{
|
||||
if (imagereq.IsDecoded == true)
|
||||
{
|
||||
if (imagereq.IsDecoded == true)
|
||||
++numCollected;
|
||||
|
||||
if (imagereq.SendPackets(m_client, maxpack))
|
||||
{
|
||||
++numCollected;
|
||||
|
||||
if (imagereq.SendPackets(m_client, maxpack))
|
||||
{
|
||||
// Send complete. Destroy any knowledge of this transfer
|
||||
RemoveImageFromQueue(imagereq);
|
||||
}
|
||||
// Send complete. Destroy any knowledge of this transfer
|
||||
RemoveImageFromQueue(imagereq);
|
||||
}
|
||||
|
||||
if (numCollected == count)
|
||||
break;
|
||||
}
|
||||
//}
|
||||
|
||||
if (numCollected == count)
|
||||
break;
|
||||
}
|
||||
|
||||
return m_priorityQueue.Count > 0;
|
||||
}
|
||||
|
||||
//Faux destructor
|
||||
/// <summary>
|
||||
/// Faux destructor
|
||||
/// </summary>
|
||||
public void Close()
|
||||
{
|
||||
m_shuttingdown = true;
|
||||
m_priorityQueue = null;
|
||||
m_j2kDecodeModule = null;
|
||||
m_assetCache = null;
|
||||
m_client = null;
|
||||
|
||||
@@ -390,7 +390,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
}
|
||||
}
|
||||
|
||||
public void Flush()
|
||||
public void Flush(LLUDPClient udpClient)
|
||||
{
|
||||
// FIXME: Implement?
|
||||
}
|
||||
@@ -645,15 +645,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
client.OnLogout += LogoutHandler;
|
||||
client.OnConnectionClosed += ConnectionClosedHandler;
|
||||
|
||||
m_scene.ClientManager.Add(agentID, remoteEndPoint, client);
|
||||
|
||||
// Start the IClientAPI
|
||||
m_scene.ClientManager.Add(agentID, remoteEndPoint, client);
|
||||
m_scene.ClientManager.Add(client);
|
||||
client.Start();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.Debug("[LLUDPSERVER]: Ignoring a repeated UseCircuitCode from " + udpClient.AgentID);
|
||||
m_log.WarnFormat("[LLUDPSERVER]: Ignoring a repeated UseCircuitCode from {0} at {1} for circuit {2}",
|
||||
udpClient.AgentID, remoteEndPoint, circuitCode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user