diff options
Diffstat (limited to 'OpenSim')
13 files changed, 261 insertions, 49 deletions
diff --git a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs index c275d87..6437d0b 100644 --- a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs +++ b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs | |||
@@ -68,7 +68,7 @@ namespace OpenSim.Capabilities.Handlers | |||
68 | ret["content_type"] = "text/plain"; | 68 | ret["content_type"] = "text/plain"; |
69 | ret["keepalive"] = false; | 69 | ret["keepalive"] = false; |
70 | ret["reusecontext"] = false; | 70 | ret["reusecontext"] = false; |
71 | 71 | ret["int_bytes"] = 0; | |
72 | string textureStr = (string)request["texture_id"]; | 72 | string textureStr = (string)request["texture_id"]; |
73 | string format = (string)request["format"]; | 73 | string format = (string)request["format"]; |
74 | 74 | ||
@@ -237,6 +237,7 @@ namespace OpenSim.Capabilities.Handlers | |||
237 | { | 237 | { |
238 | response["int_response_code"] = (int)System.Net.HttpStatusCode.OK; | 238 | response["int_response_code"] = (int)System.Net.HttpStatusCode.OK; |
239 | response["bin_response_data"] = texture.Data; | 239 | response["bin_response_data"] = texture.Data; |
240 | response["int_bytes"] = texture.Data.Length; | ||
240 | } | 241 | } |
241 | else | 242 | else |
242 | { | 243 | { |
@@ -246,6 +247,7 @@ namespace OpenSim.Capabilities.Handlers | |||
246 | byte[] d = new byte[len]; | 247 | byte[] d = new byte[len]; |
247 | Array.Copy(texture.Data, start, d, 0, len); | 248 | Array.Copy(texture.Data, start, d, 0, len); |
248 | response["bin_response_data"] = d; | 249 | response["bin_response_data"] = d; |
250 | response["int_bytes"] = len; | ||
249 | } | 251 | } |
250 | // response.Body.Write(texture.Data, start, len); | 252 | // response.Body.Write(texture.Data, start, len); |
251 | } | 253 | } |
@@ -266,6 +268,8 @@ namespace OpenSim.Capabilities.Handlers | |||
266 | response["content_type"] = "image/" + format; | 268 | response["content_type"] = "image/" + format; |
267 | 269 | ||
268 | response["bin_response_data"] = texture.Data; | 270 | response["bin_response_data"] = texture.Data; |
271 | response["int_bytes"] = texture.Data.Length; | ||
272 | |||
269 | // response.Body.Write(texture.Data, 0, texture.Data.Length); | 273 | // response.Body.Write(texture.Data, 0, texture.Data.Length); |
270 | } | 274 | } |
271 | 275 | ||
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index a1df637..1c6685a 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs | |||
@@ -1053,7 +1053,7 @@ namespace OpenSim.Framework | |||
1053 | event MuteListEntryRemove OnRemoveMuteListEntry; | 1053 | event MuteListEntryRemove OnRemoveMuteListEntry; |
1054 | event GodlikeMessage onGodlikeMessage; | 1054 | event GodlikeMessage onGodlikeMessage; |
1055 | event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate; | 1055 | event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate; |
1056 | 1056 | event GenericCall2 OnUpdateThrottles; | |
1057 | /// <summary> | 1057 | /// <summary> |
1058 | /// Set the debug level at which packet output should be printed to console. | 1058 | /// Set the debug level at which packet output should be printed to console. |
1059 | /// </summary> | 1059 | /// </summary> |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs index 24a0190..d1ec4aa 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs | |||
@@ -58,6 +58,13 @@ namespace OpenSim.Region.ClientStack.Linden | |||
58 | public Hashtable request; | 58 | public Hashtable request; |
59 | } | 59 | } |
60 | 60 | ||
61 | public class aPollResponse | ||
62 | { | ||
63 | public Hashtable response; | ||
64 | public int bytes; | ||
65 | } | ||
66 | |||
67 | |||
61 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 68 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
62 | 69 | ||
63 | private Scene m_scene; | 70 | private Scene m_scene; |
@@ -72,6 +79,8 @@ namespace OpenSim.Region.ClientStack.Linden | |||
72 | private static OpenMetaverse.BlockingQueue<aPollRequest> m_queue = | 79 | private static OpenMetaverse.BlockingQueue<aPollRequest> m_queue = |
73 | new OpenMetaverse.BlockingQueue<aPollRequest>(); | 80 | new OpenMetaverse.BlockingQueue<aPollRequest>(); |
74 | 81 | ||
82 | private Dictionary<UUID,PollServiceTextureEventArgs> m_pollservices = new Dictionary<UUID,PollServiceTextureEventArgs>(); | ||
83 | |||
75 | #region ISharedRegionModule Members | 84 | #region ISharedRegionModule Members |
76 | 85 | ||
77 | public void Initialise(IConfigSource source) | 86 | public void Initialise(IConfigSource source) |
@@ -88,6 +97,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
88 | { | 97 | { |
89 | m_scene.EventManager.OnRegisterCaps -= RegisterCaps; | 98 | m_scene.EventManager.OnRegisterCaps -= RegisterCaps; |
90 | m_scene.EventManager.OnDeregisterCaps -= DeregisterCaps; | 99 | m_scene.EventManager.OnDeregisterCaps -= DeregisterCaps; |
100 | m_scene.EventManager.OnThrottleUpdate -= ThrottleUpdate; | ||
91 | m_scene = null; | 101 | m_scene = null; |
92 | } | 102 | } |
93 | 103 | ||
@@ -98,6 +108,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
98 | 108 | ||
99 | m_scene.EventManager.OnRegisterCaps += RegisterCaps; | 109 | m_scene.EventManager.OnRegisterCaps += RegisterCaps; |
100 | m_scene.EventManager.OnDeregisterCaps += DeregisterCaps; | 110 | m_scene.EventManager.OnDeregisterCaps += DeregisterCaps; |
111 | m_scene.EventManager.OnThrottleUpdate += ThrottleUpdate; | ||
101 | 112 | ||
102 | if (m_workerThreads == null) | 113 | if (m_workerThreads == null) |
103 | { | 114 | { |
@@ -115,6 +126,56 @@ namespace OpenSim.Region.ClientStack.Linden | |||
115 | } | 126 | } |
116 | } | 127 | } |
117 | } | 128 | } |
129 | private int ExtractImageThrottle(byte[] pthrottles) | ||
130 | { | ||
131 | |||
132 | byte[] adjData; | ||
133 | int pos = 0; | ||
134 | |||
135 | if (!BitConverter.IsLittleEndian) | ||
136 | { | ||
137 | byte[] newData = new byte[7 * 4]; | ||
138 | Buffer.BlockCopy(pthrottles, 0, newData, 0, 7 * 4); | ||
139 | |||
140 | for (int i = 0; i < 7; i++) | ||
141 | Array.Reverse(newData, i * 4, 4); | ||
142 | |||
143 | adjData = newData; | ||
144 | } | ||
145 | else | ||
146 | { | ||
147 | adjData = pthrottles; | ||
148 | } | ||
149 | |||
150 | // 0.125f converts from bits to bytes | ||
151 | //int resend = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); | ||
152 | //pos += 4; | ||
153 | // int land = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); | ||
154 | //pos += 4; | ||
155 | // int wind = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); | ||
156 | // pos += 4; | ||
157 | // int cloud = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); | ||
158 | // pos += 4; | ||
159 | // int task = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); | ||
160 | // pos += 4; | ||
161 | pos = pos + 20; | ||
162 | int texture = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); //pos += 4; | ||
163 | //int asset = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); | ||
164 | return texture; | ||
165 | } | ||
166 | |||
167 | // Now we know when the throttle is changed by the client in the case of a root agent or by a neighbor region in the case of a child agent. | ||
168 | public void ThrottleUpdate(ScenePresence p) | ||
169 | { | ||
170 | byte[] throttles = p.ControllingClient.GetThrottlesPacked(1); | ||
171 | UUID user = p.UUID; | ||
172 | int imagethrottle = ExtractImageThrottle(throttles); | ||
173 | PollServiceTextureEventArgs args; | ||
174 | if (m_pollservices.TryGetValue(user,out args)) | ||
175 | { | ||
176 | args.UpdateThrottle(imagethrottle); | ||
177 | } | ||
178 | } | ||
118 | 179 | ||
119 | public void PostInitialise() | 180 | public void PostInitialise() |
120 | { | 181 | { |
@@ -142,20 +203,25 @@ namespace OpenSim.Region.ClientStack.Linden | |||
142 | { | 203 | { |
143 | private List<Hashtable> requests = | 204 | private List<Hashtable> requests = |
144 | new List<Hashtable>(); | 205 | new List<Hashtable>(); |
145 | private Dictionary<UUID, Hashtable> responses = | 206 | private Dictionary<UUID, aPollResponse> responses = |
146 | new Dictionary<UUID, Hashtable>(); | 207 | new Dictionary<UUID, aPollResponse>(); |
147 | 208 | ||
148 | private Scene m_scene; | 209 | private Scene m_scene; |
149 | 210 | private CapsDataThrottler m_throttler = new CapsDataThrottler(100000, 1400000,10000); | |
150 | public PollServiceTextureEventArgs(UUID pId, Scene scene) : | 211 | public PollServiceTextureEventArgs(UUID pId, Scene scene) : |
151 | base(null, null, null, null, pId, int.MaxValue) | 212 | base(null, null, null, null, pId, int.MaxValue) |
152 | { | 213 | { |
153 | m_scene = scene; | 214 | m_scene = scene; |
154 | 215 | // x is request id, y is userid | |
155 | HasEvents = (x, y) => | 216 | HasEvents = (x, y) => |
156 | { | 217 | { |
157 | lock (responses) | 218 | lock (responses) |
158 | return responses.ContainsKey(x); | 219 | { |
220 | bool ret = m_throttler.hasEvents(x, responses); | ||
221 | m_throttler.ProcessTime(); | ||
222 | return ret; | ||
223 | |||
224 | } | ||
159 | }; | 225 | }; |
160 | GetEvents = (x, y) => | 226 | GetEvents = (x, y) => |
161 | { | 227 | { |
@@ -163,7 +229,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
163 | { | 229 | { |
164 | try | 230 | try |
165 | { | 231 | { |
166 | return responses[x]; | 232 | return responses[x].response; |
167 | } | 233 | } |
168 | finally | 234 | finally |
169 | { | 235 | { |
@@ -171,14 +237,14 @@ namespace OpenSim.Region.ClientStack.Linden | |||
171 | } | 237 | } |
172 | } | 238 | } |
173 | }; | 239 | }; |
174 | 240 | // x is request id, y is request data hashtable | |
175 | Request = (x, y) => | 241 | Request = (x, y) => |
176 | { | 242 | { |
177 | aPollRequest reqinfo = new aPollRequest(); | 243 | aPollRequest reqinfo = new aPollRequest(); |
178 | reqinfo.thepoll = this; | 244 | reqinfo.thepoll = this; |
179 | reqinfo.reqID = x; | 245 | reqinfo.reqID = x; |
180 | reqinfo.request = y; | 246 | reqinfo.request = y; |
181 | 247 | ||
182 | m_queue.Enqueue(reqinfo); | 248 | m_queue.Enqueue(reqinfo); |
183 | }; | 249 | }; |
184 | 250 | ||
@@ -220,16 +286,29 @@ namespace OpenSim.Region.ClientStack.Linden | |||
220 | response["content_type"] = "text/plain"; | 286 | response["content_type"] = "text/plain"; |
221 | response["keepalive"] = false; | 287 | response["keepalive"] = false; |
222 | response["reusecontext"] = false; | 288 | response["reusecontext"] = false; |
223 | 289 | ||
224 | lock (responses) | 290 | lock (responses) |
225 | responses[requestID] = response; | 291 | responses[requestID] = new aPollResponse() {bytes = 0, response = response}; |
226 | 292 | ||
227 | return; | 293 | return; |
228 | } | 294 | } |
229 | 295 | ||
230 | response = m_getTextureHandler.Handle(requestinfo.request); | 296 | response = m_getTextureHandler.Handle(requestinfo.request); |
231 | lock (responses) | 297 | lock (responses) |
232 | responses[requestID] = response; | 298 | { |
299 | responses[requestID] = new aPollResponse() | ||
300 | { | ||
301 | bytes = (int) response["int_bytes"], | ||
302 | response = response | ||
303 | }; | ||
304 | |||
305 | } | ||
306 | m_throttler.ProcessTime(); | ||
307 | } | ||
308 | |||
309 | internal void UpdateThrottle(int pimagethrottle) | ||
310 | { | ||
311 | m_throttler.ThrottleBytes = pimagethrottle; | ||
233 | } | 312 | } |
234 | } | 313 | } |
235 | 314 | ||
@@ -254,19 +333,23 @@ namespace OpenSim.Region.ClientStack.Linden | |||
254 | protocol = "https"; | 333 | protocol = "https"; |
255 | } | 334 | } |
256 | caps.RegisterHandler("GetTexture", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl)); | 335 | caps.RegisterHandler("GetTexture", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl)); |
257 | 336 | m_pollservices.Add(agentID, args); | |
258 | m_capsDict[agentID] = capUrl; | 337 | m_capsDict[agentID] = capUrl; |
259 | } | 338 | } |
260 | 339 | ||
261 | private void DeregisterCaps(UUID agentID, Caps caps) | 340 | private void DeregisterCaps(UUID agentID, Caps caps) |
262 | { | 341 | { |
263 | string capUrl; | 342 | string capUrl; |
264 | 343 | PollServiceTextureEventArgs args; | |
265 | if (m_capsDict.TryGetValue(agentID, out capUrl)) | 344 | if (m_capsDict.TryGetValue(agentID, out capUrl)) |
266 | { | 345 | { |
267 | MainServer.Instance.RemoveHTTPHandler("", capUrl); | 346 | MainServer.Instance.RemoveHTTPHandler("", capUrl); |
268 | m_capsDict.Remove(agentID); | 347 | m_capsDict.Remove(agentID); |
269 | } | 348 | } |
349 | if (m_pollservices.TryGetValue(agentID, out args)) | ||
350 | { | ||
351 | m_pollservices.Remove(agentID); | ||
352 | } | ||
270 | } | 353 | } |
271 | 354 | ||
272 | private void DoTextureRequests() | 355 | private void DoTextureRequests() |
@@ -279,4 +362,79 @@ namespace OpenSim.Region.ClientStack.Linden | |||
279 | } | 362 | } |
280 | } | 363 | } |
281 | } | 364 | } |
365 | |||
366 | internal sealed class CapsDataThrottler | ||
367 | { | ||
368 | |||
369 | private volatile int currenttime = 0; | ||
370 | private volatile int lastTimeElapsed = 0; | ||
371 | private volatile int BytesSent = 0; | ||
372 | private int oversizedImages = 0; | ||
373 | public CapsDataThrottler(int pBytes, int max, int min) | ||
374 | { | ||
375 | ThrottleBytes = pBytes; | ||
376 | lastTimeElapsed = Util.EnvironmentTickCount(); | ||
377 | } | ||
378 | public bool hasEvents(UUID key, Dictionary<UUID, GetTextureModule.aPollResponse> responses) | ||
379 | { | ||
380 | PassTime(); | ||
381 | // Note, this is called IN LOCK | ||
382 | bool haskey = responses.ContainsKey(key); | ||
383 | if (!haskey) | ||
384 | { | ||
385 | return false; | ||
386 | } | ||
387 | GetTextureModule.aPollResponse response; | ||
388 | if (responses.TryGetValue(key,out response)) | ||
389 | { | ||
390 | |||
391 | // Normal | ||
392 | if (BytesSent + response.bytes <= ThrottleBytes) | ||
393 | { | ||
394 | BytesSent += response.bytes; | ||
395 | //TimeBasedAction timeBasedAction = new TimeBasedAction { byteRemoval = response.bytes, requestId = key, timeMS = currenttime + 1000, unlockyn = false }; | ||
396 | //m_actions.Add(timeBasedAction); | ||
397 | return true; | ||
398 | } | ||
399 | // Big textures | ||
400 | else if (response.bytes > ThrottleBytes && oversizedImages <= ((ThrottleBytes%50000) + 1)) | ||
401 | { | ||
402 | Interlocked.Increment(ref oversizedImages); | ||
403 | BytesSent += response.bytes; | ||
404 | //TimeBasedAction timeBasedAction = new TimeBasedAction { byteRemoval = response.bytes, requestId = key, timeMS = currenttime + (((response.bytes % ThrottleBytes)+1)*1000) , unlockyn = false }; | ||
405 | //m_actions.Add(timeBasedAction); | ||
406 | return true; | ||
407 | } | ||
408 | else | ||
409 | { | ||
410 | return false; | ||
411 | } | ||
412 | } | ||
413 | |||
414 | return haskey; | ||
415 | } | ||
416 | public void ProcessTime() | ||
417 | { | ||
418 | PassTime(); | ||
419 | } | ||
420 | |||
421 | |||
422 | private void PassTime() | ||
423 | { | ||
424 | currenttime = Util.EnvironmentTickCount(); | ||
425 | int timeElapsed = Util.EnvironmentTickCountSubtract(currenttime, lastTimeElapsed); | ||
426 | //processTimeBasedActions(responses); | ||
427 | if (Util.EnvironmentTickCountSubtract(currenttime, timeElapsed) >= 1000) | ||
428 | { | ||
429 | lastTimeElapsed = Util.EnvironmentTickCount(); | ||
430 | BytesSent -= ThrottleBytes; | ||
431 | if (BytesSent < 0) BytesSent = 0; | ||
432 | if (BytesSent < ThrottleBytes) | ||
433 | { | ||
434 | oversizedImages = 0; | ||
435 | } | ||
436 | } | ||
437 | } | ||
438 | public int ThrottleBytes; | ||
439 | } | ||
282 | } | 440 | } |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 81167ec..5551f51 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -296,6 +296,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
296 | public event MuteListEntryRemove OnRemoveMuteListEntry; | 296 | public event MuteListEntryRemove OnRemoveMuteListEntry; |
297 | public event GodlikeMessage onGodlikeMessage; | 297 | public event GodlikeMessage onGodlikeMessage; |
298 | public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate; | 298 | public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate; |
299 | public event GenericCall2 OnUpdateThrottles; | ||
299 | 300 | ||
300 | #endregion Events | 301 | #endregion Events |
301 | 302 | ||
@@ -6753,6 +6754,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6753 | #endregion | 6754 | #endregion |
6754 | 6755 | ||
6755 | m_udpClient.SetThrottles(atpack.Throttle.Throttles); | 6756 | m_udpClient.SetThrottles(atpack.Throttle.Throttles); |
6757 | GenericCall2 handler = OnUpdateThrottles; | ||
6758 | if (handler != null) | ||
6759 | { | ||
6760 | handler(); | ||
6761 | } | ||
6756 | return true; | 6762 | return true; |
6757 | } | 6763 | } |
6758 | 6764 | ||
@@ -11906,6 +11912,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11906 | public void SetChildAgentThrottle(byte[] throttles) | 11912 | public void SetChildAgentThrottle(byte[] throttles) |
11907 | { | 11913 | { |
11908 | m_udpClient.SetThrottles(throttles); | 11914 | m_udpClient.SetThrottles(throttles); |
11915 | GenericCall2 handler = OnUpdateThrottles; | ||
11916 | if (handler != null) | ||
11917 | { | ||
11918 | handler(); | ||
11919 | } | ||
11909 | } | 11920 | } |
11910 | 11921 | ||
11911 | /// <summary> | 11922 | /// <summary> |
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs index f6dd5af..0aa4693 100644 --- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs +++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs | |||
@@ -136,18 +136,27 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction | |||
136 | 136 | ||
137 | if (XferID == xferID) | 137 | if (XferID == xferID) |
138 | { | 138 | { |
139 | if (m_asset.Data.Length > 1) | 139 | lock (this) |
140 | { | 140 | { |
141 | byte[] destinationArray = new byte[m_asset.Data.Length + data.Length]; | 141 | int assetLength = m_asset.Data.Length; |
142 | Array.Copy(m_asset.Data, 0, destinationArray, 0, m_asset.Data.Length); | 142 | int dataLength = data.Length; |
143 | Array.Copy(data, 0, destinationArray, m_asset.Data.Length, data.Length); | 143 | |
144 | m_asset.Data = destinationArray; | 144 | if (m_asset.Data.Length > 1) |
145 | } | 145 | { |
146 | else | 146 | byte[] destinationArray = new byte[assetLength + dataLength]; |
147 | { | 147 | Array.Copy(m_asset.Data, 0, destinationArray, 0, assetLength); |
148 | byte[] buffer2 = new byte[data.Length - 4]; | 148 | Array.Copy(data, 0, destinationArray, assetLength, dataLength); |
149 | Array.Copy(data, 4, buffer2, 0, data.Length - 4); | 149 | m_asset.Data = destinationArray; |
150 | m_asset.Data = buffer2; | 150 | } |
151 | else | ||
152 | { | ||
153 | if (dataLength > 4) | ||
154 | { | ||
155 | byte[] buffer2 = new byte[dataLength - 4]; | ||
156 | Array.Copy(data, 4, buffer2, 0, dataLength - 4); | ||
157 | m_asset.Data = buffer2; | ||
158 | } | ||
159 | } | ||
151 | } | 160 | } |
152 | 161 | ||
153 | ourClient.SendConfirmXfer(xferID, packetID); | 162 | ourClient.SendConfirmXfer(xferID, packetID); |
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 8691b91..5b1c9f4 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs | |||
@@ -816,6 +816,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
816 | public event ParcelPrimCountTainted OnParcelPrimCountTainted; | 816 | public event ParcelPrimCountTainted OnParcelPrimCountTainted; |
817 | public event GetScriptRunning OnGetScriptRunning; | 817 | public event GetScriptRunning OnGetScriptRunning; |
818 | 818 | ||
819 | public delegate void ThrottleUpdate(ScenePresence scenePresence); | ||
820 | |||
821 | public event ThrottleUpdate OnThrottleUpdate; | ||
822 | |||
819 | /// <summary> | 823 | /// <summary> |
820 | /// RegisterCapsEvent is called by Scene after the Caps object | 824 | /// RegisterCapsEvent is called by Scene after the Caps object |
821 | /// has been instantiated and before it is return to the | 825 | /// has been instantiated and before it is return to the |
@@ -3130,5 +3134,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
3130 | } | 3134 | } |
3131 | } | 3135 | } |
3132 | } | 3136 | } |
3137 | |||
3138 | public void TriggerThrottleUpdate(ScenePresence scenePresence) | ||
3139 | { | ||
3140 | ThrottleUpdate handler = OnThrottleUpdate; | ||
3141 | if (handler != null) | ||
3142 | { | ||
3143 | handler(scenePresence); | ||
3144 | } | ||
3145 | } | ||
3133 | } | 3146 | } |
3134 | } | 3147 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 74d2629..b9f9c86 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -112,7 +112,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
112 | private long timeLastChanged = 0; | 112 | private long timeLastChanged = 0; |
113 | private long m_maxPersistTime = 0; | 113 | private long m_maxPersistTime = 0; |
114 | private long m_minPersistTime = 0; | 114 | private long m_minPersistTime = 0; |
115 | private Random m_rand; | 115 | // private Random m_rand; |
116 | private List<ScenePresence> m_linkedAvatars = new List<ScenePresence>(); | 116 | private List<ScenePresence> m_linkedAvatars = new List<ScenePresence>(); |
117 | 117 | ||
118 | /// <summary> | 118 | /// <summary> |
@@ -130,6 +130,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
130 | { | 130 | { |
131 | if (value) | 131 | if (value) |
132 | { | 132 | { |
133 | |||
133 | if (m_isBackedUp) | 134 | if (m_isBackedUp) |
134 | { | 135 | { |
135 | m_scene.SceneGraph.FireChangeBackup(this); | 136 | m_scene.SceneGraph.FireChangeBackup(this); |
@@ -139,19 +140,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
139 | timeFirstChanged = DateTime.Now.Ticks; | 140 | timeFirstChanged = DateTime.Now.Ticks; |
140 | if (m_rootPart != null && m_rootPart.UUID != null && m_scene != null) | 141 | if (m_rootPart != null && m_rootPart.UUID != null && m_scene != null) |
141 | { | 142 | { |
143 | /* | ||
142 | if (m_rand == null) | 144 | if (m_rand == null) |
143 | { | 145 | { |
144 | byte[] val = new byte[16]; | 146 | byte[] val = new byte[16]; |
145 | m_rootPart.UUID.ToBytes(val, 0); | 147 | m_rootPart.UUID.ToBytes(val, 0); |
146 | m_rand = new Random(BitConverter.ToInt32(val, 0)); | 148 | m_rand = new Random(BitConverter.ToInt32(val, 0)); |
147 | } | 149 | } |
148 | 150 | */ | |
149 | if (m_scene.GetRootAgentCount() == 0) | 151 | if (m_scene.GetRootAgentCount() == 0) |
150 | { | 152 | { |
151 | //If the region is empty, this change has been made by an automated process | 153 | //If the region is empty, this change has been made by an automated process |
152 | //and thus we delay the persist time by a random amount between 1.5 and 2.5. | 154 | //and thus we delay the persist time by a random amount between 1.5 and 2.5. |
153 | 155 | ||
154 | float factor = 1.5f + (float)(m_rand.NextDouble()); | 156 | // float factor = 1.5f + (float)(m_rand.NextDouble()); |
157 | float factor = 2.0f; | ||
155 | m_maxPersistTime = (long)((float)m_scene.m_persistAfter * factor); | 158 | m_maxPersistTime = (long)((float)m_scene.m_persistAfter * factor); |
156 | m_minPersistTime = (long)((float)m_scene.m_dontPersistBefore * factor); | 159 | m_minPersistTime = (long)((float)m_scene.m_dontPersistBefore * factor); |
157 | } | 160 | } |
@@ -159,8 +162,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
159 | { | 162 | { |
160 | //If the region is not empty, we want to obey the minimum and maximum persist times | 163 | //If the region is not empty, we want to obey the minimum and maximum persist times |
161 | //but add a random factor so we stagger the object persistance a little | 164 | //but add a random factor so we stagger the object persistance a little |
162 | m_maxPersistTime = (long)((float)m_scene.m_persistAfter * (1.0d - (m_rand.NextDouble() / 5.0d))); //Multiply by 1.0-1.5 | 165 | // m_maxPersistTime = (long)((float)m_scene.m_persistAfter * (1.0d - (m_rand.NextDouble() / 5.0d))); //Multiply by 1.0-1.5 |
163 | m_minPersistTime = (long)((float)m_scene.m_dontPersistBefore * (1.0d + (m_rand.NextDouble() / 2.0d))); //Multiply by 0.8-1.0 | 166 | // m_minPersistTime = (long)((float)m_scene.m_dontPersistBefore * (1.0d + (m_rand.NextDouble() / 2.0d))); //Multiply by 0.8-1.0 |
167 | m_maxPersistTime = m_scene.m_persistAfter; | ||
168 | m_minPersistTime = m_scene.m_dontPersistBefore; | ||
164 | } | 169 | } |
165 | } | 170 | } |
166 | } | 171 | } |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 2c18397..25a53b4 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -794,6 +794,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
794 | ControllingClient.OnChangeAnim += avnHandleChangeAnim; | 794 | ControllingClient.OnChangeAnim += avnHandleChangeAnim; |
795 | ControllingClient.OnForceReleaseControls += HandleForceReleaseControls; | 795 | ControllingClient.OnForceReleaseControls += HandleForceReleaseControls; |
796 | ControllingClient.OnAutoPilotGo += MoveToTarget; | 796 | ControllingClient.OnAutoPilotGo += MoveToTarget; |
797 | ControllingClient.OnUpdateThrottles += RaiseUpdateThrottles; | ||
797 | 798 | ||
798 | // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); | 799 | // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); |
799 | // ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement); | 800 | // ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement); |
@@ -3174,6 +3175,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
3174 | } | 3175 | } |
3175 | 3176 | ||
3176 | private static Vector3 marker = new Vector3(-1f, -1f, -1f); | 3177 | private static Vector3 marker = new Vector3(-1f, -1f, -1f); |
3178 | private void RaiseUpdateThrottles() | ||
3179 | { | ||
3180 | m_scene.EventManager.TriggerThrottleUpdate(this); | ||
3181 | } | ||
3177 | /// <summary> | 3182 | /// <summary> |
3178 | /// This updates important decision making data about a child agent | 3183 | /// This updates important decision making data about a child agent |
3179 | /// The main purpose is to figure out what objects to send to a child agent that's in a neighboring region | 3184 | /// The main purpose is to figure out what objects to send to a child agent that's in a neighboring region |
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index c363fd3..254eeb4 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs | |||
@@ -873,6 +873,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server | |||
873 | public event MuteListEntryRemove OnRemoveMuteListEntry; | 873 | public event MuteListEntryRemove OnRemoveMuteListEntry; |
874 | public event GodlikeMessage onGodlikeMessage; | 874 | public event GodlikeMessage onGodlikeMessage; |
875 | public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate; | 875 | public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate; |
876 | public event GenericCall2 OnUpdateThrottles; | ||
876 | 877 | ||
877 | #pragma warning restore 67 | 878 | #pragma warning restore 67 |
878 | 879 | ||
diff --git a/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs b/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs index 59ff9b8..39cabb5 100644 --- a/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs +++ b/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs | |||
@@ -121,34 +121,40 @@ namespace OpenSim.Region.OptionalModules | |||
121 | 121 | ||
122 | private bool CanObjectEnter(UUID objectID, bool enteringRegion, Vector3 newPoint, Scene scene) | 122 | private bool CanObjectEnter(UUID objectID, bool enteringRegion, Vector3 newPoint, Scene scene) |
123 | { | 123 | { |
124 | if ((newPoint.X > 257f || newPoint.X < -1f || newPoint.Y > 257f || newPoint.Y < -1f)) | 124 | if (newPoint.X < -1f || newPoint.X > (float)(Constants.RegionSize + 1) || |
125 | newPoint.Y < -1f || newPoint.Y > (float)(Constants.RegionSize + 1)) | ||
125 | return true; | 126 | return true; |
126 | 127 | ||
127 | SceneObjectPart obj = scene.GetSceneObjectPart(objectID); | 128 | SceneObjectPart obj = scene.GetSceneObjectPart(objectID); |
128 | Vector3 oldPoint = obj.GroupPosition; | 129 | |
129 | int objectCount = obj.ParentGroup.PrimCount; | 130 | if (obj == null) |
130 | ILandObject oldParcel = scene.LandChannel.GetLandObject(oldPoint.X, oldPoint.Y); | 131 | return false; |
132 | |||
133 | // Prim counts are determined by the location of the root prim. if we're | ||
134 | // moving a child prim, just let it pass | ||
135 | if (!obj.IsRoot) | ||
136 | { | ||
137 | return true; | ||
138 | } | ||
139 | |||
131 | ILandObject newParcel = scene.LandChannel.GetLandObject(newPoint.X, newPoint.Y); | 140 | ILandObject newParcel = scene.LandChannel.GetLandObject(newPoint.X, newPoint.Y); |
132 | 141 | ||
133 | if (newParcel == null) | 142 | if (newParcel == null) |
134 | return true; | 143 | return true; |
135 | 144 | ||
136 | int usedPrims = newParcel.PrimCounts.Total; | 145 | Vector3 oldPoint = obj.GroupPosition; |
137 | int simulatorCapacity = newParcel.GetSimulatorMaxPrimCount(); | 146 | ILandObject oldParcel = scene.LandChannel.GetLandObject(oldPoint.X, oldPoint.Y); |
138 | 147 | ||
139 | // The prim hasn't crossed a region boundry so we don't need to worry | 148 | // The prim hasn't crossed a region boundry so we don't need to worry |
140 | // about prim counts here | 149 | // about prim counts here |
141 | if(oldParcel.Equals(newParcel)) | 150 | if(oldParcel != null && oldParcel.Equals(newParcel)) |
142 | { | 151 | { |
143 | return true; | 152 | return true; |
144 | } | 153 | } |
145 | 154 | ||
146 | // Prim counts are determined by the location of the root prim. if we're | 155 | int objectCount = obj.ParentGroup.PrimCount; |
147 | // moving a child prim, just let it pass | 156 | int usedPrims = newParcel.PrimCounts.Total; |
148 | if(!obj.IsRoot) | 157 | int simulatorCapacity = newParcel.GetSimulatorMaxPrimCount(); |
149 | { | ||
150 | return true; | ||
151 | } | ||
152 | 158 | ||
153 | // TODO: Add Special Case here for temporary prims | 159 | // TODO: Add Special Case here for temporary prims |
154 | 160 | ||
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index 5471afa..3a03101 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs | |||
@@ -473,7 +473,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
473 | public event MuteListEntryRemove OnRemoveMuteListEntry; | 473 | public event MuteListEntryRemove OnRemoveMuteListEntry; |
474 | public event GodlikeMessage onGodlikeMessage; | 474 | public event GodlikeMessage onGodlikeMessage; |
475 | public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate; | 475 | public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate; |
476 | 476 | public event GenericCall2 OnUpdateThrottles; | |
477 | #pragma warning restore 67 | 477 | #pragma warning restore 67 |
478 | 478 | ||
479 | #endregion | 479 | #endregion |
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs index 76e42d4..dc247a9 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs | |||
@@ -1403,8 +1403,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1403 | 1403 | ||
1404 | if (vertexCount == 0 || indexCount == 0) | 1404 | if (vertexCount == 0 || indexCount == 0) |
1405 | { | 1405 | { |
1406 | m_log.WarnFormat("[PHYSICS]: Invalid mesh data on OdePrim {0}, mesh {1}", | 1406 | m_log.WarnFormat("[PHYSICS]: Invalid mesh data on OdePrim {0}, mesh {1} at {2}", |
1407 | Name, _pbs.SculptEntry ? _pbs.SculptTexture.ToString() : "primMesh"); | 1407 | Name, _pbs.SculptEntry ? _pbs.SculptTexture.ToString() : "primMesh",_position.ToString()); |
1408 | 1408 | ||
1409 | m_hasOBB = false; | 1409 | m_hasOBB = false; |
1410 | m_OBBOffset = Vector3.Zero; | 1410 | m_OBBOffset = Vector3.Zero; |
diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index ebdfb4f..5ad3c9f 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs | |||
@@ -320,7 +320,7 @@ namespace OpenSim.Tests.Common.Mock | |||
320 | public event MuteListEntryRemove OnRemoveMuteListEntry; | 320 | public event MuteListEntryRemove OnRemoveMuteListEntry; |
321 | public event GodlikeMessage onGodlikeMessage; | 321 | public event GodlikeMessage onGodlikeMessage; |
322 | public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate; | 322 | public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate; |
323 | 323 | public event GenericCall2 OnUpdateThrottles; | |
324 | #pragma warning restore 67 | 324 | #pragma warning restore 67 |
325 | 325 | ||
326 | /// <value> | 326 | /// <value> |