aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorTeravus Ovares2007-12-21 16:55:03 +0000
committerTeravus Ovares2007-12-21 16:55:03 +0000
commita453672edb8169f9957e136ee8252e7391170721 (patch)
tree266e89502e0099dcadb0892b602e1afa397f837a
parentFixed that we weren't actually loading in some of the Library assets. Thanks ... (diff)
downloadopensim-SC-a453672edb8169f9957e136ee8252e7391170721.zip
opensim-SC-a453672edb8169f9957e136ee8252e7391170721.tar.gz
opensim-SC-a453672edb8169f9957e136ee8252e7391170721.tar.bz2
opensim-SC-a453672edb8169f9957e136ee8252e7391170721.tar.xz
* 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
-rw-r--r--OpenSim/Framework/ClientManager.cs2
-rw-r--r--OpenSim/Framework/IClientAPI.cs2
-rw-r--r--OpenSim/Region/ClientStack/ClientView.cs36
-rw-r--r--OpenSim/Region/ClientStack/PacketServer.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs6
-rw-r--r--OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs2
6 files changed, 34 insertions, 16 deletions
diff --git a/OpenSim/Framework/ClientManager.cs b/OpenSim/Framework/ClientManager.cs
index 698171d..e32c9eb 100644
--- a/OpenSim/Framework/ClientManager.cs
+++ b/OpenSim/Framework/ClientManager.cs
@@ -111,7 +111,7 @@ namespace OpenSim.Framework
111 if (m_clients.TryGetValue(circuits[i], out client)) 111 if (m_clients.TryGetValue(circuits[i], out client))
112 { 112 {
113 Remove(client.CircuitCode); 113 Remove(client.CircuitCode);
114 client.Close(); 114 client.Close(false);
115 } 115 }
116 } 116 }
117 catch (System.Exception e) 117 catch (System.Exception e)
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index fde74d6..41afe27 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -572,7 +572,7 @@ namespace OpenSim.Framework
572 572
573 void SetDebug(int newDebug); 573 void SetDebug(int newDebug);
574 void InPacket(Packet NewPack); 574 void InPacket(Packet NewPack);
575 void Close(); 575 void Close(bool ShutdownCircuit);
576 void Kick(string message); 576 void Kick(string message);
577 void Stop(); 577 void Stop();
578 event ViewerEffectEventHandler OnViewerEffect; 578 event ViewerEffectEventHandler OnViewerEffect;
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs
index 31e0e29..34186de 100644
--- a/OpenSim/Region/ClientStack/ClientView.cs
+++ b/OpenSim/Region/ClientStack/ClientView.cs
@@ -199,38 +199,56 @@ namespace OpenSim.Region.ClientStack
199 199
200 # region Client Methods 200 # region Client Methods
201 201
202 public void Close() 202 private void CloseCleanup()
203 { 203 {
204 // Pull Client out of Region
205 MainLog.Instance.Verbose("CLIENT", "Close has been called");
206 204
207 m_scene.RemoveClient(AgentId); 205 m_scene.RemoveClient(AgentId);
208
209 // Send the STOP packet 206 // Send the STOP packet
210 DisableSimulatorPacket disable = new DisableSimulatorPacket(); 207 DisableSimulatorPacket disable = new DisableSimulatorPacket();
211 OutPacket(disable, ThrottleOutPacketType.Task); 208 OutPacket(disable, ThrottleOutPacketType.Task);
212 209
210
213 // FLUSH Packets 211 // FLUSH Packets
214 m_packetQueue.Close(); 212 m_packetQueue.Close();
215 m_packetQueue.Flush(); 213 m_packetQueue.Flush();
216 214
217 Thread.Sleep(2000); 215 Thread.Sleep(2000);
218 216
217
218
219
220
219 // Shut down timers 221 // Shut down timers
220 m_ackTimer.Stop(); 222 m_ackTimer.Stop();
221 m_clientPingTimer.Stop(); 223 m_clientPingTimer.Stop();
222 224
223 // This is just to give the client a reasonable chance of 225 // This is just to give the client a reasonable chance of
224 // flushing out all it's packets. There should probably 226 // flushing out all it's packets. There should probably
225 // be a better mechanism here 227 // be a better mechanism here
226 228
227 // We can't reach into other scenes and close the connection 229 // We can't reach into other scenes and close the connection
228 // We need to do this over grid communications 230 // We need to do this over grid communications
229 m_scene.CloseAllAgents(CircuitCode); 231 //m_scene.CloseAllAgents(CircuitCode);
230 232
231 m_clientThread.Abort(); 233 m_clientThread.Abort();
232 } 234 }
233 235
236 public void Close(bool ShutdownCircult)
237 {
238
239 // Pull Client out of Region
240 MainLog.Instance.Verbose("CLIENT", "Close has been called");
241
242 //raiseevent on the packet server to Shutdown the circuit
243 if (ShutdownCircult)
244 OnConnectionClosed(this);
245
246
247 CloseCleanup();
248
249
250 }
251
234 public void Kick(string message) 252 public void Kick(string message)
235 { 253 {
236 KickUserPacket kupack = new KickUserPacket(); 254 KickUserPacket kupack = new KickUserPacket();
@@ -2214,7 +2232,7 @@ namespace OpenSim.Region.ClientStack
2214 "ClientView.m_packetQueue.cs:ProcessOutPacket() - WARNING: Socket exception occurred on connection " + 2232 "ClientView.m_packetQueue.cs:ProcessOutPacket() - WARNING: Socket exception occurred on connection " +
2215 m_userEndPoint.ToString() + " - killing thread"); 2233 m_userEndPoint.ToString() + " - killing thread");
2216 MainLog.Instance.Error(e.ToString()); 2234 MainLog.Instance.Error(e.ToString());
2217 Close(); 2235 Close(true);
2218 } 2236 }
2219 } 2237 }
2220 2238
diff --git a/OpenSim/Region/ClientStack/PacketServer.cs b/OpenSim/Region/ClientStack/PacketServer.cs
index 308728e..a4c18d0 100644
--- a/OpenSim/Region/ClientStack/PacketServer.cs
+++ b/OpenSim/Region/ClientStack/PacketServer.cs
@@ -132,7 +132,7 @@ namespace OpenSim.Region.ClientStack
132 public virtual void CloseClient(IClientAPI client) 132 public virtual void CloseClient(IClientAPI client)
133 { 133 {
134 CloseCircuit(client.CircuitCode); 134 CloseCircuit(client.CircuitCode);
135 client.Close(); 135 client.Close(false);
136 } 136 }
137 } 137 }
138} 138}
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 0cb353c..c4b409f 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -478,7 +478,7 @@ namespace OpenSim.Region.Environment.Scenes
478 // Stop all client threads. 478 // Stop all client threads.
479 ForEachScenePresence(delegate(ScenePresence avatar) 479 ForEachScenePresence(delegate(ScenePresence avatar)
480 { 480 {
481 avatar.ControllingClient.Close(); 481 avatar.ControllingClient.Close(true);
482 }); 482 });
483 // Stop updating the scene objects and agents. 483 // Stop updating the scene objects and agents.
484 m_heartbeatTimer.Close(); 484 m_heartbeatTimer.Close();
@@ -1758,7 +1758,7 @@ namespace OpenSim.Region.Environment.Scenes
1758 bool childagent = !p.Equals(null) && p.IsChildAgent; 1758 bool childagent = !p.Equals(null) && p.IsChildAgent;
1759 if (controller.AgentId != godID && !childagent) // Do we really want to kick the initiator of this madness? 1759 if (controller.AgentId != godID && !childagent) // Do we really want to kick the initiator of this madness?
1760 { 1760 {
1761 controller.Close(); 1761 controller.Close(true);
1762 } 1762 }
1763 } 1763 }
1764 ); 1764 );
@@ -1775,7 +1775,7 @@ namespace OpenSim.Region.Environment.Scenes
1775 } 1775 }
1776 1776
1777 m_scenePresences[agentID].ControllingClient.Kick(Helpers.FieldToUTF8String(reason)); 1777 m_scenePresences[agentID].ControllingClient.Kick(Helpers.FieldToUTF8String(reason));
1778 m_scenePresences[agentID].ControllingClient.Close(); 1778 m_scenePresences[agentID].ControllingClient.Close(true);
1779 } 1779 }
1780 } 1780 }
1781 else 1781 else
diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
index a59e7d6..4722c13 100644
--- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
@@ -464,7 +464,7 @@ namespace SimpleApp
464 { 464 {
465 } 465 }
466 466
467 public void Close() 467 public void Close(bool ShutdownCircuit)
468 { 468 {
469 } 469 }
470 470