aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorTeravus Ovares2008-02-18 21:24:34 +0000
committerTeravus Ovares2008-02-18 21:24:34 +0000
commitd0b218f667bfd796257634e3b352ca195d7d02b2 (patch)
treecc00f8b96f57176fa4e1f3a559d73a272dd0d57d /OpenSim/Region
parent* Probably fixed the corner freeze bug. On uninitialized avatar, ODEPlugin ... (diff)
downloadopensim-SC_OLD-d0b218f667bfd796257634e3b352ca195d7d02b2.zip
opensim-SC_OLD-d0b218f667bfd796257634e3b352ca195d7d02b2.tar.gz
opensim-SC_OLD-d0b218f667bfd796257634e3b352ca195d7d02b2.tar.bz2
opensim-SC_OLD-d0b218f667bfd796257634e3b352ca195d7d02b2.tar.xz
Committing ahzz's patch #619 - Description:
Patch provided by Openlifegrid.com Adds locks around clientCircuits and clientCircuits_reverse Adds existance check on adding to clientCircuits for clients resending UseCircuit packet. Adds locks around Clientmanager.m_clients for add/remove/tryGet calls
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/UDPServer.cs34
1 files changed, 24 insertions, 10 deletions
diff --git a/OpenSim/Region/ClientStack/UDPServer.cs b/OpenSim/Region/ClientStack/UDPServer.cs
index 7b32490..1997453 100644
--- a/OpenSim/Region/ClientStack/UDPServer.cs
+++ b/OpenSim/Region/ClientStack/UDPServer.cs
@@ -311,9 +311,12 @@ namespace OpenSim.Region.ClientStack
311 private void CloseEndPoint(EndPoint sender) 311 private void CloseEndPoint(EndPoint sender)
312 { 312 {
313 uint circuit; 313 uint circuit;
314 if (clientCircuits.TryGetValue(sender, out circuit)) 314 lock (clientCircuits)
315 { 315 {
316 m_packetServer.CloseCircuit(circuit); 316 if (clientCircuits.TryGetValue(sender, out circuit))
317 {
318 m_packetServer.CloseCircuit(circuit);
319 }
317 } 320 }
318 } 321 }
319 322
@@ -322,12 +325,17 @@ namespace OpenSim.Region.ClientStack
322 UseCircuitCodePacket useCircuit = (UseCircuitCodePacket) packet; 325 UseCircuitCodePacket useCircuit = (UseCircuitCodePacket) packet;
323 lock (clientCircuits) 326 lock (clientCircuits)
324 { 327 {
325 clientCircuits.Add(epSender, useCircuit.CircuitCode.Code); 328 if (!clientCircuits.ContainsKey(epSender))
329 clientCircuits.Add(epSender, useCircuit.CircuitCode.Code);
330 else
331 m_log.Error("[UDPSERVER]: clientCircuits already contans entry for user " + useCircuit.CircuitCode.Code.ToString() + ". NOT adding.");
326 } 332 }
327 lock (clientCircuits_reverse) 333 lock (clientCircuits_reverse)
328 { 334 {
329 if (!clientCircuits_reverse.ContainsKey(useCircuit.CircuitCode.Code)) 335 if (!clientCircuits_reverse.ContainsKey(useCircuit.CircuitCode.Code))
330 clientCircuits_reverse.Add(useCircuit.CircuitCode.Code, epSender); 336 clientCircuits_reverse.Add(useCircuit.CircuitCode.Code, epSender);
337 else
338 m_log.Error("[UDPSERVER]: clientCurcuits_reverse already contains entry for user " + useCircuit.CircuitCode.Code.ToString() + ". NOT adding.");
331 } 339 }
332 340
333 PacketServer.AddNewClient(epSender, useCircuit, m_assetCache, m_authenticateSessionsClass); 341 PacketServer.AddNewClient(epSender, useCircuit, m_assetCache, m_authenticateSessionsClass);
@@ -380,22 +388,28 @@ namespace OpenSim.Region.ClientStack
380 { 388 {
381 // find the endpoint for this circuit 389 // find the endpoint for this circuit
382 EndPoint sendto = null; 390 EndPoint sendto = null;
383 if (clientCircuits_reverse.TryGetValue(circuitcode, out sendto)) 391 lock (clientCircuits_reverse)
384 { 392 {
385 //we found the endpoint so send the packet to it 393 if (clientCircuits_reverse.TryGetValue(circuitcode, out sendto))
386 Server.SendTo(buffer, size, flags, sendto); 394 {
395 //we found the endpoint so send the packet to it
396 Server.SendTo(buffer, size, flags, sendto);
397 }
387 } 398 }
388 } 399 }
389 400
390 public virtual void RemoveClientCircuit(uint circuitcode) 401 public virtual void RemoveClientCircuit(uint circuitcode)
391 { 402 {
392 EndPoint sendto = null; 403 EndPoint sendto = null;
393 if (clientCircuits_reverse.TryGetValue(circuitcode, out sendto)) 404 lock (clientCircuits_reverse)
394 { 405 {
395 clientCircuits.Remove(sendto); 406 if (clientCircuits_reverse.TryGetValue(circuitcode, out sendto))
407 {
408 clientCircuits.Remove(sendto);
396 409
397 410
398 clientCircuits_reverse.Remove(circuitcode); 411 clientCircuits_reverse.Remove(circuitcode);
412 }
399 } 413 }
400 } 414 }
401 } 415 }