* Remapped the Connection shutdown path.

* This fixes a *bunch* of Mantis bugs related to the following
* -- Neighbouring simulators not appearing after relog
* -- Login to simulator only to be logged off by simulator.
* -- ThreadAbort 
* -- Unable to shutdown circuitCode: x
afrisby
Teravus Ovares 2007-12-21 16:55:03 +00:00
parent ab673a1f8d
commit a453672edb
6 changed files with 34 additions and 16 deletions

View File

@ -111,7 +111,7 @@ namespace OpenSim.Framework
if (m_clients.TryGetValue(circuits[i], out client)) if (m_clients.TryGetValue(circuits[i], out client))
{ {
Remove(client.CircuitCode); Remove(client.CircuitCode);
client.Close(); client.Close(false);
} }
} }
catch (System.Exception e) catch (System.Exception e)

View File

@ -572,7 +572,7 @@ namespace OpenSim.Framework
void SetDebug(int newDebug); void SetDebug(int newDebug);
void InPacket(Packet NewPack); void InPacket(Packet NewPack);
void Close(); void Close(bool ShutdownCircuit);
void Kick(string message); void Kick(string message);
void Stop(); void Stop();
event ViewerEffectEventHandler OnViewerEffect; event ViewerEffectEventHandler OnViewerEffect;

View File

@ -199,23 +199,25 @@ namespace OpenSim.Region.ClientStack
# region Client Methods # region Client Methods
public void Close() private void CloseCleanup()
{ {
// Pull Client out of Region
MainLog.Instance.Verbose("CLIENT", "Close has been called");
m_scene.RemoveClient(AgentId); m_scene.RemoveClient(AgentId);
// Send the STOP packet // Send the STOP packet
DisableSimulatorPacket disable = new DisableSimulatorPacket(); DisableSimulatorPacket disable = new DisableSimulatorPacket();
OutPacket(disable, ThrottleOutPacketType.Task); OutPacket(disable, ThrottleOutPacketType.Task);
// FLUSH Packets // FLUSH Packets
m_packetQueue.Close(); m_packetQueue.Close();
m_packetQueue.Flush(); m_packetQueue.Flush();
Thread.Sleep(2000); Thread.Sleep(2000);
// Shut down timers // Shut down timers
m_ackTimer.Stop(); m_ackTimer.Stop();
m_clientPingTimer.Stop(); m_clientPingTimer.Stop();
@ -226,11 +228,27 @@ namespace OpenSim.Region.ClientStack
// We can't reach into other scenes and close the connection // We can't reach into other scenes and close the connection
// We need to do this over grid communications // We need to do this over grid communications
m_scene.CloseAllAgents(CircuitCode); //m_scene.CloseAllAgents(CircuitCode);
m_clientThread.Abort(); m_clientThread.Abort();
} }
public void Close(bool ShutdownCircult)
{
// Pull Client out of Region
MainLog.Instance.Verbose("CLIENT", "Close has been called");
//raiseevent on the packet server to Shutdown the circuit
if (ShutdownCircult)
OnConnectionClosed(this);
CloseCleanup();
}
public void Kick(string message) public void Kick(string message)
{ {
KickUserPacket kupack = new KickUserPacket(); KickUserPacket kupack = new KickUserPacket();
@ -2214,7 +2232,7 @@ namespace OpenSim.Region.ClientStack
"ClientView.m_packetQueue.cs:ProcessOutPacket() - WARNING: Socket exception occurred on connection " + "ClientView.m_packetQueue.cs:ProcessOutPacket() - WARNING: Socket exception occurred on connection " +
m_userEndPoint.ToString() + " - killing thread"); m_userEndPoint.ToString() + " - killing thread");
MainLog.Instance.Error(e.ToString()); MainLog.Instance.Error(e.ToString());
Close(); Close(true);
} }
} }

View File

@ -132,7 +132,7 @@ namespace OpenSim.Region.ClientStack
public virtual void CloseClient(IClientAPI client) public virtual void CloseClient(IClientAPI client)
{ {
CloseCircuit(client.CircuitCode); CloseCircuit(client.CircuitCode);
client.Close(); client.Close(false);
} }
} }
} }

View File

@ -478,7 +478,7 @@ namespace OpenSim.Region.Environment.Scenes
// Stop all client threads. // Stop all client threads.
ForEachScenePresence(delegate(ScenePresence avatar) ForEachScenePresence(delegate(ScenePresence avatar)
{ {
avatar.ControllingClient.Close(); avatar.ControllingClient.Close(true);
}); });
// Stop updating the scene objects and agents. // Stop updating the scene objects and agents.
m_heartbeatTimer.Close(); m_heartbeatTimer.Close();
@ -1758,7 +1758,7 @@ namespace OpenSim.Region.Environment.Scenes
bool childagent = !p.Equals(null) && p.IsChildAgent; bool childagent = !p.Equals(null) && p.IsChildAgent;
if (controller.AgentId != godID && !childagent) // Do we really want to kick the initiator of this madness? if (controller.AgentId != godID && !childagent) // Do we really want to kick the initiator of this madness?
{ {
controller.Close(); controller.Close(true);
} }
} }
); );
@ -1775,7 +1775,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
m_scenePresences[agentID].ControllingClient.Kick(Helpers.FieldToUTF8String(reason)); m_scenePresences[agentID].ControllingClient.Kick(Helpers.FieldToUTF8String(reason));
m_scenePresences[agentID].ControllingClient.Close(); m_scenePresences[agentID].ControllingClient.Close(true);
} }
} }
else else

View File

@ -464,7 +464,7 @@ namespace SimpleApp
{ {
} }
public void Close() public void Close(bool ShutdownCircuit)
{ {
} }