aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ClientStack')
-rw-r--r--OpenSim/Region/ClientStack/UDPServer.cs22
1 files changed, 7 insertions, 15 deletions
diff --git a/OpenSim/Region/ClientStack/UDPServer.cs b/OpenSim/Region/ClientStack/UDPServer.cs
index 2190fbf..55ef4a4 100644
--- a/OpenSim/Region/ClientStack/UDPServer.cs
+++ b/OpenSim/Region/ClientStack/UDPServer.cs
@@ -39,6 +39,7 @@ namespace OpenSim.Region.ClientStack
39 public class UDPServer : ClientStackNetworkHandler 39 public class UDPServer : ClientStackNetworkHandler
40 { 40 {
41 protected Dictionary<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>(); 41 protected Dictionary<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>();
42 protected Dictionary<uint, EndPoint> clientCircuits_reverse = new Dictionary<uint, EndPoint>();
42 public Socket Server; 43 public Socket Server;
43 protected IPEndPoint ServerIncoming; 44 protected IPEndPoint ServerIncoming;
44 protected byte[] RecvBuffer = new byte[4096]; 45 protected byte[] RecvBuffer = new byte[4096];
@@ -176,6 +177,7 @@ namespace OpenSim.Region.ClientStack
176 { 177 {
177 UseCircuitCodePacket useCircuit = (UseCircuitCodePacket) packet; 178 UseCircuitCodePacket useCircuit = (UseCircuitCodePacket) packet;
178 clientCircuits.Add(epSender, useCircuit.CircuitCode.Code); 179 clientCircuits.Add(epSender, useCircuit.CircuitCode.Code);
180 clientCircuits_reverse.Add(useCircuit.CircuitCode.Code, epSender);
179 181
180 PacketServer.AddNewClient(epSender, useCircuit, m_assetCache, m_authenticateSessionsClass); 182 PacketServer.AddNewClient(epSender, useCircuit, m_assetCache, m_authenticateSessionsClass);
181 } 183 }
@@ -208,15 +210,7 @@ namespace OpenSim.Region.ClientStack
208 { 210 {
209 // find the endpoint for this circuit 211 // find the endpoint for this circuit
210 EndPoint sendto = null; 212 EndPoint sendto = null;
211 foreach (KeyValuePair<EndPoint, uint> p in clientCircuits) 213 if (clientCircuits_reverse.TryGetValue(circuitcode, out sendto))
212 {
213 if (p.Value == circuitcode)
214 {
215 sendto = p.Key;
216 break;
217 }
218 }
219 if (sendto != null)
220 { 214 {
221 //we found the endpoint so send the packet to it 215 //we found the endpoint so send the packet to it
222 Server.SendTo(buffer, size, flags, sendto); 216 Server.SendTo(buffer, size, flags, sendto);
@@ -225,13 +219,11 @@ namespace OpenSim.Region.ClientStack
225 219
226 public virtual void RemoveClientCircuit(uint circuitcode) 220 public virtual void RemoveClientCircuit(uint circuitcode)
227 { 221 {
228 foreach (KeyValuePair<EndPoint, uint> p in clientCircuits) 222 EndPoint sendto = null;
223 if (clientCircuits_reverse.TryGetValue(circuitcode, out sendto))
229 { 224 {
230 if (p.Value == circuitcode) 225 clientCircuits.Remove(sendto);
231 { 226 clientCircuits_reverse.Remove(circuitcode);
232 clientCircuits.Remove(p.Key);
233 break;
234 }
235 } 227 }
236 } 228 }
237 } 229 }