diff options
Diffstat (limited to 'OpenSim/Region/ClientStack')
-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 |
3 files changed, 58 insertions, 8 deletions
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 | } |