aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authorroot2019-03-11 23:41:26 +0000
committerroot2019-03-11 23:41:26 +0000
commitc7a02dc058018429fca8fb0c979785be34bebaf6 (patch)
treea364249657222c201c9880ec355dafbcb7f99d9a /OpenSim/Framework
parentShould have been in the last commit (diff)
parenterrr use invariantculture compare not current (diff)
downloadopensim-SC-c7a02dc058018429fca8fb0c979785be34bebaf6.zip
opensim-SC-c7a02dc058018429fca8fb0c979785be34bebaf6.tar.gz
opensim-SC-c7a02dc058018429fca8fb0c979785be34bebaf6.tar.bz2
opensim-SC-c7a02dc058018429fca8fb0c979785be34bebaf6.tar.xz
Merge branch 'master' of brain.opensimulator.org:/var/git/opensim
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/ClientManager.cs65
-rw-r--r--OpenSim/Framework/IClientAPI.cs3
-rwxr-xr-x[-rw-r--r--]OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs32
-rw-r--r--OpenSim/Framework/TerrainData.cs1
-rw-r--r--OpenSim/Framework/Util.cs28
5 files changed, 62 insertions, 67 deletions
diff --git a/OpenSim/Framework/ClientManager.cs b/OpenSim/Framework/ClientManager.cs
index 45c54e4..1508c7f 100644
--- a/OpenSim/Framework/ClientManager.cs
+++ b/OpenSim/Framework/ClientManager.cs
@@ -51,7 +51,14 @@ namespace OpenSim.Framework
51 private object m_syncRoot = new object(); 51 private object m_syncRoot = new object();
52 52
53 /// <summary>Number of clients in the collection</summary> 53 /// <summary>Number of clients in the collection</summary>
54 public int Count { get { return m_dict1.Count; } } 54 public int Count
55 {
56 get
57 {
58 lock (m_syncRoot)
59 return m_dict1.Count;
60 }
61 }
55 62
56 /// <summary> 63 /// <summary>
57 /// Default constructor 64 /// Default constructor
@@ -60,7 +67,7 @@ namespace OpenSim.Framework
60 { 67 {
61 m_dict1 = new Dictionary<UUID, IClientAPI>(); 68 m_dict1 = new Dictionary<UUID, IClientAPI>();
62 m_dict2 = new Dictionary<IPEndPoint, IClientAPI>(); 69 m_dict2 = new Dictionary<IPEndPoint, IClientAPI>();
63 m_array = new IClientAPI[0]; 70 m_array = null;
64 } 71 }
65 72
66 /// <summary> 73 /// <summary>
@@ -74,17 +81,9 @@ namespace OpenSim.Framework
74 { 81 {
75 lock (m_syncRoot) 82 lock (m_syncRoot)
76 { 83 {
77 // allow self healing
78// if (m_dict1.ContainsKey(value.AgentId) || m_dict2.ContainsKey(value.RemoteEndPoint))
79// return false;
80
81 m_dict1[value.AgentId] = value; 84 m_dict1[value.AgentId] = value;
82 m_dict2[value.RemoteEndPoint] = value; 85 m_dict2[value.RemoteEndPoint] = value;
83 86 m_array = null;
84 // dict1 is the master
85 IClientAPI[] newArray = new IClientAPI[m_dict1.Count];
86 m_dict1.Values.CopyTo(newArray, 0);
87 m_array = newArray;
88 } 87 }
89 88
90 return true; 89 return true;
@@ -105,10 +104,7 @@ namespace OpenSim.Framework
105 { 104 {
106 m_dict1.Remove(key); 105 m_dict1.Remove(key);
107 m_dict2.Remove(value.RemoteEndPoint); 106 m_dict2.Remove(value.RemoteEndPoint);
108 107 m_array = null;
109 IClientAPI[] newArray = new IClientAPI[m_dict1.Count];
110 m_dict1.Values.CopyTo(newArray, 0);
111 m_array = newArray;
112 return true; 108 return true;
113 } 109 }
114 } 110 }
@@ -124,7 +120,7 @@ namespace OpenSim.Framework
124 { 120 {
125 m_dict1.Clear(); 121 m_dict1.Clear();
126 m_dict2.Clear(); 122 m_dict2.Clear();
127 m_array = new IClientAPI[0]; 123 m_array = null;
128 } 124 }
129 } 125 }
130 126
@@ -135,7 +131,8 @@ namespace OpenSim.Framework
135 /// <returns>True if the UUID was found in the collection, otherwise false</returns> 131 /// <returns>True if the UUID was found in the collection, otherwise false</returns>
136 public bool ContainsKey(UUID key) 132 public bool ContainsKey(UUID key)
137 { 133 {
138 return m_dict1.ContainsKey(key); 134 lock (m_syncRoot)
135 return m_dict1.ContainsKey(key);
139 } 136 }
140 137
141 /// <summary> 138 /// <summary>
@@ -145,7 +142,8 @@ namespace OpenSim.Framework
145 /// <returns>True if the endpoint was found in the collection, otherwise false</returns> 142 /// <returns>True if the endpoint was found in the collection, otherwise false</returns>
146 public bool ContainsKey(IPEndPoint key) 143 public bool ContainsKey(IPEndPoint key)
147 { 144 {
148 return m_dict2.ContainsKey(key); 145 lock (m_syncRoot)
146 return m_dict2.ContainsKey(key);
149 } 147 }
150 148
151 /// <summary> 149 /// <summary>
@@ -156,8 +154,12 @@ namespace OpenSim.Framework
156 /// <returns>True if the lookup succeeded, otherwise false</returns> 154 /// <returns>True if the lookup succeeded, otherwise false</returns>
157 public bool TryGetValue(UUID key, out IClientAPI value) 155 public bool TryGetValue(UUID key, out IClientAPI value)
158 { 156 {
159 try { return m_dict1.TryGetValue(key, out value); } 157 try
160 catch (Exception) 158 {
159 lock (m_syncRoot)
160 return m_dict1.TryGetValue(key, out value);
161 }
162 catch
161 { 163 {
162 value = null; 164 value = null;
163 return false; 165 return false;
@@ -172,8 +174,12 @@ namespace OpenSim.Framework
172 /// <returns>True if the lookup succeeded, otherwise false</returns> 174 /// <returns>True if the lookup succeeded, otherwise false</returns>
173 public bool TryGetValue(IPEndPoint key, out IClientAPI value) 175 public bool TryGetValue(IPEndPoint key, out IClientAPI value)
174 { 176 {
175 try { return m_dict2.TryGetValue(key, out value); } 177 try
176 catch (Exception) 178 {
179 lock (m_syncRoot)
180 return m_dict2.TryGetValue(key, out value);
181 }
182 catch
177 { 183 {
178 value = null; 184 value = null;
179 return false; 185 return false;
@@ -187,7 +193,20 @@ namespace OpenSim.Framework
187 /// <param name="action">Action to perform on each element</param> 193 /// <param name="action">Action to perform on each element</param>
188 public void ForEach(Action<IClientAPI> action) 194 public void ForEach(Action<IClientAPI> action)
189 { 195 {
190 IClientAPI[] localArray = m_array; 196 IClientAPI[] localArray;
197 lock (m_syncRoot)
198 {
199 if (m_array == null)
200 {
201 if (m_dict1.Count == 0)
202 return;
203
204 m_array = new IClientAPI[m_dict1.Count];
205 m_dict1.Values.CopyTo(m_array, 0);
206 }
207 localArray = m_array;
208 }
209
191 for (int i = 0; i < localArray.Length; i++) 210 for (int i = 0; i < localArray.Length; i++)
192 action(localArray[i]); 211 action(localArray[i]);
193 } 212 }
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index 307dbf3..d63136e 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -390,7 +390,7 @@ namespace OpenSim.Framework
390 IClientAPI remoteClient, UUID invoice, UUID senderID, bool scripted, bool collisionEvents, bool physics); 390 IClientAPI remoteClient, UUID invoice, UUID senderID, bool scripted, bool collisionEvents, bool physics);
391 391
392 public delegate void EstateTeleportOneUserHomeRequest( 392 public delegate void EstateTeleportOneUserHomeRequest(
393 IClientAPI remoteClient, UUID invoice, UUID senderID, UUID prey); 393 IClientAPI remoteClient, UUID invoice, UUID senderID, UUID prey, bool kill);
394 394
395 public delegate void EstateTeleportAllUsersHomeRequest(IClientAPI remoteClient, UUID invoice, UUID senderID); 395 public delegate void EstateTeleportAllUsersHomeRequest(IClientAPI remoteClient, UUID invoice, UUID senderID);
396 396
@@ -671,7 +671,6 @@ namespace OpenSim.Framework
671 Particles = 1 << 19, 671 Particles = 1 << 19,
672 ExtraData = 1 << 20, 672 ExtraData = 1 << 20,
673 Sound = 1 << 21, 673 Sound = 1 << 21,
674 Joint = 1 << 22,
675 674
676 TerseUpdate = Position | Rotation | Velocity | Acceleration | AngularVelocity, 675 TerseUpdate = Position | Rotation | Velocity | Acceleration | AngularVelocity,
677 FullUpdate = 0x00ffffff, 676 FullUpdate = 0x00ffffff,
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
index b9ac155..14e21a2 100644..100755
--- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
+++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
@@ -230,25 +230,25 @@ namespace OpenSim.Framework.Servers.HttpServer
230 PollServiceHttpRequest req; 230 PollServiceHttpRequest req;
231 while (m_running) 231 while (m_running)
232 { 232 {
233 req = null; 233 try
234 if(!m_requests.TryTake(out req, 4500) || req == null)
235 { 234 {
236 Watchdog.UpdateThread(); 235 req = null;
237 continue; 236 if (!m_requests.TryTake(out req, 4500) || req == null)
238 } 237 {
238 Watchdog.UpdateThread();
239 continue;
240 }
239 241
240 Watchdog.UpdateThread(); 242 Watchdog.UpdateThread();
241 243
242 try 244 if (!req.HttpContext.CanSend())
243 {
244 if(!req.HttpContext.CanSend())
245 { 245 {
246 req.PollServiceArgs.Drop(req.RequestID, req.PollServiceArgs.Id); 246 req.PollServiceArgs.Drop(req.RequestID, req.PollServiceArgs.Id);
247 byContextDequeue(req); 247 byContextDequeue(req);
248 continue; 248 continue;
249 } 249 }
250 250
251 if(req.HttpContext.IsSending()) 251 if (req.HttpContext.IsSending())
252 { 252 {
253 if ((Environment.TickCount - req.RequestTime) > req.PollServiceArgs.TimeOutms) 253 if ((Environment.TickCount - req.RequestTime) > req.PollServiceArgs.TimeOutms)
254 { 254 {
@@ -256,7 +256,7 @@ namespace OpenSim.Framework.Servers.HttpServer
256 byContextDequeue(req); 256 byContextDequeue(req);
257 } 257 }
258 else 258 else
259 ReQueueEvent(req); 259 ReQueueEvent(req);
260 continue; 260 continue;
261 } 261 }
262 262
@@ -290,7 +290,7 @@ namespace OpenSim.Framework.Servers.HttpServer
290 { 290 {
291 nreq.DoHTTPGruntWork(nreq.PollServiceArgs.NoEvents(nreq.RequestID, nreq.PollServiceArgs.Id)); 291 nreq.DoHTTPGruntWork(nreq.PollServiceArgs.NoEvents(nreq.RequestID, nreq.PollServiceArgs.Id));
292 } 292 }
293 catch (ObjectDisposedException) {} 293 catch (ObjectDisposedException) { }
294 finally 294 finally
295 { 295 {
296 byContextDequeue(nreq); 296 byContextDequeue(nreq);
@@ -305,6 +305,12 @@ namespace OpenSim.Framework.Servers.HttpServer
305 } 305 }
306 } 306 }
307 } 307 }
308 catch (ThreadAbortException)
309 {
310 Thread.ResetAbort();
311 // Shouldn't set this to 'false', the normal shutdown should cause things to exit
312 // m_running = false;
313 }
308 catch (Exception e) 314 catch (Exception e)
309 { 315 {
310 m_log.ErrorFormat("Exception in poll service thread: " + e.ToString()); 316 m_log.ErrorFormat("Exception in poll service thread: " + e.ToString());
diff --git a/OpenSim/Framework/TerrainData.cs b/OpenSim/Framework/TerrainData.cs
index 5604628..1a2d5d1 100644
--- a/OpenSim/Framework/TerrainData.cs
+++ b/OpenSim/Framework/TerrainData.cs
@@ -212,7 +212,6 @@ namespace OpenSim.Framework
212 return heights; 212 return heights;
213 } 213 }
214 214
215 // TerrainData.GetDoubles
216 public double[,] GetDoubles() 215 public double[,] GetDoubles()
217 { 216 {
218 double[,] ret = new double[SizeX, SizeY]; 217 double[,] ret = new double[SizeX, SizeY];
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 52f9aea..f66a987 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -2437,34 +2437,6 @@ namespace OpenSim.Framework
2437 2437
2438 #region FireAndForget Threading Pattern 2438 #region FireAndForget Threading Pattern
2439 2439
2440 /// <summary>
2441 /// Created to work around a limitation in Mono with nested delegates
2442 /// </summary>
2443 private sealed class FireAndForgetWrapper
2444 {
2445 private static object syncRoot = new Object();
2446
2447 public void FireAndForget(System.Threading.WaitCallback callback)
2448 {
2449 callback.BeginInvoke(null, EndFireAndForget, callback);
2450 }
2451
2452 public void FireAndForget(System.Threading.WaitCallback callback, object obj)
2453 {
2454 callback.BeginInvoke(obj, EndFireAndForget, callback);
2455 }
2456
2457 private static void EndFireAndForget(IAsyncResult ar)
2458 {
2459 System.Threading.WaitCallback callback = (System.Threading.WaitCallback)ar.AsyncState;
2460
2461 try { callback.EndInvoke(ar); }
2462 catch (Exception ex) { m_log.Error("[UTIL]: Asynchronous method threw an exception: " + ex.Message, ex); }
2463
2464 ar.AsyncWaitHandle.Close();
2465 }
2466 }
2467
2468 public static void InitThreadPool(int minThreads, int maxThreads) 2440 public static void InitThreadPool(int minThreads, int maxThreads)
2469 { 2441 {
2470 if (maxThreads < 2) 2442 if (maxThreads < 2)