aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
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/Framework
parent* Probably fixed the corner freeze bug. On uninitialized avatar, ODEPlugin ... (diff)
downloadopensim-SC-d0b218f667bfd796257634e3b352ca195d7d02b2.zip
opensim-SC-d0b218f667bfd796257634e3b352ca195d7d02b2.tar.gz
opensim-SC-d0b218f667bfd796257634e3b352ca195d7d02b2.tar.bz2
opensim-SC-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/Framework')
-rw-r--r--OpenSim/Framework/ClientManager.cs33
1 files changed, 24 insertions, 9 deletions
diff --git a/OpenSim/Framework/ClientManager.cs b/OpenSim/Framework/ClientManager.cs
index 51ebc9b..3df883d 100644
--- a/OpenSim/Framework/ClientManager.cs
+++ b/OpenSim/Framework/ClientManager.cs
@@ -72,20 +72,28 @@ namespace OpenSim.Framework
72 public void Remove(uint id) 72 public void Remove(uint id)
73 { 73 {
74 //m_log.InfoFormat("[CLIENT]: Removing client with code {0}, current count {1}", id, m_clients.Count); 74 //m_log.InfoFormat("[CLIENT]: Removing client with code {0}, current count {1}", id, m_clients.Count);
75 m_clients.Remove(id); 75 lock (m_clients)
76 {
77 m_clients.Remove(id);
78 }
76 m_log.InfoFormat("[CLIENT]: Removed client with code {0}, new client count {1}", id, m_clients.Count); 79 m_log.InfoFormat("[CLIENT]: Removed client with code {0}, new client count {1}", id, m_clients.Count);
77 } 80 }
78 81
79 public void Add(uint id, IClientAPI client) 82 public void Add(uint id, IClientAPI client)
80 { 83 {
81 m_clients.Add(id, client); 84 lock (m_clients)
85 {
86 m_clients.Add(id, client);
87 }
82 } 88 }
83 89
84 public void InPacket(uint circuitCode, Packet packet) 90 public void InPacket(uint circuitCode, Packet packet)
85 { 91 {
86 IClientAPI client; 92 IClientAPI client;
87 93 bool tryGetRet = false;
88 if (m_clients.TryGetValue(circuitCode, out client)) 94 lock (m_clients)
95 tryGetRet = m_clients.TryGetValue(circuitCode, out client);
96 if(tryGetRet)
89 { 97 {
90 client.InPacket(packet); 98 client.InPacket(packet);
91 } 99 }
@@ -94,8 +102,10 @@ namespace OpenSim.Framework
94 public void CloseAllAgents(uint circuitCode) 102 public void CloseAllAgents(uint circuitCode)
95 { 103 {
96 IClientAPI client; 104 IClientAPI client;
97 105 bool tryGetRet = false;
98 if (m_clients.TryGetValue(circuitCode, out client)) 106 lock (m_clients)
107 tryGetRet = m_clients.TryGetValue(circuitCode, out client);
108 if (tryGetRet)
99 { 109 {
100 CloseAllCircuits(client.AgentId); 110 CloseAllCircuits(client.AgentId);
101 } 111 }
@@ -111,8 +121,10 @@ namespace OpenSim.Framework
111 IClientAPI client; 121 IClientAPI client;
112 try 122 try
113 { 123 {
114 124 bool tryGetRet = false;
115 if (m_clients.TryGetValue(circuits[i], out client)) 125 lock (m_clients)
126 tryGetRet = m_clients.TryGetValue(circuits[i], out client);
127 if(tryGetRet)
116 { 128 {
117 Remove(client.CircuitCode); 129 Remove(client.CircuitCode);
118 client.Close(false); 130 client.Close(false);
@@ -176,7 +188,10 @@ namespace OpenSim.Framework
176 188
177 public bool TryGetClient(uint circuitId, out IClientAPI user) 189 public bool TryGetClient(uint circuitId, out IClientAPI user)
178 { 190 {
179 return m_clients.TryGetValue(circuitId, out user); 191 lock (m_clients)
192 {
193 return m_clients.TryGetValue(circuitId, out user);
194 }
180 } 195 }
181 } 196 }
182} 197}