diff options
author | Teravus Ovares | 2007-12-18 00:34:42 +0000 |
---|---|---|
committer | Teravus Ovares | 2007-12-18 00:34:42 +0000 |
commit | afe63faa2ee9cbdb8a8e0ee755a4d5ef06fe770b (patch) | |
tree | 4db7cf33153bb97ae87d009590947ab487f28173 | |
parent | Make region storage Sqlite by default rather than NullStorage (diff) | |
download | opensim-SC-afe63faa2ee9cbdb8a8e0ee755a4d5ef06fe770b.zip opensim-SC-afe63faa2ee9cbdb8a8e0ee755a4d5ef06fe770b.tar.gz opensim-SC-afe63faa2ee9cbdb8a8e0ee755a4d5ef06fe770b.tar.bz2 opensim-SC-afe63faa2ee9cbdb8a8e0ee755a4d5ef06fe770b.tar.xz |
* Fix for mantis 0000040 After client logout remote host closed connection on Simulator makes sim unuseable->'Closed Connection Called'
* I've fundamentally changed a few things, so this is experimental
* The routine that I used needs to be tested on Linux. I don't expect it to cause a problem, but hey, it might.
* Child agents are still not logged off properly, so when the first set time out, the second set get logged off also, on the second log in if the second login is initiated before the first one fully times out.
-rw-r--r-- | OpenSim/Framework/IScene.cs | 1 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/ClientView.cs | 8 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/PacketServer.cs | 5 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/UDPServer.cs | 53 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 5 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneBase.cs | 2 |
6 files changed, 66 insertions, 8 deletions
diff --git a/OpenSim/Framework/IScene.cs b/OpenSim/Framework/IScene.cs index d7071da..4b6e9a5 100644 --- a/OpenSim/Framework/IScene.cs +++ b/OpenSim/Framework/IScene.cs | |||
@@ -46,6 +46,7 @@ namespace OpenSim.Framework | |||
46 | 46 | ||
47 | void AddNewClient(IClientAPI client, bool child); | 47 | void AddNewClient(IClientAPI client, bool child); |
48 | void RemoveClient(LLUUID agentID); | 48 | void RemoveClient(LLUUID agentID); |
49 | void CloseAllAgents(uint circuitcode); | ||
49 | 50 | ||
50 | void Restart(int seconds); | 51 | void Restart(int seconds); |
51 | bool OtherRegionUp(RegionInfo thisRegion); | 52 | bool OtherRegionUp(RegionInfo thisRegion); |
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index 5e0ab65..df52745 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs | |||
@@ -209,8 +209,8 @@ namespace OpenSim.Region.ClientStack | |||
209 | m_scene.RemoveClient(AgentId); | 209 | m_scene.RemoveClient(AgentId); |
210 | 210 | ||
211 | // Send the STOP packet | 211 | // Send the STOP packet |
212 | //libsecondlife.Packets.DisableSimulatorPacket disable = new libsecondlife.Packets.DisableSimulatorPacket(); | 212 | DisableSimulatorPacket disable = new DisableSimulatorPacket(); |
213 | //OutPacket(disable, ThrottleOutPacketType.Task); | 213 | OutPacket(disable, ThrottleOutPacketType.Task); |
214 | 214 | ||
215 | // FLUSH Packets | 215 | // FLUSH Packets |
216 | m_packetQueue.Close(); | 216 | m_packetQueue.Close(); |
@@ -225,6 +225,10 @@ namespace OpenSim.Region.ClientStack | |||
225 | // This is just to give the client a reasonable chance of | 225 | // This is just to give the client a reasonable chance of |
226 | // flushing out all it's packets. There should probably | 226 | // flushing out all it's packets. There should probably |
227 | // be a better mechanism here | 227 | // be a better mechanism here |
228 | |||
229 | // We can't reach into other scenes and close the connection | ||
230 | // We need to do this over grid communications | ||
231 | m_scene.CloseAllAgents(CircuitCode); | ||
228 | 232 | ||
229 | m_clientThread.Abort(); | 233 | m_clientThread.Abort(); |
230 | } | 234 | } |
diff --git a/OpenSim/Region/ClientStack/PacketServer.cs b/OpenSim/Region/ClientStack/PacketServer.cs index 39c3d32..308728e 100644 --- a/OpenSim/Region/ClientStack/PacketServer.cs +++ b/OpenSim/Region/ClientStack/PacketServer.cs | |||
@@ -123,13 +123,16 @@ namespace OpenSim.Region.ClientStack | |||
123 | /// <param name="circuitcode"></param> | 123 | /// <param name="circuitcode"></param> |
124 | public virtual void CloseCircuit(uint circuitcode) | 124 | public virtual void CloseCircuit(uint circuitcode) |
125 | { | 125 | { |
126 | OpenSim.Framework.Console.MainLog.Instance.Debug("PACKETSERVER", "Removing Circuit Code"); | ||
126 | m_networkHandler.RemoveClientCircuit(circuitcode); | 127 | m_networkHandler.RemoveClientCircuit(circuitcode); |
127 | m_scene.ClientManager.CloseAllAgents(circuitcode); | 128 | OpenSim.Framework.Console.MainLog.Instance.Debug("PACKETSERVER", "Removed Circuit Code"); |
129 | //m_scene.ClientManager.CloseAllAgents(circuitcode); | ||
128 | } | 130 | } |
129 | 131 | ||
130 | public virtual void CloseClient(IClientAPI client) | 132 | public virtual void CloseClient(IClientAPI client) |
131 | { | 133 | { |
132 | CloseCircuit(client.CircuitCode); | 134 | CloseCircuit(client.CircuitCode); |
135 | client.Close(); | ||
133 | } | 136 | } |
134 | } | 137 | } |
135 | } | 138 | } |
diff --git a/OpenSim/Region/ClientStack/UDPServer.cs b/OpenSim/Region/ClientStack/UDPServer.cs index 55ef4a4..2b2269e 100644 --- a/OpenSim/Region/ClientStack/UDPServer.cs +++ b/OpenSim/Region/ClientStack/UDPServer.cs | |||
@@ -119,16 +119,48 @@ namespace OpenSim.Region.ClientStack | |||
119 | { | 119 | { |
120 | case SocketError.AlreadyInProgress: | 120 | case SocketError.AlreadyInProgress: |
121 | case SocketError.NetworkReset: | 121 | case SocketError.NetworkReset: |
122 | case SocketError.ConnectionReset: | ||
123 | try | ||
124 | { | ||
125 | CloseEndPoint(epSender); | ||
126 | } | ||
127 | catch (System.Exception a) | ||
128 | { | ||
129 | MainLog.Instance.Verbose("UDPSERVER", a.ToString()); | ||
130 | } | ||
131 | try | ||
132 | { | ||
133 | Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); | ||
134 | |||
135 | // Ter: For some stupid reason ConnectionReset basically kills our async event structure.. | ||
136 | // so therefore.. we've got to tell the server to BeginReceiveFrom again. | ||
137 | // This will happen over and over until we've gone through all packets | ||
138 | // sent to and from this particular user. | ||
139 | // Stupid I know.. | ||
140 | // but Flusing the buffer would be even more stupid... so, we're stuck with this ugly method. | ||
141 | |||
142 | } | ||
143 | catch (SocketException) | ||
144 | { | ||
145 | |||
146 | } | ||
147 | break; | ||
122 | default: | 148 | default: |
123 | Console.WriteLine("Remote host Closed connection"); | 149 | // Here's some reference code! :D |
124 | CloseEndPoint(epSender); | 150 | // Shutdown and restart the UDP listener! hehe |
151 | // Shiny | ||
152 | |||
153 | //Server.Shutdown(SocketShutdown.Both); | ||
154 | //CloseEndPoint(epSender); | ||
155 | //ServerListener(); | ||
125 | break; | 156 | break; |
126 | } | 157 | } |
127 | 158 | ||
128 | return; | 159 | return; |
129 | } | 160 | } |
130 | catch (System.ObjectDisposedException) | 161 | catch (System.ObjectDisposedException e) |
131 | { | 162 | { |
163 | MainLog.Instance.Debug("UDPSERVER", e.ToString()); | ||
132 | return; | 164 | return; |
133 | } | 165 | } |
134 | 166 | ||
@@ -138,8 +170,9 @@ namespace OpenSim.Region.ClientStack | |||
138 | { | 170 | { |
139 | packet = Packet.BuildPacket(RecvBuffer, ref packetEnd, ZeroBuffer); | 171 | packet = Packet.BuildPacket(RecvBuffer, ref packetEnd, ZeroBuffer); |
140 | } | 172 | } |
141 | catch(Exception) | 173 | catch(Exception e) |
142 | { | 174 | { |
175 | MainLog.Instance.Debug("UDPSERVER", e.ToString()); | ||
143 | } | 176 | } |
144 | 177 | ||
145 | // do we already have a circuit for this endpoint | 178 | // do we already have a circuit for this endpoint |
@@ -147,18 +180,21 @@ namespace OpenSim.Region.ClientStack | |||
147 | if (clientCircuits.TryGetValue(epSender, out circuit)) | 180 | if (clientCircuits.TryGetValue(epSender, out circuit)) |
148 | { | 181 | { |
149 | //if so then send packet to the packetserver | 182 | //if so then send packet to the packetserver |
183 | //MainLog.Instance.Warn("UDPSERVER", "ALREADY HAVE Circuit!"); | ||
150 | m_packetServer.InPacket(circuit, packet); | 184 | m_packetServer.InPacket(circuit, packet); |
151 | } | 185 | } |
152 | else if (packet.Type == PacketType.UseCircuitCode) | 186 | else if (packet.Type == PacketType.UseCircuitCode) |
153 | { | 187 | { |
154 | // new client | 188 | // new client |
189 | MainLog.Instance.Debug("UDPSERVER", "Adding New Client"); | ||
155 | AddNewClient(packet); | 190 | AddNewClient(packet); |
156 | } | 191 | } |
157 | else | 192 | else |
158 | { | 193 | { |
194 | |||
159 | // invalid client | 195 | // invalid client |
160 | //CFK: This message seems to have served its usefullness as of 12-15 so I am commenting it out for now | 196 | //CFK: This message seems to have served its usefullness as of 12-15 so I am commenting it out for now |
161 | //CFK: m_log.Warn("client", "Got a packet from an invalid client - " + epSender.ToString()); | 197 | //m_log.Warn("client", "Got a packet from an invalid client - " + epSender.ToString()); |
162 | } | 198 | } |
163 | 199 | ||
164 | Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); | 200 | Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); |
@@ -169,7 +205,9 @@ namespace OpenSim.Region.ClientStack | |||
169 | uint circuit; | 205 | uint circuit; |
170 | if (clientCircuits.TryGetValue(sender, out circuit)) | 206 | if (clientCircuits.TryGetValue(sender, out circuit)) |
171 | { | 207 | { |
208 | MainLog.Instance.Debug("UDPSERVER", "CloseEndPoint:ClosingCircuit"); | ||
172 | m_packetServer.CloseCircuit(circuit); | 209 | m_packetServer.CloseCircuit(circuit); |
210 | MainLog.Instance.Debug("UDPSERVER", "CloseEndPoint:ClosedCircuit"); | ||
173 | } | 211 | } |
174 | } | 212 | } |
175 | 213 | ||
@@ -222,8 +260,13 @@ namespace OpenSim.Region.ClientStack | |||
222 | EndPoint sendto = null; | 260 | EndPoint sendto = null; |
223 | if (clientCircuits_reverse.TryGetValue(circuitcode, out sendto)) | 261 | if (clientCircuits_reverse.TryGetValue(circuitcode, out sendto)) |
224 | { | 262 | { |
263 | MainLog.Instance.Debug("UDPSERVER", "RemovingClientCircuit"); | ||
225 | clientCircuits.Remove(sendto); | 264 | clientCircuits.Remove(sendto); |
265 | MainLog.Instance.Debug("UDPSERVER", "Removed Client Circuit"); | ||
266 | |||
267 | MainLog.Instance.Debug("UDPSERVER", "Removing Reverse ClientCircuit"); | ||
226 | clientCircuits_reverse.Remove(circuitcode); | 268 | clientCircuits_reverse.Remove(circuitcode); |
269 | MainLog.Instance.Debug("UDPSERVER", "Removed Reverse ClientCircuit"); | ||
227 | } | 270 | } |
228 | } | 271 | } |
229 | } | 272 | } |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 1145b00..bfdf517 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -1243,7 +1243,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
1243 | // Remove client agent from profile, so new logins will work | 1243 | // Remove client agent from profile, so new logins will work |
1244 | CommsManager.UserService.clearUserAgent(agentID); | 1244 | CommsManager.UserService.clearUserAgent(agentID); |
1245 | } | 1245 | } |
1246 | public override void CloseAllAgents(uint circuitcode) | ||
1247 | { | ||
1248 | // Called by ClientView to kill all circuit codes | ||
1249 | ClientManager.CloseAllAgents(circuitcode); | ||
1246 | 1250 | ||
1251 | } | ||
1247 | public void NotifyMyCoarseLocationChange() | 1252 | public void NotifyMyCoarseLocationChange() |
1248 | { | 1253 | { |
1249 | ForEachScenePresence(delegate(ScenePresence presence) { presence.CoarseLocationChange(); }); | 1254 | ForEachScenePresence(delegate(ScenePresence presence) { presence.CoarseLocationChange(); }); |
diff --git a/OpenSim/Region/Environment/Scenes/SceneBase.cs b/OpenSim/Region/Environment/Scenes/SceneBase.cs index 75118e2..35d88eb 100644 --- a/OpenSim/Region/Environment/Scenes/SceneBase.cs +++ b/OpenSim/Region/Environment/Scenes/SceneBase.cs | |||
@@ -130,6 +130,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
130 | /// <param name="agentID"></param> | 130 | /// <param name="agentID"></param> |
131 | public abstract void RemoveClient(LLUUID agentID); | 131 | public abstract void RemoveClient(LLUUID agentID); |
132 | 132 | ||
133 | public abstract void CloseAllAgents(uint circuitcode); | ||
134 | |||
133 | #endregion | 135 | #endregion |
134 | 136 | ||
135 | /// <summary> | 137 | /// <summary> |