diff options
Diffstat (limited to '')
34 files changed, 1124 insertions, 210 deletions
diff --git a/OpenSim/Framework/AssetBase.cs b/OpenSim/Framework/AssetBase.cs index d2c6c57..5da8e11 100644 --- a/OpenSim/Framework/AssetBase.cs +++ b/OpenSim/Framework/AssetBase.cs | |||
@@ -60,6 +60,8 @@ namespace OpenSim.Framework | |||
60 | /// </summary> | 60 | /// </summary> |
61 | private AssetMetadata m_metadata; | 61 | private AssetMetadata m_metadata; |
62 | 62 | ||
63 | private int m_uploadAttempts; | ||
64 | |||
63 | // This is needed for .NET serialization!!! | 65 | // This is needed for .NET serialization!!! |
64 | // Do NOT "Optimize" away! | 66 | // Do NOT "Optimize" away! |
65 | public AssetBase() | 67 | public AssetBase() |
@@ -148,7 +150,8 @@ namespace OpenSim.Framework | |||
148 | Type == (sbyte)AssetType.SnapshotFolder || | 150 | Type == (sbyte)AssetType.SnapshotFolder || |
149 | Type == (sbyte)AssetType.TrashFolder || | 151 | Type == (sbyte)AssetType.TrashFolder || |
150 | Type == (sbyte)AssetType.ImageJPEG || | 152 | Type == (sbyte)AssetType.ImageJPEG || |
151 | Type == (sbyte) AssetType.ImageTGA || | 153 | Type == (sbyte)AssetType.ImageTGA || |
154 | Type == (sbyte)AssetType.Mesh || | ||
152 | Type == (sbyte) AssetType.LSLBytecode); | 155 | Type == (sbyte) AssetType.LSLBytecode); |
153 | } | 156 | } |
154 | } | 157 | } |
@@ -198,6 +201,12 @@ namespace OpenSim.Framework | |||
198 | set { m_metadata.Type = value; } | 201 | set { m_metadata.Type = value; } |
199 | } | 202 | } |
200 | 203 | ||
204 | public int UploadAttempts | ||
205 | { | ||
206 | get { return m_uploadAttempts; } | ||
207 | set { m_uploadAttempts = value; } | ||
208 | } | ||
209 | |||
201 | /// <summary> | 210 | /// <summary> |
202 | /// Is this a region only asset, or does this exist on the asset server also | 211 | /// Is this a region only asset, or does this exist on the asset server also |
203 | /// </summary> | 212 | /// </summary> |
diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 4f598b0..c5d9641 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs | |||
@@ -42,6 +42,8 @@ namespace OpenSim.Framework | |||
42 | { | 42 | { |
43 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 43 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
44 | 44 | ||
45 | // this is viewer capabilities and weared things dependent | ||
46 | // should be only used as initial default value ( V1 viewers ) | ||
45 | public readonly static int VISUALPARAM_COUNT = 218; | 47 | public readonly static int VISUALPARAM_COUNT = 218; |
46 | 48 | ||
47 | public readonly static int TEXTURE_COUNT = 21; | 49 | public readonly static int TEXTURE_COUNT = 21; |
@@ -240,6 +242,21 @@ namespace OpenSim.Framework | |||
240 | // } | 242 | // } |
241 | } | 243 | } |
242 | 244 | ||
245 | /// <summary> | ||
246 | /// Invalidate all of the baked textures in the appearance, useful | ||
247 | /// if you know that none are valid | ||
248 | /// </summary> | ||
249 | public virtual void ResetBakedTextures() | ||
250 | { | ||
251 | SetDefaultTexture(); | ||
252 | |||
253 | //for (int i = 0; i < BAKE_INDICES.Length; i++) | ||
254 | // { | ||
255 | // int idx = BAKE_INDICES[i]; | ||
256 | // m_texture.FaceTextures[idx].TextureID = UUID.Zero; | ||
257 | // } | ||
258 | } | ||
259 | |||
243 | protected virtual void SetDefaultTexture() | 260 | protected virtual void SetDefaultTexture() |
244 | { | 261 | { |
245 | m_texture = new Primitive.TextureEntry(new UUID(AppearanceManager.DEFAULT_AVATAR_TEXTURE)); | 262 | m_texture = new Primitive.TextureEntry(new UUID(AppearanceManager.DEFAULT_AVATAR_TEXTURE)); |
@@ -304,19 +321,30 @@ namespace OpenSim.Framework | |||
304 | // made. We determine if any of the visual parameters actually | 321 | // made. We determine if any of the visual parameters actually |
305 | // changed to know if the appearance should be saved later | 322 | // changed to know if the appearance should be saved later |
306 | bool changed = false; | 323 | bool changed = false; |
307 | for (int i = 0; i < AvatarAppearance.VISUALPARAM_COUNT; i++) | 324 | |
325 | int newsize = visualParams.Length; | ||
326 | |||
327 | if (newsize != m_visualparams.Length) | ||
308 | { | 328 | { |
309 | if (visualParams[i] != m_visualparams[i]) | 329 | changed = true; |
330 | m_visualparams = (byte[])visualParams.Clone(); | ||
331 | } | ||
332 | else | ||
333 | { | ||
334 | |||
335 | for (int i = 0; i < newsize; i++) | ||
310 | { | 336 | { |
311 | // DEBUG ON | 337 | if (visualParams[i] != m_visualparams[i]) |
312 | // m_log.WarnFormat("[AVATARAPPEARANCE] vparams changed [{0}] {1} ==> {2}", | 338 | { |
313 | // i,m_visualparams[i],visualParams[i]); | 339 | // DEBUG ON |
314 | // DEBUG OFF | 340 | // m_log.WarnFormat("[AVATARAPPEARANCE] vparams changed [{0}] {1} ==> {2}", |
315 | m_visualparams[i] = visualParams[i]; | 341 | // i,m_visualparams[i],visualParams[i]); |
316 | changed = true; | 342 | // DEBUG OFF |
343 | m_visualparams[i] = visualParams[i]; | ||
344 | changed = true; | ||
345 | } | ||
317 | } | 346 | } |
318 | } | 347 | } |
319 | |||
320 | // Reset the height if the visual parameters actually changed | 348 | // Reset the height if the visual parameters actually changed |
321 | if (changed) | 349 | if (changed) |
322 | SetHeight(); | 350 | SetHeight(); |
@@ -374,7 +402,8 @@ namespace OpenSim.Framework | |||
374 | } | 402 | } |
375 | 403 | ||
376 | s += "Visual Params: "; | 404 | s += "Visual Params: "; |
377 | for (uint j = 0; j < AvatarAppearance.VISUALPARAM_COUNT; j++) | 405 | // for (uint j = 0; j < AvatarAppearance.VISUALPARAM_COUNT; j++) |
406 | for (uint j = 0; j < m_visualparams.Length; j++) | ||
378 | s += String.Format("{0},",m_visualparams[j]); | 407 | s += String.Format("{0},",m_visualparams[j]); |
379 | s += "\n"; | 408 | s += "\n"; |
380 | 409 | ||
@@ -390,19 +419,18 @@ namespace OpenSim.Framework | |||
390 | /// </remarks> | 419 | /// </remarks> |
391 | public List<AvatarAttachment> GetAttachments() | 420 | public List<AvatarAttachment> GetAttachments() |
392 | { | 421 | { |
393 | List<AvatarAttachment> alist = new List<AvatarAttachment>(); | 422 | |
394 | 423 | ||
395 | lock (m_attachments) | 424 | lock (m_attachments) |
396 | { | 425 | { |
426 | List<AvatarAttachment> alist = new List<AvatarAttachment>(); | ||
397 | foreach (KeyValuePair<int, List<AvatarAttachment>> kvp in m_attachments) | 427 | foreach (KeyValuePair<int, List<AvatarAttachment>> kvp in m_attachments) |
398 | { | 428 | { |
399 | foreach (AvatarAttachment attach in kvp.Value) | 429 | foreach (AvatarAttachment attach in kvp.Value) |
400 | alist.Add(new AvatarAttachment(attach)); | 430 | alist.Add(new AvatarAttachment(attach)); |
401 | } | 431 | } |
402 | } | 432 | return alist; |
403 | 433 | } } | |
404 | return alist; | ||
405 | } | ||
406 | 434 | ||
407 | internal void AppendAttachment(AvatarAttachment attach) | 435 | internal void AppendAttachment(AvatarAttachment attach) |
408 | { | 436 | { |
@@ -531,7 +559,6 @@ namespace OpenSim.Framework | |||
531 | return kvp.Key; | 559 | return kvp.Key; |
532 | } | 560 | } |
533 | } | 561 | } |
534 | |||
535 | return 0; | 562 | return 0; |
536 | } | 563 | } |
537 | 564 | ||
@@ -598,12 +625,14 @@ namespace OpenSim.Framework | |||
598 | OSDBinary visualparams = new OSDBinary(m_visualparams); | 625 | OSDBinary visualparams = new OSDBinary(m_visualparams); |
599 | data["visualparams"] = visualparams; | 626 | data["visualparams"] = visualparams; |
600 | 627 | ||
601 | // Attachments | 628 | lock (m_attachments) |
602 | List<AvatarAttachment> attachments = GetAttachments(); | 629 | { |
603 | OSDArray attachs = new OSDArray(attachments.Count); | 630 | // Attachments |
604 | foreach (AvatarAttachment attach in GetAttachments()) | 631 | OSDArray attachs = new OSDArray(m_attachments.Count); |
605 | attachs.Add(attach.Pack()); | 632 | foreach (AvatarAttachment attach in GetAttachments()) |
606 | data["attachments"] = attachs; | 633 | attachs.Add(attach.Pack()); |
634 | data["attachments"] = attachs; | ||
635 | } | ||
607 | 636 | ||
608 | return data; | 637 | return data; |
609 | } | 638 | } |
diff --git a/OpenSim/Framework/AvatarWearable.cs b/OpenSim/Framework/AvatarWearable.cs index 8e27596..aee295a 100644 --- a/OpenSim/Framework/AvatarWearable.cs +++ b/OpenSim/Framework/AvatarWearable.cs | |||
@@ -62,9 +62,14 @@ namespace OpenSim.Framework | |||
62 | public static readonly int UNDERSHIRT = 10; | 62 | public static readonly int UNDERSHIRT = 10; |
63 | public static readonly int UNDERPANTS = 11; | 63 | public static readonly int UNDERPANTS = 11; |
64 | public static readonly int SKIRT = 12; | 64 | public static readonly int SKIRT = 12; |
65 | |||
66 | public static readonly int MAX_BASICWEARABLES = 13; | ||
67 | |||
65 | public static readonly int ALPHA = 13; | 68 | public static readonly int ALPHA = 13; |
66 | public static readonly int TATTOO = 14; | 69 | public static readonly int TATTOO = 14; |
70 | // public static readonly int PHYSICS = 15; | ||
67 | 71 | ||
72 | // public static readonly int MAX_WEARABLES = 16; | ||
68 | public static readonly int MAX_WEARABLES = 15; | 73 | public static readonly int MAX_WEARABLES = 15; |
69 | 74 | ||
70 | public static readonly UUID DEFAULT_BODY_ITEM = new UUID("66c41e39-38f9-f75a-024e-585989bfaba9"); | 75 | public static readonly UUID DEFAULT_BODY_ITEM = new UUID("66c41e39-38f9-f75a-024e-585989bfaba9"); |
@@ -219,7 +224,7 @@ namespace OpenSim.Framework | |||
219 | { | 224 | { |
220 | get | 225 | get |
221 | { | 226 | { |
222 | AvatarWearable[] defaultWearables = new AvatarWearable[MAX_WEARABLES]; //should be 15 of these | 227 | AvatarWearable[] defaultWearables = new AvatarWearable[MAX_WEARABLES]; |
223 | for (int i = 0; i < MAX_WEARABLES; i++) | 228 | for (int i = 0; i < MAX_WEARABLES; i++) |
224 | { | 229 | { |
225 | defaultWearables[i] = new AvatarWearable(); | 230 | defaultWearables[i] = new AvatarWearable(); |
@@ -242,10 +247,13 @@ namespace OpenSim.Framework | |||
242 | 247 | ||
243 | // // Alpha | 248 | // // Alpha |
244 | // defaultWearables[ALPHA].Add(DEFAULT_ALPHA_ITEM, DEFAULT_ALPHA_ASSET); | 249 | // defaultWearables[ALPHA].Add(DEFAULT_ALPHA_ITEM, DEFAULT_ALPHA_ASSET); |
245 | 250 | ||
246 | // // Tattoo | 251 | // // Tattoo |
247 | // defaultWearables[TATTOO].Add(DEFAULT_TATTOO_ITEM, DEFAULT_TATTOO_ASSET); | 252 | // defaultWearables[TATTOO].Add(DEFAULT_TATTOO_ITEM, DEFAULT_TATTOO_ASSET); |
248 | 253 | ||
254 | // // Physics | ||
255 | // defaultWearables[PHYSICS].Add(DEFAULT_TATTOO_ITEM, DEFAULT_TATTOO_ASSET); | ||
256 | |||
249 | return defaultWearables; | 257 | return defaultWearables; |
250 | } | 258 | } |
251 | } | 259 | } |
diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs index 6d048f4..e718aa6 100644 --- a/OpenSim/Framework/ChildAgentDataUpdate.cs +++ b/OpenSim/Framework/ChildAgentDataUpdate.cs | |||
@@ -229,12 +229,14 @@ namespace OpenSim.Framework | |||
229 | 229 | ||
230 | public class ControllerData | 230 | public class ControllerData |
231 | { | 231 | { |
232 | public UUID ObjectID; | ||
232 | public UUID ItemID; | 233 | public UUID ItemID; |
233 | public uint IgnoreControls; | 234 | public uint IgnoreControls; |
234 | public uint EventControls; | 235 | public uint EventControls; |
235 | 236 | ||
236 | public ControllerData(UUID item, uint ignore, uint ev) | 237 | public ControllerData(UUID obj, UUID item, uint ignore, uint ev) |
237 | { | 238 | { |
239 | ObjectID = obj; | ||
238 | ItemID = item; | 240 | ItemID = item; |
239 | IgnoreControls = ignore; | 241 | IgnoreControls = ignore; |
240 | EventControls = ev; | 242 | EventControls = ev; |
@@ -248,6 +250,7 @@ namespace OpenSim.Framework | |||
248 | public OSDMap PackUpdateMessage() | 250 | public OSDMap PackUpdateMessage() |
249 | { | 251 | { |
250 | OSDMap controldata = new OSDMap(); | 252 | OSDMap controldata = new OSDMap(); |
253 | controldata["object"] = OSD.FromUUID(ObjectID); | ||
251 | controldata["item"] = OSD.FromUUID(ItemID); | 254 | controldata["item"] = OSD.FromUUID(ItemID); |
252 | controldata["ignore"] = OSD.FromInteger(IgnoreControls); | 255 | controldata["ignore"] = OSD.FromInteger(IgnoreControls); |
253 | controldata["event"] = OSD.FromInteger(EventControls); | 256 | controldata["event"] = OSD.FromInteger(EventControls); |
@@ -258,6 +261,8 @@ namespace OpenSim.Framework | |||
258 | 261 | ||
259 | public void UnpackUpdateMessage(OSDMap args) | 262 | public void UnpackUpdateMessage(OSDMap args) |
260 | { | 263 | { |
264 | if (args["object"] != null) | ||
265 | ObjectID = args["object"].AsUUID(); | ||
261 | if (args["item"] != null) | 266 | if (args["item"] != null) |
262 | ItemID = args["item"].AsUUID(); | 267 | ItemID = args["item"].AsUUID(); |
263 | if (args["ignore"] != null) | 268 | if (args["ignore"] != null) |
@@ -306,8 +311,11 @@ namespace OpenSim.Framework | |||
306 | 311 | ||
307 | public AgentGroupData[] Groups; | 312 | public AgentGroupData[] Groups; |
308 | public Animation[] Anims; | 313 | public Animation[] Anims; |
314 | public Animation DefaultAnim = null; | ||
309 | 315 | ||
310 | public UUID GranterID; | 316 | public UUID GranterID; |
317 | public UUID ParentPart; | ||
318 | public Vector3 SitOffset; | ||
311 | 319 | ||
312 | // Appearance | 320 | // Appearance |
313 | public AvatarAppearance Appearance; | 321 | public AvatarAppearance Appearance; |
@@ -390,6 +398,11 @@ namespace OpenSim.Framework | |||
390 | args["animations"] = anims; | 398 | args["animations"] = anims; |
391 | } | 399 | } |
392 | 400 | ||
401 | if (DefaultAnim != null) | ||
402 | { | ||
403 | args["default_animation"] = DefaultAnim.PackUpdateMessage(); | ||
404 | } | ||
405 | |||
393 | if (Appearance != null) | 406 | if (Appearance != null) |
394 | args["packed_appearance"] = Appearance.Pack(); | 407 | args["packed_appearance"] = Appearance.Pack(); |
395 | 408 | ||
@@ -468,6 +481,10 @@ namespace OpenSim.Framework | |||
468 | } | 481 | } |
469 | args["attach_objects"] = attObjs; | 482 | args["attach_objects"] = attObjs; |
470 | } | 483 | } |
484 | |||
485 | args["parent_part"] = OSD.FromUUID(ParentPart); | ||
486 | args["sit_offset"] = OSD.FromString(SitOffset.ToString()); | ||
487 | |||
471 | return args; | 488 | return args; |
472 | } | 489 | } |
473 | 490 | ||
@@ -583,6 +600,18 @@ namespace OpenSim.Framework | |||
583 | } | 600 | } |
584 | } | 601 | } |
585 | 602 | ||
603 | if (args["default_animation"] != null) | ||
604 | { | ||
605 | try | ||
606 | { | ||
607 | DefaultAnim = new Animation((OSDMap)args["default_animation"]); | ||
608 | } | ||
609 | catch | ||
610 | { | ||
611 | DefaultAnim = null; | ||
612 | } | ||
613 | } | ||
614 | |||
586 | //if ((args["agent_textures"] != null) && (args["agent_textures"]).Type == OSDType.Array) | 615 | //if ((args["agent_textures"] != null) && (args["agent_textures"]).Type == OSDType.Array) |
587 | //{ | 616 | //{ |
588 | // OSDArray textures = (OSDArray)(args["agent_textures"]); | 617 | // OSDArray textures = (OSDArray)(args["agent_textures"]); |
@@ -675,6 +704,11 @@ namespace OpenSim.Framework | |||
675 | } | 704 | } |
676 | } | 705 | } |
677 | } | 706 | } |
707 | |||
708 | if (args["parent_part"] != null) | ||
709 | ParentPart = args["parent_part"].AsUUID(); | ||
710 | if (args["sit_offset"] != null) | ||
711 | Vector3.TryParse(args["sit_offset"].AsString(), out SitOffset); | ||
678 | } | 712 | } |
679 | 713 | ||
680 | public AgentData() | 714 | public AgentData() |
diff --git a/OpenSim/Framework/Communications/RestClient.cs b/OpenSim/Framework/Communications/RestClient.cs index 97b3b60..42c0b18 100644 --- a/OpenSim/Framework/Communications/RestClient.cs +++ b/OpenSim/Framework/Communications/RestClient.cs | |||
@@ -363,7 +363,7 @@ namespace OpenSim.Framework.Communications | |||
363 | _request = (HttpWebRequest) WebRequest.Create(buildUri()); | 363 | _request = (HttpWebRequest) WebRequest.Create(buildUri()); |
364 | _request.KeepAlive = false; | 364 | _request.KeepAlive = false; |
365 | _request.ContentType = "application/xml"; | 365 | _request.ContentType = "application/xml"; |
366 | _request.Timeout = 900000; | 366 | _request.Timeout = 30000; |
367 | _request.Method = RequestMethod; | 367 | _request.Method = RequestMethod; |
368 | _asyncException = null; | 368 | _asyncException = null; |
369 | _request.ContentLength = src.Length; | 369 | _request.ContentLength = src.Length; |
diff --git a/OpenSim/Framework/Console/RemoteConsole.cs b/OpenSim/Framework/Console/RemoteConsole.cs index 27edd4b..3e3c2b3 100644 --- a/OpenSim/Framework/Console/RemoteConsole.cs +++ b/OpenSim/Framework/Console/RemoteConsole.cs | |||
@@ -234,7 +234,7 @@ namespace OpenSim.Framework.Console | |||
234 | string uri = "/ReadResponses/" + sessionID.ToString() + "/"; | 234 | string uri = "/ReadResponses/" + sessionID.ToString() + "/"; |
235 | 235 | ||
236 | m_Server.AddPollServiceHTTPHandler( | 236 | m_Server.AddPollServiceHTTPHandler( |
237 | uri, new PollServiceEventArgs(null, HasEvents, GetEvents, NoEvents, sessionID)); | 237 | uri, new PollServiceEventArgs(null, HasEvents, GetEvents, NoEvents, sessionID,25000)); // 25 secs timeout |
238 | 238 | ||
239 | XmlDocument xmldoc = new XmlDocument(); | 239 | XmlDocument xmldoc = new XmlDocument(); |
240 | XmlNode xmlnode = xmldoc.CreateNode(XmlNodeType.XmlDeclaration, | 240 | XmlNode xmlnode = xmldoc.CreateNode(XmlNodeType.XmlDeclaration, |
@@ -425,7 +425,7 @@ namespace OpenSim.Framework.Console | |||
425 | return false; | 425 | return false; |
426 | } | 426 | } |
427 | 427 | ||
428 | private Hashtable GetEvents(UUID RequestID, UUID sessionID, string request) | 428 | private Hashtable GetEvents(UUID RequestID, UUID sessionID) |
429 | { | 429 | { |
430 | ConsoleConnection c = null; | 430 | ConsoleConnection c = null; |
431 | 431 | ||
diff --git a/OpenSim/Framework/EstateSettings.cs b/OpenSim/Framework/EstateSettings.cs index a92abbf..e03750b 100644 --- a/OpenSim/Framework/EstateSettings.cs +++ b/OpenSim/Framework/EstateSettings.cs | |||
@@ -58,6 +58,30 @@ namespace OpenSim.Framework | |||
58 | set { m_EstateName = value; } | 58 | set { m_EstateName = value; } |
59 | } | 59 | } |
60 | 60 | ||
61 | private bool m_AllowLandmark = true; | ||
62 | |||
63 | public bool AllowLandmark | ||
64 | { | ||
65 | get { return m_AllowLandmark; } | ||
66 | set { m_AllowLandmark = value; } | ||
67 | } | ||
68 | |||
69 | private bool m_AllowParcelChanges = true; | ||
70 | |||
71 | public bool AllowParcelChanges | ||
72 | { | ||
73 | get { return m_AllowParcelChanges; } | ||
74 | set { m_AllowParcelChanges = value; } | ||
75 | } | ||
76 | |||
77 | private bool m_AllowSetHome = true; | ||
78 | |||
79 | public bool AllowSetHome | ||
80 | { | ||
81 | get { return m_AllowSetHome; } | ||
82 | set { m_AllowSetHome = value; } | ||
83 | } | ||
84 | |||
61 | private uint m_ParentEstateID = 1; | 85 | private uint m_ParentEstateID = 1; |
62 | 86 | ||
63 | public uint ParentEstateID | 87 | public uint ParentEstateID |
@@ -338,11 +362,30 @@ namespace OpenSim.Framework | |||
338 | return false; | 362 | return false; |
339 | } | 363 | } |
340 | 364 | ||
341 | public bool IsBanned(UUID avatarID) | 365 | public bool IsBanned(UUID avatarID, int userFlags) |
342 | { | 366 | { |
343 | foreach (EstateBan ban in l_EstateBans) | 367 | foreach (EstateBan ban in l_EstateBans) |
344 | if (ban.BannedUserID == avatarID) | 368 | if (ban.BannedUserID == avatarID) |
345 | return true; | 369 | return true; |
370 | |||
371 | if (!IsEstateManagerOrOwner(avatarID) && !HasAccess(avatarID)) | ||
372 | { | ||
373 | if (DenyMinors) | ||
374 | { | ||
375 | if ((userFlags & 32) == 0) | ||
376 | { | ||
377 | return true; | ||
378 | } | ||
379 | } | ||
380 | if (DenyAnonymous) | ||
381 | { | ||
382 | if ((userFlags & 4) == 0) | ||
383 | { | ||
384 | return true; | ||
385 | } | ||
386 | } | ||
387 | } | ||
388 | |||
346 | return false; | 389 | return false; |
347 | } | 390 | } |
348 | 391 | ||
@@ -350,7 +393,7 @@ namespace OpenSim.Framework | |||
350 | { | 393 | { |
351 | if (ban == null) | 394 | if (ban == null) |
352 | return; | 395 | return; |
353 | if (!IsBanned(ban.BannedUserID)) | 396 | if (!IsBanned(ban.BannedUserID, 32)) //Ignore age-based bans |
354 | l_EstateBans.Add(ban); | 397 | l_EstateBans.Add(ban); |
355 | } | 398 | } |
356 | 399 | ||
@@ -374,6 +417,15 @@ namespace OpenSim.Framework | |||
374 | return l_EstateAccess.Contains(user); | 417 | return l_EstateAccess.Contains(user); |
375 | } | 418 | } |
376 | 419 | ||
420 | public void SetFromFlags(ulong regionFlags) | ||
421 | { | ||
422 | ResetHomeOnTeleport = ((regionFlags & (ulong)OpenMetaverse.RegionFlags.ResetHomeOnTeleport) == (ulong)OpenMetaverse.RegionFlags.ResetHomeOnTeleport); | ||
423 | BlockDwell = ((regionFlags & (ulong)OpenMetaverse.RegionFlags.BlockDwell) == (ulong)OpenMetaverse.RegionFlags.BlockDwell); | ||
424 | AllowLandmark = ((regionFlags & (ulong)OpenMetaverse.RegionFlags.AllowLandmark) == (ulong)OpenMetaverse.RegionFlags.AllowLandmark); | ||
425 | AllowParcelChanges = ((regionFlags & (ulong)OpenMetaverse.RegionFlags.AllowParcelChanges) == (ulong)OpenMetaverse.RegionFlags.AllowParcelChanges); | ||
426 | AllowSetHome = ((regionFlags & (ulong)OpenMetaverse.RegionFlags.AllowSetHome) == (ulong)OpenMetaverse.RegionFlags.AllowSetHome); | ||
427 | } | ||
428 | |||
377 | public bool GroupAccess(UUID groupID) | 429 | public bool GroupAccess(UUID groupID) |
378 | { | 430 | { |
379 | return l_EstateGroups.Contains(groupID); | 431 | return l_EstateGroups.Contains(groupID); |
diff --git a/OpenSim/Framework/ExtraPhysicsData.cs b/OpenSim/Framework/ExtraPhysicsData.cs new file mode 100644 index 0000000..9e7334f --- /dev/null +++ b/OpenSim/Framework/ExtraPhysicsData.cs | |||
@@ -0,0 +1,50 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using OpenMetaverse; | ||
29 | |||
30 | namespace OpenSim.Framework | ||
31 | { | ||
32 | public enum PhysShapeType : byte | ||
33 | { | ||
34 | prim = 0, | ||
35 | none = 1, | ||
36 | convex = 2, | ||
37 | |||
38 | invalid = 255 // use to mark invalid data in ExtraPhysicsData | ||
39 | } | ||
40 | |||
41 | public struct ExtraPhysicsData | ||
42 | { | ||
43 | public float Density; | ||
44 | public float GravitationModifier; | ||
45 | public float Friction; | ||
46 | public float Bounce; | ||
47 | public PhysShapeType PhysShapeType; | ||
48 | |||
49 | } | ||
50 | } | ||
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 9856978..e95149d 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs | |||
@@ -70,6 +70,8 @@ namespace OpenSim.Framework | |||
70 | 70 | ||
71 | public delegate void StopAnim(IClientAPI remoteClient, UUID animID); | 71 | public delegate void StopAnim(IClientAPI remoteClient, UUID animID); |
72 | 72 | ||
73 | public delegate void ChangeAnim(UUID animID, bool addOrRemove, bool sendPack); | ||
74 | |||
73 | public delegate void LinkObjects(IClientAPI remoteClient, uint parent, List<uint> children); | 75 | public delegate void LinkObjects(IClientAPI remoteClient, uint parent, List<uint> children); |
74 | 76 | ||
75 | public delegate void DelinkObjects(List<uint> primIds, IClientAPI client); | 77 | public delegate void DelinkObjects(List<uint> primIds, IClientAPI client); |
@@ -124,12 +126,14 @@ namespace OpenSim.Framework | |||
124 | public delegate void ObjectDrop(uint localID, IClientAPI remoteClient); | 126 | public delegate void ObjectDrop(uint localID, IClientAPI remoteClient); |
125 | 127 | ||
126 | public delegate void UpdatePrimFlags( | 128 | public delegate void UpdatePrimFlags( |
127 | uint localID, bool UsePhysics, bool IsTemporary, bool IsPhantom, IClientAPI remoteClient); | 129 | uint localID, bool UsePhysics, bool IsTemporary, bool IsPhantom, ExtraPhysicsData PhysData, IClientAPI remoteClient); |
128 | 130 | ||
129 | public delegate void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient); | 131 | public delegate void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient); |
130 | 132 | ||
131 | public delegate void UpdateVector(uint localID, Vector3 pos, IClientAPI remoteClient); | 133 | public delegate void UpdateVector(uint localID, Vector3 pos, IClientAPI remoteClient); |
132 | 134 | ||
135 | public delegate void ClientChangeObject(uint localID, object data ,IClientAPI remoteClient); | ||
136 | |||
133 | public delegate void UpdatePrimRotation(uint localID, Quaternion rot, IClientAPI remoteClient); | 137 | public delegate void UpdatePrimRotation(uint localID, Quaternion rot, IClientAPI remoteClient); |
134 | 138 | ||
135 | public delegate void UpdatePrimSingleRotation(uint localID, Quaternion rot, IClientAPI remoteClient); | 139 | public delegate void UpdatePrimSingleRotation(uint localID, Quaternion rot, IClientAPI remoteClient); |
@@ -266,6 +270,9 @@ namespace OpenSim.Framework | |||
266 | public delegate void MoveInventoryItem( | 270 | public delegate void MoveInventoryItem( |
267 | IClientAPI remoteClient, List<InventoryItemBase> items); | 271 | IClientAPI remoteClient, List<InventoryItemBase> items); |
268 | 272 | ||
273 | public delegate void MoveItemsAndLeaveCopy( | ||
274 | IClientAPI remoteClient, List<InventoryItemBase> items, UUID destFolder); | ||
275 | |||
269 | public delegate void RemoveInventoryItem( | 276 | public delegate void RemoveInventoryItem( |
270 | IClientAPI remoteClient, List<UUID> itemIDs); | 277 | IClientAPI remoteClient, List<UUID> itemIDs); |
271 | 278 | ||
@@ -441,6 +448,7 @@ namespace OpenSim.Framework | |||
441 | public delegate void ClassifiedInfoRequest(UUID classifiedID, IClientAPI client); | 448 | public delegate void ClassifiedInfoRequest(UUID classifiedID, IClientAPI client); |
442 | public delegate void ClassifiedInfoUpdate(UUID classifiedID, uint category, string name, string description, UUID parcelID, uint parentEstate, UUID snapshotID, Vector3 globalPos, byte classifiedFlags, int price, IClientAPI client); | 449 | public delegate void ClassifiedInfoUpdate(UUID classifiedID, uint category, string name, string description, UUID parcelID, uint parentEstate, UUID snapshotID, Vector3 globalPos, byte classifiedFlags, int price, IClientAPI client); |
443 | public delegate void ClassifiedDelete(UUID classifiedID, IClientAPI client); | 450 | public delegate void ClassifiedDelete(UUID classifiedID, IClientAPI client); |
451 | public delegate void ClassifiedGodDelete(UUID classifiedID, UUID queryID, IClientAPI client); | ||
444 | 452 | ||
445 | public delegate void EventNotificationAddRequest(uint EventID, IClientAPI client); | 453 | public delegate void EventNotificationAddRequest(uint EventID, IClientAPI client); |
446 | public delegate void EventNotificationRemoveRequest(uint EventID, IClientAPI client); | 454 | public delegate void EventNotificationRemoveRequest(uint EventID, IClientAPI client); |
@@ -463,9 +471,9 @@ namespace OpenSim.Framework | |||
463 | 471 | ||
464 | public delegate void AgentFOV(IClientAPI client, float verticalAngle); | 472 | public delegate void AgentFOV(IClientAPI client, float verticalAngle); |
465 | 473 | ||
466 | public delegate void MuteListEntryUpdate(IClientAPI client, UUID MuteID, string Name, int Flags,UUID AgentID); | 474 | public delegate void MuteListEntryUpdate(IClientAPI client, UUID MuteID, string Name, int type, uint flags); |
467 | 475 | ||
468 | public delegate void MuteListEntryRemove(IClientAPI client, UUID MuteID, string Name, UUID AgentID); | 476 | public delegate void MuteListEntryRemove(IClientAPI client, UUID MuteID, string Name); |
469 | 477 | ||
470 | public delegate void AvatarInterestReply(IClientAPI client,UUID target, uint wantmask, string wanttext, uint skillsmask, string skillstext, string languages); | 478 | public delegate void AvatarInterestReply(IClientAPI client,UUID target, uint wantmask, string wanttext, uint skillsmask, string skillstext, string languages); |
471 | 479 | ||
@@ -503,6 +511,7 @@ namespace OpenSim.Framework | |||
503 | public delegate void SimWideDeletesDelegate(IClientAPI client,UUID agentID, int flags, UUID targetID); | 511 | public delegate void SimWideDeletesDelegate(IClientAPI client,UUID agentID, int flags, UUID targetID); |
504 | 512 | ||
505 | public delegate void SendPostcard(IClientAPI client); | 513 | public delegate void SendPostcard(IClientAPI client); |
514 | public delegate void ChangeInventoryItemFlags(IClientAPI client, UUID itemID, uint flags); | ||
506 | 515 | ||
507 | #endregion | 516 | #endregion |
508 | 517 | ||
@@ -791,6 +800,7 @@ namespace OpenSim.Framework | |||
791 | event ObjectDrop OnObjectDrop; | 800 | event ObjectDrop OnObjectDrop; |
792 | event StartAnim OnStartAnim; | 801 | event StartAnim OnStartAnim; |
793 | event StopAnim OnStopAnim; | 802 | event StopAnim OnStopAnim; |
803 | event ChangeAnim OnChangeAnim; | ||
794 | event LinkObjects OnLinkObjects; | 804 | event LinkObjects OnLinkObjects; |
795 | event DelinkObjects OnDelinkObjects; | 805 | event DelinkObjects OnDelinkObjects; |
796 | event RequestMapBlocks OnRequestMapBlocks; | 806 | event RequestMapBlocks OnRequestMapBlocks; |
@@ -855,6 +865,7 @@ namespace OpenSim.Framework | |||
855 | event RequestObjectPropertiesFamily OnRequestObjectPropertiesFamily; | 865 | event RequestObjectPropertiesFamily OnRequestObjectPropertiesFamily; |
856 | event UpdatePrimFlags OnUpdatePrimFlags; | 866 | event UpdatePrimFlags OnUpdatePrimFlags; |
857 | event UpdatePrimTexture OnUpdatePrimTexture; | 867 | event UpdatePrimTexture OnUpdatePrimTexture; |
868 | event ClientChangeObject onClientChangeObject; | ||
858 | event UpdateVector OnUpdatePrimGroupPosition; | 869 | event UpdateVector OnUpdatePrimGroupPosition; |
859 | event UpdateVector OnUpdatePrimSinglePosition; | 870 | event UpdateVector OnUpdatePrimSinglePosition; |
860 | event UpdatePrimRotation OnUpdatePrimGroupRotation; | 871 | event UpdatePrimRotation OnUpdatePrimGroupRotation; |
@@ -879,6 +890,7 @@ namespace OpenSim.Framework | |||
879 | event RequestTaskInventory OnRequestTaskInventory; | 890 | event RequestTaskInventory OnRequestTaskInventory; |
880 | event UpdateInventoryItem OnUpdateInventoryItem; | 891 | event UpdateInventoryItem OnUpdateInventoryItem; |
881 | event CopyInventoryItem OnCopyInventoryItem; | 892 | event CopyInventoryItem OnCopyInventoryItem; |
893 | event MoveItemsAndLeaveCopy OnMoveItemsAndLeaveCopy; | ||
882 | event MoveInventoryItem OnMoveInventoryItem; | 894 | event MoveInventoryItem OnMoveInventoryItem; |
883 | event RemoveInventoryFolder OnRemoveInventoryFolder; | 895 | event RemoveInventoryFolder OnRemoveInventoryFolder; |
884 | event RemoveInventoryItem OnRemoveInventoryItem; | 896 | event RemoveInventoryItem OnRemoveInventoryItem; |
@@ -997,7 +1009,7 @@ namespace OpenSim.Framework | |||
997 | event ClassifiedInfoRequest OnClassifiedInfoRequest; | 1009 | event ClassifiedInfoRequest OnClassifiedInfoRequest; |
998 | event ClassifiedInfoUpdate OnClassifiedInfoUpdate; | 1010 | event ClassifiedInfoUpdate OnClassifiedInfoUpdate; |
999 | event ClassifiedDelete OnClassifiedDelete; | 1011 | event ClassifiedDelete OnClassifiedDelete; |
1000 | event ClassifiedDelete OnClassifiedGodDelete; | 1012 | event ClassifiedGodDelete OnClassifiedGodDelete; |
1001 | 1013 | ||
1002 | event EventNotificationAddRequest OnEventNotificationAddRequest; | 1014 | event EventNotificationAddRequest OnEventNotificationAddRequest; |
1003 | event EventNotificationRemoveRequest OnEventNotificationRemoveRequest; | 1015 | event EventNotificationRemoveRequest OnEventNotificationRemoveRequest; |
@@ -1036,6 +1048,7 @@ namespace OpenSim.Framework | |||
1036 | event GroupVoteHistoryRequest OnGroupVoteHistoryRequest; | 1048 | event GroupVoteHistoryRequest OnGroupVoteHistoryRequest; |
1037 | event SimWideDeletesDelegate OnSimWideDeletes; | 1049 | event SimWideDeletesDelegate OnSimWideDeletes; |
1038 | event SendPostcard OnSendPostcard; | 1050 | event SendPostcard OnSendPostcard; |
1051 | event ChangeInventoryItemFlags OnChangeInventoryItemFlags; | ||
1039 | event MuteListEntryUpdate OnUpdateMuteListEntry; | 1052 | event MuteListEntryUpdate OnUpdateMuteListEntry; |
1040 | event MuteListEntryRemove OnRemoveMuteListEntry; | 1053 | event MuteListEntryRemove OnRemoveMuteListEntry; |
1041 | event GodlikeMessage onGodlikeMessage; | 1054 | event GodlikeMessage onGodlikeMessage; |
@@ -1061,7 +1074,7 @@ namespace OpenSim.Framework | |||
1061 | /// If true, attempts the close without checking active status. You do not want to try this except as a last | 1074 | /// If true, attempts the close without checking active status. You do not want to try this except as a last |
1062 | /// ditch attempt where Active == false but the ScenePresence still exists. | 1075 | /// ditch attempt where Active == false but the ScenePresence still exists. |
1063 | /// </param> | 1076 | /// </param> |
1064 | void Close(bool force); | 1077 | void Close(bool sendStop, bool force); |
1065 | 1078 | ||
1066 | void Kick(string message); | 1079 | void Kick(string message); |
1067 | 1080 | ||
@@ -1173,6 +1186,7 @@ namespace OpenSim.Framework | |||
1173 | /// </summary> | 1186 | /// </summary> |
1174 | /// <param name="Item"></param> | 1187 | /// <param name="Item"></param> |
1175 | void SendInventoryItemCreateUpdate(InventoryItemBase Item, uint callbackId); | 1188 | void SendInventoryItemCreateUpdate(InventoryItemBase Item, uint callbackId); |
1189 | void SendInventoryItemCreateUpdate(InventoryItemBase Item, UUID transactionID, uint callbackId); | ||
1176 | 1190 | ||
1177 | void SendRemoveInventoryItem(UUID itemID); | 1191 | void SendRemoveInventoryItem(UUID itemID); |
1178 | 1192 | ||
@@ -1192,7 +1206,7 @@ namespace OpenSim.Framework | |||
1192 | /// <param name="node"></param> | 1206 | /// <param name="node"></param> |
1193 | void SendBulkUpdateInventory(InventoryNodeBase node); | 1207 | void SendBulkUpdateInventory(InventoryNodeBase node); |
1194 | 1208 | ||
1195 | void SendXferPacket(ulong xferID, uint packet, byte[] data); | 1209 | void SendXferPacket(ulong xferID, uint packet, byte[] data, bool isTaskInventory); |
1196 | 1210 | ||
1197 | void SendAbortXferPacket(ulong xferID); | 1211 | void SendAbortXferPacket(ulong xferID); |
1198 | 1212 | ||
@@ -1344,6 +1358,8 @@ namespace OpenSim.Framework | |||
1344 | 1358 | ||
1345 | void SendObjectPropertiesReply(ISceneEntity Entity); | 1359 | void SendObjectPropertiesReply(ISceneEntity Entity); |
1346 | 1360 | ||
1361 | void SendPartPhysicsProprieties(ISceneEntity Entity); | ||
1362 | |||
1347 | void SendAgentOffline(UUID[] agentIDs); | 1363 | void SendAgentOffline(UUID[] agentIDs); |
1348 | 1364 | ||
1349 | void SendAgentOnline(UUID[] agentIDs); | 1365 | void SendAgentOnline(UUID[] agentIDs); |
diff --git a/OpenSim/Framework/IMoneyModule.cs b/OpenSim/Framework/IMoneyModule.cs index 1e09728..71de93a 100644 --- a/OpenSim/Framework/IMoneyModule.cs +++ b/OpenSim/Framework/IMoneyModule.cs | |||
@@ -40,6 +40,7 @@ namespace OpenSim.Framework | |||
40 | bool AmountCovered(UUID agentID, int amount); | 40 | bool AmountCovered(UUID agentID, int amount); |
41 | void ApplyCharge(UUID agentID, int amount, string text); | 41 | void ApplyCharge(UUID agentID, int amount, string text); |
42 | void ApplyUploadCharge(UUID agentID, int amount, string text); | 42 | void ApplyUploadCharge(UUID agentID, int amount, string text); |
43 | void MoveMoney(UUID fromUser, UUID toUser, int amount, string text); | ||
43 | 44 | ||
44 | int UploadCharge { get; } | 45 | int UploadCharge { get; } |
45 | int GroupCreationCharge { get; } | 46 | int GroupCreationCharge { get; } |
diff --git a/OpenSim/Framework/LandData.cs b/OpenSim/Framework/LandData.cs index bf2ecf2..dcaa46d 100644 --- a/OpenSim/Framework/LandData.cs +++ b/OpenSim/Framework/LandData.cs | |||
@@ -67,7 +67,7 @@ namespace OpenSim.Framework | |||
67 | 67 | ||
68 | private uint _flags = (uint) ParcelFlags.AllowFly | (uint) ParcelFlags.AllowLandmark | | 68 | private uint _flags = (uint) ParcelFlags.AllowFly | (uint) ParcelFlags.AllowLandmark | |
69 | (uint) ParcelFlags.AllowAPrimitiveEntry | | 69 | (uint) ParcelFlags.AllowAPrimitiveEntry | |
70 | (uint) ParcelFlags.AllowDeedToGroup | (uint) ParcelFlags.AllowTerraform | | 70 | (uint) ParcelFlags.AllowDeedToGroup | |
71 | (uint) ParcelFlags.CreateObjects | (uint) ParcelFlags.AllowOtherScripts | | 71 | (uint) ParcelFlags.CreateObjects | (uint) ParcelFlags.AllowOtherScripts | |
72 | (uint) ParcelFlags.SoundLocal | (uint) ParcelFlags.AllowVoiceChat; | 72 | (uint) ParcelFlags.SoundLocal | (uint) ParcelFlags.AllowVoiceChat; |
73 | 73 | ||
diff --git a/OpenSim/Framework/Monitoring/BaseStatsCollector.cs b/OpenSim/Framework/Monitoring/BaseStatsCollector.cs index 2903b6e..446e3c0 100644 --- a/OpenSim/Framework/Monitoring/BaseStatsCollector.cs +++ b/OpenSim/Framework/Monitoring/BaseStatsCollector.cs | |||
@@ -43,10 +43,9 @@ namespace OpenSim.Framework.Monitoring | |||
43 | StringBuilder sb = new StringBuilder(Environment.NewLine); | 43 | StringBuilder sb = new StringBuilder(Environment.NewLine); |
44 | sb.Append("MEMORY STATISTICS"); | 44 | sb.Append("MEMORY STATISTICS"); |
45 | sb.Append(Environment.NewLine); | 45 | sb.Append(Environment.NewLine); |
46 | |||
47 | sb.AppendFormat( | 46 | sb.AppendFormat( |
48 | "Allocated to OpenSim objects: {0} MB\n", | 47 | "Allocated to OpenSim objects: {0} MB\n", |
49 | Math.Round(GC.GetTotalMemory(false) / 1024.0 / 1024.0)); | 48 | Math.Round(GC.GetTotalMemory(false) / 1024.0 / 1024.0)); |
50 | 49 | ||
51 | sb.AppendFormat( | 50 | sb.AppendFormat( |
52 | "OpenSim last object memory churn : {0} MB/s\n", | 51 | "OpenSim last object memory churn : {0} MB/s\n", |
@@ -56,9 +55,23 @@ namespace OpenSim.Framework.Monitoring | |||
56 | "OpenSim average object memory churn : {0} MB/s\n", | 55 | "OpenSim average object memory churn : {0} MB/s\n", |
57 | Math.Round((MemoryWatchdog.AverageMemoryChurn * 1000) / 1024.0 / 1024, 3)); | 56 | Math.Round((MemoryWatchdog.AverageMemoryChurn * 1000) / 1024.0 / 1024, 3)); |
58 | 57 | ||
59 | sb.AppendFormat( | 58 | Process myprocess = Process.GetCurrentProcess(); |
60 | "Process memory : {0} MB\n", | 59 | if (!myprocess.HasExited) |
61 | Math.Round(Process.GetCurrentProcess().WorkingSet64 / 1024.0 / 1024.0)); | 60 | { |
61 | myprocess.Refresh(); | ||
62 | sb.AppendFormat( | ||
63 | "Process memory: Physical {0} MB \t Paged {1} MB \t Virtual {2} MB\n", | ||
64 | Math.Round(Process.GetCurrentProcess().WorkingSet64 / 1024.0 / 1024.0), | ||
65 | Math.Round(Process.GetCurrentProcess().PagedMemorySize64 / 1024.0 / 1024.0), | ||
66 | Math.Round(Process.GetCurrentProcess().VirtualMemorySize64 / 1024.0 / 1024.0)); | ||
67 | sb.AppendFormat( | ||
68 | "Peak process memory: Physical {0} MB \t Paged {1} MB \t Virtual {2} MB\n", | ||
69 | Math.Round(Process.GetCurrentProcess().PeakWorkingSet64 / 1024.0 / 1024.0), | ||
70 | Math.Round(Process.GetCurrentProcess().PeakPagedMemorySize64 / 1024.0 / 1024.0), | ||
71 | Math.Round(Process.GetCurrentProcess().PeakVirtualMemorySize64 / 1024.0 / 1024.0)); | ||
72 | } | ||
73 | else | ||
74 | sb.Append("Process reported as Exited \n"); | ||
62 | 75 | ||
63 | return sb.ToString(); | 76 | return sb.ToString(); |
64 | } | 77 | } |
diff --git a/OpenSim/Framework/Monitoring/Watchdog.cs b/OpenSim/Framework/Monitoring/Watchdog.cs index a20326d..28d6d5c 100644 --- a/OpenSim/Framework/Monitoring/Watchdog.cs +++ b/OpenSim/Framework/Monitoring/Watchdog.cs | |||
@@ -383,4 +383,4 @@ namespace OpenSim.Framework.Monitoring | |||
383 | m_watchdogTimer.Start(); | 383 | m_watchdogTimer.Start(); |
384 | } | 384 | } |
385 | } | 385 | } |
386 | } \ No newline at end of file | 386 | } |
diff --git a/OpenSim/Framework/OSChatMessage.cs b/OpenSim/Framework/OSChatMessage.cs index 455756d..7450be2 100644 --- a/OpenSim/Framework/OSChatMessage.cs +++ b/OpenSim/Framework/OSChatMessage.cs | |||
@@ -51,12 +51,11 @@ namespace OpenSim.Framework | |||
51 | protected object m_senderObject; | 51 | protected object m_senderObject; |
52 | protected ChatTypeEnum m_type; | 52 | protected ChatTypeEnum m_type; |
53 | protected UUID m_fromID; | 53 | protected UUID m_fromID; |
54 | protected UUID m_toID; | 54 | protected UUID m_destination = UUID.Zero; |
55 | 55 | ||
56 | public OSChatMessage() | 56 | public OSChatMessage() |
57 | { | 57 | { |
58 | m_position = new Vector3(); | 58 | m_position = new Vector3(); |
59 | m_toID = UUID.Zero; | ||
60 | } | 59 | } |
61 | 60 | ||
62 | /// <summary> | 61 | /// <summary> |
@@ -104,15 +103,6 @@ namespace OpenSim.Framework | |||
104 | set { m_from = value; } | 103 | set { m_from = value; } |
105 | } | 104 | } |
106 | 105 | ||
107 | /// <summary> | ||
108 | /// The name of the sender (needed for scripts) | ||
109 | /// </summary> | ||
110 | public string To | ||
111 | { | ||
112 | get { return m_from; } | ||
113 | set { m_from = value; } | ||
114 | } | ||
115 | |||
116 | #region IEventArgs Members | 106 | #region IEventArgs Members |
117 | 107 | ||
118 | /// TODO: Sender and SenderObject should just be Sender and of | 108 | /// TODO: Sender and SenderObject should just be Sender and of |
@@ -142,13 +132,10 @@ namespace OpenSim.Framework | |||
142 | set { m_fromID = value; } | 132 | set { m_fromID = value; } |
143 | } | 133 | } |
144 | 134 | ||
145 | /// <summary> | 135 | public UUID Destination |
146 | /// The single recipient or all if not set. | ||
147 | /// </summary> | ||
148 | public UUID TargetUUID | ||
149 | { | 136 | { |
150 | get { return m_toID; } | 137 | get { return m_destination; } |
151 | set { m_toID = value; } | 138 | set { m_destination = value; } |
152 | } | 139 | } |
153 | 140 | ||
154 | /// <summary> | 141 | /// <summary> |
diff --git a/OpenSim/Framework/ObjectChangeData.cs b/OpenSim/Framework/ObjectChangeData.cs new file mode 100644 index 0000000..8d56291 --- /dev/null +++ b/OpenSim/Framework/ObjectChangeData.cs | |||
@@ -0,0 +1,80 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using OpenMetaverse; | ||
29 | |||
30 | namespace OpenSim.Framework | ||
31 | { | ||
32 | public enum ObjectChangeType : uint | ||
33 | { | ||
34 | // bits definitions | ||
35 | Position = 0x01, | ||
36 | Rotation = 0x02, | ||
37 | Scale = 0x04, | ||
38 | Group = 0x08, | ||
39 | UniformScale = 0x10, | ||
40 | |||
41 | // macros from above | ||
42 | // single prim | ||
43 | primP = 0x01, | ||
44 | primR = 0x02, | ||
45 | primPR = 0x03, | ||
46 | primS = 0x04, | ||
47 | primPS = 0x05, | ||
48 | primRS = 0x06, | ||
49 | primPSR = 0x07, | ||
50 | |||
51 | primUS = 0x14, | ||
52 | primPUS = 0x15, | ||
53 | primRUS = 0x16, | ||
54 | primPUSR = 0x17, | ||
55 | |||
56 | // group | ||
57 | groupP = 0x09, | ||
58 | groupR = 0x0A, | ||
59 | groupPR = 0x0B, | ||
60 | groupS = 0x0C, | ||
61 | groupPS = 0x0D, | ||
62 | groupRS = 0x0E, | ||
63 | groupPSR = 0x0F, | ||
64 | |||
65 | groupUS = 0x1C, | ||
66 | groupPUS = 0x1D, | ||
67 | groupRUS = 0x1E, | ||
68 | groupPUSR = 0x1F, | ||
69 | |||
70 | PRSmask = 0x07 | ||
71 | } | ||
72 | |||
73 | public struct ObjectChangeData | ||
74 | { | ||
75 | public Quaternion rotation; | ||
76 | public Vector3 position; | ||
77 | public Vector3 scale; | ||
78 | public ObjectChangeType change; | ||
79 | } | ||
80 | } | ||
diff --git a/OpenSim/Framework/ParcelMediaCommandEnum.cs b/OpenSim/Framework/ParcelMediaCommandEnum.cs index 93c41ec..e714382 100644 --- a/OpenSim/Framework/ParcelMediaCommandEnum.cs +++ b/OpenSim/Framework/ParcelMediaCommandEnum.cs | |||
@@ -27,7 +27,7 @@ | |||
27 | 27 | ||
28 | namespace OpenSim.Framework | 28 | namespace OpenSim.Framework |
29 | { | 29 | { |
30 | public enum ParcelMediaCommandEnum | 30 | public enum ParcelMediaCommandEnum : int |
31 | { | 31 | { |
32 | Stop = 0, | 32 | Stop = 0, |
33 | Pause = 1, | 33 | Pause = 1, |
diff --git a/OpenSim/Framework/PluginLoader.cs b/OpenSim/Framework/PluginLoader.cs index 819cb7b..cc80943 100644 --- a/OpenSim/Framework/PluginLoader.cs +++ b/OpenSim/Framework/PluginLoader.cs | |||
@@ -244,13 +244,22 @@ namespace OpenSim.Framework | |||
244 | // The Mono addin manager (in Mono.Addins.dll version 0.2.0.0) | 244 | // The Mono addin manager (in Mono.Addins.dll version 0.2.0.0) |
245 | // occasionally seems to corrupt its addin cache | 245 | // occasionally seems to corrupt its addin cache |
246 | // Hence, as a temporary solution we'll remove it before each startup | 246 | // Hence, as a temporary solution we'll remove it before each startup |
247 | |||
248 | string customDir = Environment.GetEnvironmentVariable ("MONO_ADDINS_REGISTRY"); | ||
249 | string v0 = "addin-db-000"; | ||
250 | string v1 = "addin-db-001"; | ||
251 | if (customDir != null && customDir != String.Empty) | ||
252 | { | ||
253 | v0 = Path.Combine(customDir, v0); | ||
254 | v1 = Path.Combine(customDir, v1); | ||
255 | } | ||
247 | try | 256 | try |
248 | { | 257 | { |
249 | if (Directory.Exists("addin-db-000")) | 258 | if (Directory.Exists(v0)) |
250 | Directory.Delete("addin-db-000", true); | 259 | Directory.Delete(v0, true); |
251 | 260 | ||
252 | if (Directory.Exists("addin-db-001")) | 261 | if (Directory.Exists(v1)) |
253 | Directory.Delete("addin-db-001", true); | 262 | Directory.Delete(v1, true); |
254 | } | 263 | } |
255 | catch (IOException) | 264 | catch (IOException) |
256 | { | 265 | { |
diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs index 76dcfca..fcc9873 100644 --- a/OpenSim/Framework/PrimitiveBaseShape.cs +++ b/OpenSim/Framework/PrimitiveBaseShape.cs | |||
@@ -724,7 +724,12 @@ namespace OpenSim.Framework | |||
724 | return _lightColorR; | 724 | return _lightColorR; |
725 | } | 725 | } |
726 | set { | 726 | set { |
727 | _lightColorR = value; | 727 | if (value < 0) |
728 | _lightColorR = 0; | ||
729 | else if (value > 1.0f) | ||
730 | _lightColorR = 1.0f; | ||
731 | else | ||
732 | _lightColorR = value; | ||
728 | } | 733 | } |
729 | } | 734 | } |
730 | 735 | ||
@@ -733,7 +738,12 @@ namespace OpenSim.Framework | |||
733 | return _lightColorG; | 738 | return _lightColorG; |
734 | } | 739 | } |
735 | set { | 740 | set { |
736 | _lightColorG = value; | 741 | if (value < 0) |
742 | _lightColorG = 0; | ||
743 | else if (value > 1.0f) | ||
744 | _lightColorG = 1.0f; | ||
745 | else | ||
746 | _lightColorG = value; | ||
737 | } | 747 | } |
738 | } | 748 | } |
739 | 749 | ||
@@ -742,7 +752,12 @@ namespace OpenSim.Framework | |||
742 | return _lightColorB; | 752 | return _lightColorB; |
743 | } | 753 | } |
744 | set { | 754 | set { |
745 | _lightColorB = value; | 755 | if (value < 0) |
756 | _lightColorB = 0; | ||
757 | else if (value > 1.0f) | ||
758 | _lightColorB = 1.0f; | ||
759 | else | ||
760 | _lightColorB = value; | ||
746 | } | 761 | } |
747 | } | 762 | } |
748 | 763 | ||
@@ -751,7 +766,12 @@ namespace OpenSim.Framework | |||
751 | return _lightColorA; | 766 | return _lightColorA; |
752 | } | 767 | } |
753 | set { | 768 | set { |
754 | _lightColorA = value; | 769 | if (value < 0) |
770 | _lightColorA = 0; | ||
771 | else if (value > 1.0f) | ||
772 | _lightColorA = 1.0f; | ||
773 | else | ||
774 | _lightColorA = value; | ||
755 | } | 775 | } |
756 | } | 776 | } |
757 | 777 | ||
@@ -865,6 +885,11 @@ namespace OpenSim.Framework | |||
865 | 885 | ||
866 | public ulong GetMeshKey(Vector3 size, float lod) | 886 | public ulong GetMeshKey(Vector3 size, float lod) |
867 | { | 887 | { |
888 | return GetMeshKey(size, lod, false); | ||
889 | } | ||
890 | |||
891 | public ulong GetMeshKey(Vector3 size, float lod, bool convex) | ||
892 | { | ||
868 | ulong hash = 5381; | 893 | ulong hash = 5381; |
869 | 894 | ||
870 | hash = djb2(hash, this.PathCurve); | 895 | hash = djb2(hash, this.PathCurve); |
@@ -910,6 +935,9 @@ namespace OpenSim.Framework | |||
910 | hash = djb2(hash, scaleBytes[i]); | 935 | hash = djb2(hash, scaleBytes[i]); |
911 | } | 936 | } |
912 | 937 | ||
938 | if(convex) | ||
939 | hash = djb2(hash, 0xa5); | ||
940 | |||
913 | return hash; | 941 | return hash; |
914 | } | 942 | } |
915 | 943 | ||
@@ -1414,7 +1442,7 @@ namespace OpenSim.Framework | |||
1414 | prim.Textures = this.Textures; | 1442 | prim.Textures = this.Textures; |
1415 | 1443 | ||
1416 | prim.Properties = new Primitive.ObjectProperties(); | 1444 | prim.Properties = new Primitive.ObjectProperties(); |
1417 | prim.Properties.Name = "Primitive"; | 1445 | prim.Properties.Name = "Object"; |
1418 | prim.Properties.Description = ""; | 1446 | prim.Properties.Description = ""; |
1419 | prim.Properties.CreatorID = UUID.Zero; | 1447 | prim.Properties.CreatorID = UUID.Zero; |
1420 | prim.Properties.GroupID = UUID.Zero; | 1448 | prim.Properties.GroupID = UUID.Zero; |
diff --git a/OpenSim/Framework/PriorityQueue.cs b/OpenSim/Framework/PriorityQueue.cs index e7a7f7f..e4f1111 100644 --- a/OpenSim/Framework/PriorityQueue.cs +++ b/OpenSim/Framework/PriorityQueue.cs | |||
@@ -45,7 +45,8 @@ namespace OpenSim.Framework | |||
45 | /// <summary> | 45 | /// <summary> |
46 | /// Total number of queues (priorities) available | 46 | /// Total number of queues (priorities) available |
47 | /// </summary> | 47 | /// </summary> |
48 | public const uint NumberOfQueues = 12; | 48 | |
49 | public const uint NumberOfQueues = 12; // includes immediate queues, m_queueCounts need to be set acording | ||
49 | 50 | ||
50 | /// <summary> | 51 | /// <summary> |
51 | /// Number of queuest (priorities) that are processed immediately | 52 | /// Number of queuest (priorities) that are processed immediately |
@@ -60,7 +61,8 @@ namespace OpenSim.Framework | |||
60 | // each pass. weighted towards the higher priority queues | 61 | // each pass. weighted towards the higher priority queues |
61 | private uint m_nextQueue = 0; | 62 | private uint m_nextQueue = 0; |
62 | private uint m_countFromQueue = 0; | 63 | private uint m_countFromQueue = 0; |
63 | private uint[] m_queueCounts = { 8, 4, 4, 2, 2, 2, 2, 1, 1, 1, 1, 1 }; | 64 | // first queues are imediate, so no counts |
65 | private uint[] m_queueCounts = {0, 0, 8, 4, 4, 2, 2, 2, 2, 1, 1, 1}; | ||
64 | 66 | ||
65 | // next request is a counter of the number of updates queued, it provides | 67 | // next request is a counter of the number of updates queued, it provides |
66 | // a total ordering on the updates coming through the queue and is more | 68 | // a total ordering on the updates coming through the queue and is more |
@@ -137,7 +139,7 @@ namespace OpenSim.Framework | |||
137 | /// </summary> | 139 | /// </summary> |
138 | public bool TryDequeue(out IEntityUpdate value, out Int32 timeinqueue) | 140 | public bool TryDequeue(out IEntityUpdate value, out Int32 timeinqueue) |
139 | { | 141 | { |
140 | // If there is anything in priority queue 0, return it first no | 142 | // If there is anything in imediate queues, return it first no |
141 | // matter what else. Breaks fairness. But very useful. | 143 | // matter what else. Breaks fairness. But very useful. |
142 | for (int iq = 0; iq < NumberOfImmediateQueues; iq++) | 144 | for (int iq = 0; iq < NumberOfImmediateQueues; iq++) |
143 | { | 145 | { |
@@ -172,14 +174,13 @@ namespace OpenSim.Framework | |||
172 | } | 174 | } |
173 | 175 | ||
174 | // Find the next non-immediate queue with updates in it | 176 | // Find the next non-immediate queue with updates in it |
175 | for (int i = 0; i < NumberOfQueues; ++i) | 177 | for (uint i = NumberOfImmediateQueues; i < NumberOfQueues; ++i) |
176 | { | 178 | { |
177 | m_nextQueue = (uint)((m_nextQueue + 1) % NumberOfQueues); | 179 | m_nextQueue++; |
178 | m_countFromQueue = m_queueCounts[m_nextQueue]; | 180 | if(m_nextQueue >= NumberOfQueues) |
181 | m_nextQueue = NumberOfImmediateQueues; | ||
179 | 182 | ||
180 | // if this is one of the immediate queues, just skip it | 183 | m_countFromQueue = m_queueCounts[m_nextQueue]; |
181 | if (m_nextQueue < NumberOfImmediateQueues) | ||
182 | continue; | ||
183 | 184 | ||
184 | if (m_heaps[m_nextQueue].Count > 0) | 185 | if (m_heaps[m_nextQueue].Count > 0) |
185 | { | 186 | { |
@@ -189,7 +190,6 @@ namespace OpenSim.Framework | |||
189 | m_lookupTable.Remove(item.Value.Entity.LocalId); | 190 | m_lookupTable.Remove(item.Value.Entity.LocalId); |
190 | timeinqueue = Util.EnvironmentTickCountSubtract(item.EntryTime); | 191 | timeinqueue = Util.EnvironmentTickCountSubtract(item.EntryTime); |
191 | value = item.Value; | 192 | value = item.Value; |
192 | |||
193 | return true; | 193 | return true; |
194 | } | 194 | } |
195 | } | 195 | } |
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 016f2a6..e7bed6a 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs | |||
@@ -40,6 +40,7 @@ using OpenMetaverse.StructuredData; | |||
40 | 40 | ||
41 | namespace OpenSim.Framework | 41 | namespace OpenSim.Framework |
42 | { | 42 | { |
43 | [Serializable] | ||
43 | public class RegionLightShareData : ICloneable | 44 | public class RegionLightShareData : ICloneable |
44 | { | 45 | { |
45 | public bool valid = false; | 46 | public bool valid = false; |
@@ -102,6 +103,7 @@ namespace OpenSim.Framework | |||
102 | 103 | ||
103 | public bool commFailTF = false; | 104 | public bool commFailTF = false; |
104 | public ConfigurationMember configMember; | 105 | public ConfigurationMember configMember; |
106 | public string DataStore = String.Empty; | ||
105 | public string RegionFile = String.Empty; | 107 | public string RegionFile = String.Empty; |
106 | public bool isSandbox = false; | 108 | public bool isSandbox = false; |
107 | public bool Persistent = true; | 109 | public bool Persistent = true; |
@@ -694,6 +696,9 @@ namespace OpenSim.Framework | |||
694 | string location = String.Format("{0},{1}", m_regionLocX, m_regionLocY); | 696 | string location = String.Format("{0},{1}", m_regionLocX, m_regionLocY); |
695 | config.Set("Location", location); | 697 | config.Set("Location", location); |
696 | 698 | ||
699 | if (DataStore != String.Empty) | ||
700 | config.Set("Datastore", DataStore); | ||
701 | |||
697 | config.Set("InternalAddress", m_internalEndPoint.Address.ToString()); | 702 | config.Set("InternalAddress", m_internalEndPoint.Address.ToString()); |
698 | config.Set("InternalPort", m_internalEndPoint.Port); | 703 | config.Set("InternalPort", m_internalEndPoint.Port); |
699 | 704 | ||
@@ -899,6 +904,9 @@ namespace OpenSim.Framework | |||
899 | case "sim_location_y": | 904 | case "sim_location_y": |
900 | m_regionLocY = (uint) configuration_result; | 905 | m_regionLocY = (uint) configuration_result; |
901 | break; | 906 | break; |
907 | case "datastore": | ||
908 | DataStore = (string) configuration_result; | ||
909 | break; | ||
902 | case "internal_ip_address": | 910 | case "internal_ip_address": |
903 | IPAddress address = (IPAddress) configuration_result; | 911 | IPAddress address = (IPAddress) configuration_result; |
904 | m_internalEndPoint = new IPEndPoint(address, 0); | 912 | m_internalEndPoint = new IPEndPoint(address, 0); |
@@ -1052,6 +1060,11 @@ namespace OpenSim.Framework | |||
1052 | return regionInfo; | 1060 | return regionInfo; |
1053 | } | 1061 | } |
1054 | 1062 | ||
1063 | public int getInternalEndPointPort() | ||
1064 | { | ||
1065 | return m_internalEndPoint.Port; | ||
1066 | } | ||
1067 | |||
1055 | public Dictionary<string, object> ToKeyValuePairs() | 1068 | public Dictionary<string, object> ToKeyValuePairs() |
1056 | { | 1069 | { |
1057 | Dictionary<string, object> kvp = new Dictionary<string, object>(); | 1070 | Dictionary<string, object> kvp = new Dictionary<string, object>(); |
diff --git a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs b/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs index a2f5d9c..c7caf6f 100644 --- a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs +++ b/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs | |||
@@ -48,6 +48,9 @@ namespace OpenSim.Framework.RegionLoader.Web | |||
48 | 48 | ||
49 | public RegionInfo[] LoadRegions() | 49 | public RegionInfo[] LoadRegions() |
50 | { | 50 | { |
51 | int tries = 3; | ||
52 | int wait = 2000; | ||
53 | |||
51 | if (m_configSource == null) | 54 | if (m_configSource == null) |
52 | { | 55 | { |
53 | m_log.Error("[WEBLOADER]: Unable to load configuration source!"); | 56 | m_log.Error("[WEBLOADER]: Unable to load configuration source!"); |
@@ -66,63 +69,72 @@ namespace OpenSim.Framework.RegionLoader.Web | |||
66 | } | 69 | } |
67 | else | 70 | else |
68 | { | 71 | { |
69 | RegionInfo[] regionInfos = new RegionInfo[] {}; | 72 | while(tries > 0) |
70 | int regionCount = 0; | 73 | { |
71 | HttpWebRequest webRequest = (HttpWebRequest) WebRequest.Create(url); | 74 | RegionInfo[] regionInfos = new RegionInfo[] {}; |
72 | webRequest.Timeout = 30000; //30 Second Timeout | 75 | int regionCount = 0; |
73 | m_log.DebugFormat("[WEBLOADER]: Sending download request to {0}", url); | 76 | HttpWebRequest webRequest = (HttpWebRequest) WebRequest.Create(url); |
77 | webRequest.Timeout = 30000; //30 Second Timeout | ||
78 | m_log.DebugFormat("[WEBLOADER]: Sending download request to {0}", url); | ||
74 | 79 | ||
75 | try | 80 | try |
76 | { | 81 | { |
77 | HttpWebResponse webResponse = (HttpWebResponse) webRequest.GetResponse(); | 82 | HttpWebResponse webResponse = (HttpWebResponse) webRequest.GetResponse(); |
78 | m_log.Debug("[WEBLOADER]: Downloading region information..."); | 83 | m_log.Debug("[WEBLOADER]: Downloading region information..."); |
79 | StreamReader reader = new StreamReader(webResponse.GetResponseStream()); | 84 | StreamReader reader = new StreamReader(webResponse.GetResponseStream()); |
80 | string xmlSource = String.Empty; | 85 | string xmlSource = String.Empty; |
81 | string tempStr = reader.ReadLine(); | 86 | string tempStr = reader.ReadLine(); |
82 | while (tempStr != null) | 87 | while (tempStr != null) |
83 | { | 88 | { |
84 | xmlSource = xmlSource + tempStr; | 89 | xmlSource = xmlSource + tempStr; |
85 | tempStr = reader.ReadLine(); | 90 | tempStr = reader.ReadLine(); |
86 | } | 91 | } |
87 | m_log.Debug("[WEBLOADER]: Done downloading region information from server. Total Bytes: " + | 92 | m_log.Debug("[WEBLOADER]: Done downloading region information from server. Total Bytes: " + |
88 | xmlSource.Length); | 93 | xmlSource.Length); |
89 | XmlDocument xmlDoc = new XmlDocument(); | 94 | XmlDocument xmlDoc = new XmlDocument(); |
90 | xmlDoc.LoadXml(xmlSource); | 95 | xmlDoc.LoadXml(xmlSource); |
91 | if (xmlDoc.FirstChild.Name == "Regions") | 96 | if (xmlDoc.FirstChild.Name == "Regions") |
92 | { | 97 | { |
93 | regionCount = xmlDoc.FirstChild.ChildNodes.Count; | 98 | regionCount = xmlDoc.FirstChild.ChildNodes.Count; |
94 | 99 | ||
95 | if (regionCount > 0) | 100 | if (regionCount > 0) |
96 | { | 101 | { |
97 | regionInfos = new RegionInfo[regionCount]; | 102 | regionInfos = new RegionInfo[regionCount]; |
98 | int i; | 103 | int i; |
99 | for (i = 0; i < xmlDoc.FirstChild.ChildNodes.Count; i++) | 104 | for (i = 0; i < xmlDoc.FirstChild.ChildNodes.Count; i++) |
100 | { | 105 | { |
101 | m_log.Debug(xmlDoc.FirstChild.ChildNodes[i].OuterXml); | 106 | m_log.Debug(xmlDoc.FirstChild.ChildNodes[i].OuterXml); |
102 | regionInfos[i] = | 107 | regionInfos[i] = |
103 | new RegionInfo("REGION CONFIG #" + (i + 1), xmlDoc.FirstChild.ChildNodes[i],false,m_configSource); | 108 | new RegionInfo("REGION CONFIG #" + (i + 1), xmlDoc.FirstChild.ChildNodes[i],false,m_configSource); |
104 | } | 109 | } |
105 | } | 110 | } |
106 | } | 111 | } |
107 | } | 112 | } |
108 | catch (WebException ex) | 113 | catch (WebException ex) |
109 | { | 114 | { |
110 | if (((HttpWebResponse)ex.Response).StatusCode == HttpStatusCode.NotFound) | 115 | if (((HttpWebResponse)ex.Response).StatusCode == HttpStatusCode.NotFound) |
116 | { | ||
117 | if (!allowRegionless) | ||
118 | throw ex; | ||
119 | } | ||
120 | else | ||
121 | throw ex; | ||
122 | } | ||
123 | |||
124 | if (regionCount > 0 | allowRegionless) | ||
125 | return regionInfos; | ||
126 | |||
127 | m_log.Debug("[WEBLOADER]: Request yielded no regions."); | ||
128 | tries--; | ||
129 | if (tries > 0) | ||
111 | { | 130 | { |
112 | if (!allowRegionless) | 131 | m_log.Debug("[WEBLOADER]: Retrying"); |
113 | throw ex; | 132 | System.Threading.Thread.Sleep(wait); |
114 | } | 133 | } |
115 | else | 134 | } |
116 | throw ex; | ||
117 | } | ||
118 | 135 | ||
119 | if (regionCount > 0 | allowRegionless) | 136 | m_log.Error("[WEBLOADER]: No region configs were available."); |
120 | return regionInfos; | 137 | return null; |
121 | else | ||
122 | { | ||
123 | m_log.Error("[WEBLOADER]: No region configs were available."); | ||
124 | return null; | ||
125 | } | ||
126 | } | 138 | } |
127 | } | 139 | } |
128 | } | 140 | } |
diff --git a/OpenSim/Framework/RegionSettings.cs b/OpenSim/Framework/RegionSettings.cs index 47dbcec..47a2780 100644 --- a/OpenSim/Framework/RegionSettings.cs +++ b/OpenSim/Framework/RegionSettings.cs | |||
@@ -482,6 +482,28 @@ namespace OpenSim.Framework | |||
482 | set { m_LoadedCreationID = value; } | 482 | set { m_LoadedCreationID = value; } |
483 | } | 483 | } |
484 | 484 | ||
485 | private bool m_GodBlockSearch = false; | ||
486 | public bool GodBlockSearch | ||
487 | { | ||
488 | get { return m_GodBlockSearch; } | ||
489 | set { m_GodBlockSearch = value; } | ||
490 | } | ||
491 | |||
492 | private bool m_Casino = false; | ||
493 | public bool Casino | ||
494 | { | ||
495 | get { return m_Casino; } | ||
496 | set { m_Casino = value; } | ||
497 | } | ||
498 | |||
499 | // Telehub support | ||
500 | private bool m_TelehubEnabled = false; | ||
501 | public bool HasTelehub | ||
502 | { | ||
503 | get { return m_TelehubEnabled; } | ||
504 | set { m_TelehubEnabled = value; } | ||
505 | } | ||
506 | |||
485 | // Connected Telehub object | 507 | // Connected Telehub object |
486 | private UUID m_TelehubObject = UUID.Zero; | 508 | private UUID m_TelehubObject = UUID.Zero; |
487 | public UUID TelehubObject | 509 | public UUID TelehubObject |
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index aac9c45..a8f3a9e 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs | |||
@@ -294,7 +294,7 @@ namespace OpenSim.Framework.Servers | |||
294 | 294 | ||
295 | EnhanceVersionInformation(); | 295 | EnhanceVersionInformation(); |
296 | 296 | ||
297 | m_log.Info("[STARTUP]: OpenSimulator version: " + m_version + Environment.NewLine); | 297 | m_log.Info("[STARTUP]: Careminster version: " + m_version + Environment.NewLine); |
298 | // clr version potentially is more confusing than helpful, since it doesn't tell us if we're running under Mono/MS .NET and | 298 | // clr version potentially is more confusing than helpful, since it doesn't tell us if we're running under Mono/MS .NET and |
299 | // the clr version number doesn't match the project version number under Mono. | 299 | // the clr version number doesn't match the project version number under Mono. |
300 | //m_log.Info("[STARTUP]: Virtual machine runtime version: " + Environment.Version + Environment.NewLine); | 300 | //m_log.Info("[STARTUP]: Virtual machine runtime version: " + Environment.Version + Environment.NewLine); |
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index b018e57..b3e31a6 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | |||
@@ -334,6 +334,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
334 | StreamReader reader = new StreamReader(requestStream, encoding); | 334 | StreamReader reader = new StreamReader(requestStream, encoding); |
335 | 335 | ||
336 | string requestBody = reader.ReadToEnd(); | 336 | string requestBody = reader.ReadToEnd(); |
337 | reader.Close(); | ||
337 | 338 | ||
338 | Hashtable keysvals = new Hashtable(); | 339 | Hashtable keysvals = new Hashtable(); |
339 | Hashtable headervals = new Hashtable(); | 340 | Hashtable headervals = new Hashtable(); |
@@ -648,7 +649,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
648 | // Every month or so this will wrap and give bad numbers, not really a problem | 649 | // Every month or so this will wrap and give bad numbers, not really a problem |
649 | // since its just for reporting | 650 | // since its just for reporting |
650 | int tickdiff = requestEndTick - requestStartTick; | 651 | int tickdiff = requestEndTick - requestStartTick; |
651 | if (tickdiff > 3000 && requestHandler != null && requestHandler.Name != "GetTexture") | 652 | if (tickdiff > 3000 && (requestHandler == null || requestHandler.Name == null || requestHandler.Name != "GetTexture")) |
652 | { | 653 | { |
653 | m_log.InfoFormat( | 654 | m_log.InfoFormat( |
654 | "[BASE HTTP SERVER]: Slow handling of {0} {1} {2} {3} {4} from {5} took {6}ms", | 655 | "[BASE HTTP SERVER]: Slow handling of {0} {1} {2} {3} {4} from {5} took {6}ms", |
@@ -1532,10 +1533,40 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1532 | 1533 | ||
1533 | internal byte[] DoHTTPGruntWork(Hashtable responsedata, OSHttpResponse response) | 1534 | internal byte[] DoHTTPGruntWork(Hashtable responsedata, OSHttpResponse response) |
1534 | { | 1535 | { |
1535 | //m_log.Info("[BASE HTTP SERVER]: Doing HTTP Grunt work with response"); | 1536 | int responsecode; |
1536 | int responsecode = (int)responsedata["int_response_code"]; | 1537 | string responseString = String.Empty; |
1537 | string responseString = (string)responsedata["str_response_string"]; | 1538 | byte[] responseData = null; |
1538 | string contentType = (string)responsedata["content_type"]; | 1539 | string contentType; |
1540 | |||
1541 | if (responsedata == null) | ||
1542 | { | ||
1543 | responsecode = 500; | ||
1544 | responseString = "No response could be obtained"; | ||
1545 | contentType = "text/plain"; | ||
1546 | responsedata = new Hashtable(); | ||
1547 | } | ||
1548 | else | ||
1549 | { | ||
1550 | try | ||
1551 | { | ||
1552 | //m_log.Info("[BASE HTTP SERVER]: Doing HTTP Grunt work with response"); | ||
1553 | responsecode = (int)responsedata["int_response_code"]; | ||
1554 | if (responsedata["bin_response_data"] != null) | ||
1555 | responseData = (byte[])responsedata["bin_response_data"]; | ||
1556 | else | ||
1557 | responseString = (string)responsedata["str_response_string"]; | ||
1558 | contentType = (string)responsedata["content_type"]; | ||
1559 | if (responseString == null) | ||
1560 | responseString = String.Empty; | ||
1561 | } | ||
1562 | catch | ||
1563 | { | ||
1564 | responsecode = 500; | ||
1565 | responseString = "No response could be obtained"; | ||
1566 | contentType = "text/plain"; | ||
1567 | responsedata = new Hashtable(); | ||
1568 | } | ||
1569 | } | ||
1539 | 1570 | ||
1540 | if (responsedata.ContainsKey("error_status_text")) | 1571 | if (responsedata.ContainsKey("error_status_text")) |
1541 | { | 1572 | { |
@@ -1580,25 +1611,40 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1580 | 1611 | ||
1581 | response.AddHeader("Content-Type", contentType); | 1612 | response.AddHeader("Content-Type", contentType); |
1582 | 1613 | ||
1614 | if (responsedata.ContainsKey("headers")) | ||
1615 | { | ||
1616 | Hashtable headerdata = (Hashtable)responsedata["headers"]; | ||
1617 | |||
1618 | foreach (string header in headerdata.Keys) | ||
1619 | response.AddHeader(header, (string)headerdata[header]); | ||
1620 | } | ||
1621 | |||
1583 | byte[] buffer; | 1622 | byte[] buffer; |
1584 | 1623 | ||
1585 | if (!(contentType.Contains("image") | 1624 | if (responseData != null) |
1586 | || contentType.Contains("x-shockwave-flash") | ||
1587 | || contentType.Contains("application/x-oar") | ||
1588 | || contentType.Contains("application/vnd.ll.mesh"))) | ||
1589 | { | 1625 | { |
1590 | // Text | 1626 | buffer = responseData; |
1591 | buffer = Encoding.UTF8.GetBytes(responseString); | ||
1592 | } | 1627 | } |
1593 | else | 1628 | else |
1594 | { | 1629 | { |
1595 | // Binary! | 1630 | if (!(contentType.Contains("image") |
1596 | buffer = Convert.FromBase64String(responseString); | 1631 | || contentType.Contains("x-shockwave-flash") |
1597 | } | 1632 | || contentType.Contains("application/x-oar") |
1633 | || contentType.Contains("application/vnd.ll.mesh"))) | ||
1634 | { | ||
1635 | // Text | ||
1636 | buffer = Encoding.UTF8.GetBytes(responseString); | ||
1637 | } | ||
1638 | else | ||
1639 | { | ||
1640 | // Binary! | ||
1641 | buffer = Convert.FromBase64String(responseString); | ||
1642 | } | ||
1598 | 1643 | ||
1599 | response.SendChunked = false; | 1644 | response.SendChunked = false; |
1600 | response.ContentLength64 = buffer.Length; | 1645 | response.ContentLength64 = buffer.Length; |
1601 | response.ContentEncoding = Encoding.UTF8; | 1646 | response.ContentEncoding = Encoding.UTF8; |
1647 | } | ||
1602 | 1648 | ||
1603 | return buffer; | 1649 | return buffer; |
1604 | } | 1650 | } |
@@ -1678,7 +1724,8 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1678 | m_httpListener2.Start(64); | 1724 | m_httpListener2.Start(64); |
1679 | 1725 | ||
1680 | // Long Poll Service Manager with 3 worker threads a 25 second timeout for no events | 1726 | // Long Poll Service Manager with 3 worker threads a 25 second timeout for no events |
1681 | m_PollServiceManager = new PollServiceRequestManager(this, 3, 25000); | 1727 | // m_PollServiceManager = new PollServiceRequestManager(this, 3, 25000); |
1728 | m_PollServiceManager = new PollServiceRequestManager(this, 4, 25000); | ||
1682 | HTTPDRunning = true; | 1729 | HTTPDRunning = true; |
1683 | 1730 | ||
1684 | //HttpListenerContext context; | 1731 | //HttpListenerContext context; |
@@ -1712,7 +1759,9 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1712 | 1759 | ||
1713 | public void httpServerException(object source, Exception exception) | 1760 | public void httpServerException(object source, Exception exception) |
1714 | { | 1761 | { |
1715 | m_log.Error(String.Format("[BASE HTTP SERVER]: {0} had an exception: {1} ", source.ToString(), exception.Message), exception); | 1762 | if (source.ToString() == "HttpServer.HttpListener" && exception.ToString().StartsWith("Mono.Security.Protocol.Tls.TlsException")) |
1763 | return; | ||
1764 | m_log.ErrorFormat("[BASE HTTP SERVER]: {0} had an exception {1}", source.ToString(), exception.ToString()); | ||
1716 | /* | 1765 | /* |
1717 | if (HTTPDRunning)// && NotSocketErrors > 5) | 1766 | if (HTTPDRunning)// && NotSocketErrors > 5) |
1718 | { | 1767 | { |
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs index 3089351..d0a37d0 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs | |||
@@ -34,7 +34,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
34 | public delegate void RequestMethod(UUID requestID, Hashtable request); | 34 | public delegate void RequestMethod(UUID requestID, Hashtable request); |
35 | public delegate bool HasEventsMethod(UUID requestID, UUID pId); | 35 | public delegate bool HasEventsMethod(UUID requestID, UUID pId); |
36 | 36 | ||
37 | public delegate Hashtable GetEventsMethod(UUID requestID, UUID pId, string request); | 37 | public delegate Hashtable GetEventsMethod(UUID requestID, UUID pId); |
38 | 38 | ||
39 | public delegate Hashtable NoEventsMethod(UUID requestID, UUID pId); | 39 | public delegate Hashtable NoEventsMethod(UUID requestID, UUID pId); |
40 | 40 | ||
@@ -45,17 +45,29 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
45 | public NoEventsMethod NoEvents; | 45 | public NoEventsMethod NoEvents; |
46 | public RequestMethod Request; | 46 | public RequestMethod Request; |
47 | public UUID Id; | 47 | public UUID Id; |
48 | public int TimeOutms; | ||
49 | public EventType Type; | ||
50 | |||
51 | public enum EventType : int | ||
52 | { | ||
53 | Normal = 0, | ||
54 | LslHttp = 1, | ||
55 | Inventory = 2, | ||
56 | Texture = 3 | ||
57 | } | ||
48 | 58 | ||
49 | public PollServiceEventArgs( | 59 | public PollServiceEventArgs( |
50 | RequestMethod pRequest, | 60 | RequestMethod pRequest, |
51 | HasEventsMethod pHasEvents, GetEventsMethod pGetEvents, NoEventsMethod pNoEvents, | 61 | HasEventsMethod pHasEvents, GetEventsMethod pGetEvents, NoEventsMethod pNoEvents, |
52 | UUID pId) | 62 | UUID pId, int pTimeOutms) |
53 | { | 63 | { |
54 | Request = pRequest; | 64 | Request = pRequest; |
55 | HasEvents = pHasEvents; | 65 | HasEvents = pHasEvents; |
56 | GetEvents = pGetEvents; | 66 | GetEvents = pGetEvents; |
57 | NoEvents = pNoEvents; | 67 | NoEvents = pNoEvents; |
58 | Id = pId; | 68 | Id = pId; |
69 | TimeOutms = pTimeOutms; | ||
70 | Type = EventType.Normal; | ||
59 | } | 71 | } |
60 | } | 72 | } |
61 | } \ No newline at end of file | 73 | } |
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index 8d50151..4be8bf4 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs | |||
@@ -33,15 +33,20 @@ using log4net; | |||
33 | using HttpServer; | 33 | using HttpServer; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Monitoring; | 35 | using OpenSim.Framework.Monitoring; |
36 | using Amib.Threading; | ||
36 | 37 | ||
38 | |||
39 | /* | ||
37 | namespace OpenSim.Framework.Servers.HttpServer | 40 | namespace OpenSim.Framework.Servers.HttpServer |
38 | { | 41 | { |
42 | |||
39 | public class PollServiceRequestManager | 43 | public class PollServiceRequestManager |
40 | { | 44 | { |
41 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 45 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
42 | 46 | ||
43 | private readonly BaseHttpServer m_server; | 47 | private readonly BaseHttpServer m_server; |
44 | private static Queue m_requests = Queue.Synchronized(new Queue()); | 48 | private static Queue m_requests = Queue.Synchronized(new Queue()); |
49 | private static ManualResetEvent m_ev = new ManualResetEvent(false); | ||
45 | private uint m_WorkerThreadCount = 0; | 50 | private uint m_WorkerThreadCount = 0; |
46 | private Thread[] m_workerThreads; | 51 | private Thread[] m_workerThreads; |
47 | private PollServiceWorkerThread[] m_PollServiceWorkerThreads; | 52 | private PollServiceWorkerThread[] m_PollServiceWorkerThreads; |
@@ -67,7 +72,6 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
67 | ThreadPriority.Normal, | 72 | ThreadPriority.Normal, |
68 | false, | 73 | false, |
69 | true, | 74 | true, |
70 | null, | ||
71 | int.MaxValue); | 75 | int.MaxValue); |
72 | } | 76 | } |
73 | 77 | ||
@@ -77,7 +81,6 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
77 | ThreadPriority.Normal, | 81 | ThreadPriority.Normal, |
78 | false, | 82 | false, |
79 | true, | 83 | true, |
80 | null, | ||
81 | 1000 * 60 * 10); | 84 | 1000 * 60 * 10); |
82 | } | 85 | } |
83 | 86 | ||
@@ -91,15 +94,17 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
91 | { | 94 | { |
92 | lock (m_requests) | 95 | lock (m_requests) |
93 | m_requests.Enqueue(req); | 96 | m_requests.Enqueue(req); |
97 | m_ev.Set(); | ||
94 | } | 98 | } |
95 | 99 | ||
96 | public void ThreadStart() | 100 | public void ThreadStart() |
97 | { | 101 | { |
98 | while (m_running) | 102 | while (m_running) |
99 | { | 103 | { |
104 | m_ev.WaitOne(1000); | ||
105 | m_ev.Reset(); | ||
100 | Watchdog.UpdateThread(); | 106 | Watchdog.UpdateThread(); |
101 | ProcessQueuedRequests(); | 107 | ProcessQueuedRequests(); |
102 | Thread.Sleep(1000); | ||
103 | } | 108 | } |
104 | } | 109 | } |
105 | 110 | ||
@@ -141,8 +146,9 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
141 | foreach (object o in m_requests) | 146 | foreach (object o in m_requests) |
142 | { | 147 | { |
143 | PollServiceHttpRequest req = (PollServiceHttpRequest) o; | 148 | PollServiceHttpRequest req = (PollServiceHttpRequest) o; |
144 | PollServiceWorkerThread.DoHTTPGruntWork( | 149 | m_server.DoHTTPGruntWork( |
145 | m_server, req, req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id)); | 150 | req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id), |
151 | new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext)); | ||
146 | } | 152 | } |
147 | 153 | ||
148 | m_requests.Clear(); | 154 | m_requests.Clear(); |
@@ -151,8 +157,274 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
151 | { | 157 | { |
152 | t.Abort(); | 158 | t.Abort(); |
153 | } | 159 | } |
154 | |||
155 | m_running = false; | 160 | m_running = false; |
156 | } | 161 | } |
157 | } | 162 | } |
158 | } \ No newline at end of file | 163 | } |
164 | */ | ||
165 | |||
166 | using System.IO; | ||
167 | using System.Text; | ||
168 | using System.Collections.Generic; | ||
169 | |||
170 | namespace OpenSim.Framework.Servers.HttpServer | ||
171 | { | ||
172 | public class PollServiceRequestManager | ||
173 | { | ||
174 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
175 | |||
176 | private readonly BaseHttpServer m_server; | ||
177 | |||
178 | private BlockingQueue<PollServiceHttpRequest> m_requests = new BlockingQueue<PollServiceHttpRequest>(); | ||
179 | private static Queue<PollServiceHttpRequest> m_slowRequests = new Queue<PollServiceHttpRequest>(); | ||
180 | private static Queue<PollServiceHttpRequest> m_retryRequests = new Queue<PollServiceHttpRequest>(); | ||
181 | |||
182 | private uint m_WorkerThreadCount = 0; | ||
183 | private Thread[] m_workerThreads; | ||
184 | private Thread m_retrysThread; | ||
185 | |||
186 | private bool m_running = true; | ||
187 | private int slowCount = 0; | ||
188 | |||
189 | private SmartThreadPool m_threadPool = new SmartThreadPool(20000, 12, 2); | ||
190 | |||
191 | // private int m_timeout = 1000; // increase timeout 250; now use the event one | ||
192 | |||
193 | public PollServiceRequestManager(BaseHttpServer pSrv, uint pWorkerThreadCount, int pTimeout) | ||
194 | { | ||
195 | m_server = pSrv; | ||
196 | m_WorkerThreadCount = pWorkerThreadCount; | ||
197 | m_workerThreads = new Thread[m_WorkerThreadCount]; | ||
198 | |||
199 | //startup worker threads | ||
200 | for (uint i = 0; i < m_WorkerThreadCount; i++) | ||
201 | { | ||
202 | m_workerThreads[i] | ||
203 | = Watchdog.StartThread( | ||
204 | PoolWorkerJob, | ||
205 | String.Format("PollServiceWorkerThread{0}", i), | ||
206 | ThreadPriority.Normal, | ||
207 | false, | ||
208 | false, | ||
209 | null, | ||
210 | int.MaxValue); | ||
211 | } | ||
212 | |||
213 | m_retrysThread = Watchdog.StartThread( | ||
214 | this.CheckRetries, | ||
215 | "PollServiceWatcherThread", | ||
216 | ThreadPriority.Normal, | ||
217 | false, | ||
218 | true, | ||
219 | null, | ||
220 | 1000 * 60 * 10); | ||
221 | } | ||
222 | |||
223 | |||
224 | private void ReQueueEvent(PollServiceHttpRequest req) | ||
225 | { | ||
226 | if (m_running) | ||
227 | { | ||
228 | lock (m_retryRequests) | ||
229 | m_retryRequests.Enqueue(req); | ||
230 | } | ||
231 | } | ||
232 | |||
233 | public void Enqueue(PollServiceHttpRequest req) | ||
234 | { | ||
235 | if (m_running) | ||
236 | { | ||
237 | if (req.PollServiceArgs.Type != PollServiceEventArgs.EventType.Normal) | ||
238 | { | ||
239 | m_requests.Enqueue(req); | ||
240 | } | ||
241 | else | ||
242 | { | ||
243 | lock (m_slowRequests) | ||
244 | m_slowRequests.Enqueue(req); | ||
245 | } | ||
246 | } | ||
247 | } | ||
248 | |||
249 | private void CheckRetries() | ||
250 | { | ||
251 | while (m_running) | ||
252 | { | ||
253 | Thread.Sleep(100); // let the world move .. back to faster rate | ||
254 | Watchdog.UpdateThread(); | ||
255 | lock (m_retryRequests) | ||
256 | { | ||
257 | while (m_retryRequests.Count > 0 && m_running) | ||
258 | m_requests.Enqueue(m_retryRequests.Dequeue()); | ||
259 | } | ||
260 | slowCount++; | ||
261 | if (slowCount >= 10) | ||
262 | { | ||
263 | slowCount = 0; | ||
264 | |||
265 | lock (m_slowRequests) | ||
266 | { | ||
267 | while (m_slowRequests.Count > 0 && m_running) | ||
268 | m_requests.Enqueue(m_slowRequests.Dequeue()); | ||
269 | } | ||
270 | } | ||
271 | } | ||
272 | } | ||
273 | |||
274 | ~PollServiceRequestManager() | ||
275 | { | ||
276 | m_running = false; | ||
277 | // m_timeout = -10000; // cause all to expire | ||
278 | Thread.Sleep(1000); // let the world move | ||
279 | |||
280 | foreach (Thread t in m_workerThreads) | ||
281 | Watchdog.AbortThread(t.ManagedThreadId); | ||
282 | |||
283 | try | ||
284 | { | ||
285 | foreach (PollServiceHttpRequest req in m_retryRequests) | ||
286 | { | ||
287 | DoHTTPGruntWork(m_server,req, | ||
288 | req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id)); | ||
289 | } | ||
290 | } | ||
291 | catch | ||
292 | { | ||
293 | } | ||
294 | |||
295 | PollServiceHttpRequest wreq; | ||
296 | m_retryRequests.Clear(); | ||
297 | |||
298 | lock (m_slowRequests) | ||
299 | { | ||
300 | while (m_slowRequests.Count > 0 && m_running) | ||
301 | m_requests.Enqueue(m_slowRequests.Dequeue()); | ||
302 | } | ||
303 | |||
304 | while (m_requests.Count() > 0) | ||
305 | { | ||
306 | try | ||
307 | { | ||
308 | wreq = m_requests.Dequeue(0); | ||
309 | DoHTTPGruntWork(m_server,wreq, | ||
310 | wreq.PollServiceArgs.NoEvents(wreq.RequestID, wreq.PollServiceArgs.Id)); | ||
311 | } | ||
312 | catch | ||
313 | { | ||
314 | } | ||
315 | } | ||
316 | |||
317 | m_requests.Clear(); | ||
318 | } | ||
319 | |||
320 | // work threads | ||
321 | |||
322 | private void PoolWorkerJob() | ||
323 | { | ||
324 | while (m_running) | ||
325 | { | ||
326 | PollServiceHttpRequest req = m_requests.Dequeue(5000); | ||
327 | |||
328 | Watchdog.UpdateThread(); | ||
329 | if (req != null) | ||
330 | { | ||
331 | try | ||
332 | { | ||
333 | if (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id)) | ||
334 | { | ||
335 | Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id); | ||
336 | |||
337 | if (responsedata == null) | ||
338 | continue; | ||
339 | |||
340 | if (req.PollServiceArgs.Type == PollServiceEventArgs.EventType.Normal) | ||
341 | { | ||
342 | try | ||
343 | { | ||
344 | DoHTTPGruntWork(m_server, req, responsedata); | ||
345 | } | ||
346 | catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream | ||
347 | { | ||
348 | // Ignore it, no need to reply | ||
349 | } | ||
350 | } | ||
351 | else | ||
352 | { | ||
353 | m_threadPool.QueueWorkItem(x => | ||
354 | { | ||
355 | try | ||
356 | { | ||
357 | DoHTTPGruntWork(m_server, req, responsedata); | ||
358 | } | ||
359 | catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream | ||
360 | { | ||
361 | // Ignore it, no need to reply | ||
362 | } | ||
363 | |||
364 | return null; | ||
365 | }, null); | ||
366 | } | ||
367 | } | ||
368 | else | ||
369 | { | ||
370 | if ((Environment.TickCount - req.RequestTime) > req.PollServiceArgs.TimeOutms) | ||
371 | { | ||
372 | DoHTTPGruntWork(m_server, req, | ||
373 | req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id)); | ||
374 | } | ||
375 | else | ||
376 | { | ||
377 | ReQueueEvent(req); | ||
378 | } | ||
379 | } | ||
380 | } | ||
381 | catch (Exception e) | ||
382 | { | ||
383 | m_log.ErrorFormat("Exception in poll service thread: " + e.ToString()); | ||
384 | } | ||
385 | } | ||
386 | } | ||
387 | } | ||
388 | |||
389 | // DoHTTPGruntWork changed, not sending response | ||
390 | // do the same work around as core | ||
391 | |||
392 | internal static void DoHTTPGruntWork(BaseHttpServer server, PollServiceHttpRequest req, Hashtable responsedata) | ||
393 | { | ||
394 | OSHttpResponse response | ||
395 | = new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext); | ||
396 | |||
397 | byte[] buffer = server.DoHTTPGruntWork(responsedata, response); | ||
398 | |||
399 | response.SendChunked = false; | ||
400 | response.ContentLength64 = buffer.Length; | ||
401 | response.ContentEncoding = Encoding.UTF8; | ||
402 | |||
403 | try | ||
404 | { | ||
405 | response.OutputStream.Write(buffer, 0, buffer.Length); | ||
406 | } | ||
407 | catch (Exception ex) | ||
408 | { | ||
409 | m_log.Warn(string.Format("[POLL SERVICE WORKER THREAD]: Error ", ex)); | ||
410 | } | ||
411 | finally | ||
412 | { | ||
413 | //response.OutputStream.Close(); | ||
414 | try | ||
415 | { | ||
416 | response.OutputStream.Flush(); | ||
417 | response.Send(); | ||
418 | |||
419 | //if (!response.KeepAlive && response.ReuseContext) | ||
420 | // response.FreeContext(); | ||
421 | } | ||
422 | catch (Exception e) | ||
423 | { | ||
424 | m_log.Warn(String.Format("[POLL SERVICE WORKER THREAD]: Error ", e)); | ||
425 | } | ||
426 | } | ||
427 | } | ||
428 | } | ||
429 | } | ||
430 | |||
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs index 5adbcd1..1c529b6 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs | |||
@@ -25,6 +25,8 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | /* Ubit work moved to PollServiceRequestManager | ||
29 | |||
28 | using System; | 30 | using System; |
29 | using System.Collections; | 31 | using System.Collections; |
30 | using System.Collections.Generic; | 32 | using System.Collections.Generic; |
@@ -90,8 +92,15 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
90 | continue; | 92 | continue; |
91 | } | 93 | } |
92 | 94 | ||
93 | Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, str.ReadToEnd()); | 95 | try |
94 | DoHTTPGruntWork(m_server, req, responsedata); | 96 | { |
97 | Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, str.ReadToEnd()); | ||
98 | DoHTTPGruntWork(m_server, req, responsedata); | ||
99 | } | ||
100 | catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream | ||
101 | { | ||
102 | // Ignore it, no need to reply | ||
103 | } | ||
95 | } | 104 | } |
96 | else | 105 | else |
97 | { | 106 | { |
@@ -162,4 +171,5 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
162 | } | 171 | } |
163 | } | 172 | } |
164 | } | 173 | } |
165 | } \ No newline at end of file | 174 | } |
175 | */ \ No newline at end of file | ||
diff --git a/OpenSim/Framework/Servers/Tests/OSHttpTests.cs b/OpenSim/Framework/Servers/Tests/OSHttpTests.cs index dc4eb8f..4c2f586 100644 --- a/OpenSim/Framework/Servers/Tests/OSHttpTests.cs +++ b/OpenSim/Framework/Servers/Tests/OSHttpTests.cs | |||
@@ -75,6 +75,10 @@ namespace OpenSim.Framework.Servers.Tests | |||
75 | /// </summary> | 75 | /// </summary> |
76 | public event EventHandler<RequestEventArgs> RequestReceived = delegate { }; | 76 | public event EventHandler<RequestEventArgs> RequestReceived = delegate { }; |
77 | 77 | ||
78 | public bool CanSend { get { return true; } } | ||
79 | public string RemoteEndPoint { get { return ""; } } | ||
80 | public string RemoteEndPointAddress { get { return ""; } } | ||
81 | public string RemoteEndPointPort { get { return ""; } } | ||
78 | } | 82 | } |
79 | 83 | ||
80 | public class TestHttpRequest: IHttpRequest | 84 | public class TestHttpRequest: IHttpRequest |
diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs index c9d9770..bb094ed 100644 --- a/OpenSim/Framework/Servers/VersionInfo.cs +++ b/OpenSim/Framework/Servers/VersionInfo.cs | |||
@@ -29,11 +29,11 @@ namespace OpenSim | |||
29 | { | 29 | { |
30 | public class VersionInfo | 30 | public class VersionInfo |
31 | { | 31 | { |
32 | private const string VERSION_NUMBER = "0.7.5"; | 32 | private const string VERSION_NUMBER = "0.7.5CM"; |
33 | private const Flavour VERSION_FLAVOUR = Flavour.Dev; | 33 | private const Flavour VERSION_FLAVOUR = Flavour.Dev; |
34 | 34 | ||
35 | public enum Flavour | 35 | public enum Flavour |
36 | { | 36 | { |
37 | Unknown, | 37 | Unknown, |
38 | Dev, | 38 | Dev, |
39 | RC1, | 39 | RC1, |
@@ -50,7 +50,7 @@ namespace OpenSim | |||
50 | 50 | ||
51 | public static string GetVersionString(string versionNumber, Flavour flavour) | 51 | public static string GetVersionString(string versionNumber, Flavour flavour) |
52 | { | 52 | { |
53 | string versionString = "OpenSim " + versionNumber + " " + flavour; | 53 | string versionString = "Careminster " + versionNumber + " " + flavour; |
54 | return versionString.PadRight(VERSIONINFO_VERSION_LENGTH); | 54 | return versionString.PadRight(VERSIONINFO_VERSION_LENGTH); |
55 | } | 55 | } |
56 | 56 | ||
diff --git a/OpenSim/Framework/TaskInventoryDictionary.cs b/OpenSim/Framework/TaskInventoryDictionary.cs index 421bd5d..4d07746 100644 --- a/OpenSim/Framework/TaskInventoryDictionary.cs +++ b/OpenSim/Framework/TaskInventoryDictionary.cs | |||
@@ -27,9 +27,13 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Threading; | ||
31 | using System.Reflection; | ||
30 | using System.Xml; | 32 | using System.Xml; |
33 | using System.Diagnostics; | ||
31 | using System.Xml.Schema; | 34 | using System.Xml.Schema; |
32 | using System.Xml.Serialization; | 35 | using System.Xml.Serialization; |
36 | using log4net; | ||
33 | using OpenMetaverse; | 37 | using OpenMetaverse; |
34 | 38 | ||
35 | namespace OpenSim.Framework | 39 | namespace OpenSim.Framework |
@@ -45,6 +49,180 @@ namespace OpenSim.Framework | |||
45 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 49 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
46 | 50 | ||
47 | private static XmlSerializer tiiSerializer = new XmlSerializer(typeof (TaskInventoryItem)); | 51 | private static XmlSerializer tiiSerializer = new XmlSerializer(typeof (TaskInventoryItem)); |
52 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
53 | |||
54 | private Thread LockedByThread; | ||
55 | // private string WriterStack; | ||
56 | |||
57 | // private Dictionary<Thread, string> ReadLockers = | ||
58 | // new Dictionary<Thread, string>(); | ||
59 | |||
60 | /// <value> | ||
61 | /// An advanced lock for inventory data | ||
62 | /// </value> | ||
63 | private System.Threading.ReaderWriterLockSlim m_itemLock = new System.Threading.ReaderWriterLockSlim(); | ||
64 | |||
65 | /// <summary> | ||
66 | /// Are we readlocked by the calling thread? | ||
67 | /// </summary> | ||
68 | public bool IsReadLockedByMe() | ||
69 | { | ||
70 | if (m_itemLock.RecursiveReadCount > 0) | ||
71 | { | ||
72 | return true; | ||
73 | } | ||
74 | else | ||
75 | { | ||
76 | return false; | ||
77 | } | ||
78 | } | ||
79 | |||
80 | /// <summary> | ||
81 | /// Lock our inventory list for reading (many can read, one can write) | ||
82 | /// </summary> | ||
83 | public void LockItemsForRead(bool locked) | ||
84 | { | ||
85 | if (locked) | ||
86 | { | ||
87 | if (m_itemLock.IsWriteLockHeld && LockedByThread != null) | ||
88 | { | ||
89 | if (!LockedByThread.IsAlive) | ||
90 | { | ||
91 | //Locked by dead thread, reset. | ||
92 | m_itemLock = new System.Threading.ReaderWriterLockSlim(); | ||
93 | } | ||
94 | } | ||
95 | |||
96 | if (m_itemLock.RecursiveReadCount > 0) | ||
97 | { | ||
98 | m_log.Error("[TaskInventoryDictionary] Recursive read lock requested. This should not happen and means something needs to be fixed. For now though, it's safe to continue."); | ||
99 | try | ||
100 | { | ||
101 | // That call stack is useful for end users only. RealProgrammers need a full dump. Commented. | ||
102 | // StackTrace stackTrace = new StackTrace(); // get call stack | ||
103 | // StackFrame[] stackFrames = stackTrace.GetFrames(); // get method calls (frames) | ||
104 | // | ||
105 | // // write call stack method names | ||
106 | // foreach (StackFrame stackFrame in stackFrames) | ||
107 | // { | ||
108 | // m_log.Error("[SceneObjectGroup.m_parts] "+(stackFrame.GetMethod().Name)); // write method name | ||
109 | // } | ||
110 | |||
111 | // The below is far more useful | ||
112 | // System.Console.WriteLine("------------------------------------------"); | ||
113 | // System.Console.WriteLine("My call stack:\n" + Environment.StackTrace); | ||
114 | // System.Console.WriteLine("------------------------------------------"); | ||
115 | // foreach (KeyValuePair<Thread, string> kvp in ReadLockers) | ||
116 | // { | ||
117 | // System.Console.WriteLine("Locker name {0} call stack:\n" + kvp.Value, kvp.Key.Name); | ||
118 | // System.Console.WriteLine("------------------------------------------"); | ||
119 | // } | ||
120 | } | ||
121 | catch | ||
122 | {} | ||
123 | m_itemLock.ExitReadLock(); | ||
124 | } | ||
125 | if (m_itemLock.RecursiveWriteCount > 0) | ||
126 | { | ||
127 | m_log.Error("[TaskInventoryDictionary] Recursive write lock requested. This should not happen and means something needs to be fixed."); | ||
128 | // try | ||
129 | // { | ||
130 | // System.Console.WriteLine("------------------------------------------"); | ||
131 | // System.Console.WriteLine("My call stack:\n" + Environment.StackTrace); | ||
132 | // System.Console.WriteLine("------------------------------------------"); | ||
133 | // System.Console.WriteLine("Locker's call stack:\n" + WriterStack); | ||
134 | // System.Console.WriteLine("------------------------------------------"); | ||
135 | // } | ||
136 | // catch | ||
137 | // {} | ||
138 | m_itemLock.ExitWriteLock(); | ||
139 | } | ||
140 | |||
141 | while (!m_itemLock.TryEnterReadLock(60000)) | ||
142 | { | ||
143 | m_log.Error("Thread lock detected while trying to aquire READ lock in TaskInventoryDictionary. Locked by thread " + LockedByThread.Name + ". I'm going to try to solve the thread lock automatically to preserve region stability, but this needs to be fixed."); | ||
144 | if (m_itemLock.IsWriteLockHeld) | ||
145 | { | ||
146 | m_itemLock = new System.Threading.ReaderWriterLockSlim(); | ||
147 | // System.Console.WriteLine("------------------------------------------"); | ||
148 | // System.Console.WriteLine("My call stack:\n" + Environment.StackTrace); | ||
149 | // System.Console.WriteLine("------------------------------------------"); | ||
150 | // System.Console.WriteLine("Locker's call stack:\n" + WriterStack); | ||
151 | // System.Console.WriteLine("------------------------------------------"); | ||
152 | // LockedByThread = null; | ||
153 | // ReadLockers.Clear(); | ||
154 | } | ||
155 | } | ||
156 | // ReadLockers[Thread.CurrentThread] = Environment.StackTrace; | ||
157 | } | ||
158 | else | ||
159 | { | ||
160 | if (m_itemLock.RecursiveReadCount>0) | ||
161 | { | ||
162 | m_itemLock.ExitReadLock(); | ||
163 | } | ||
164 | // if (m_itemLock.RecursiveReadCount == 0) | ||
165 | // ReadLockers.Remove(Thread.CurrentThread); | ||
166 | } | ||
167 | } | ||
168 | |||
169 | /// <summary> | ||
170 | /// Lock our inventory list for writing (many can read, one can write) | ||
171 | /// </summary> | ||
172 | public void LockItemsForWrite(bool locked) | ||
173 | { | ||
174 | if (locked) | ||
175 | { | ||
176 | //Enter a write lock, wait indefinately for one to open. | ||
177 | if (m_itemLock.RecursiveReadCount > 0) | ||
178 | { | ||
179 | m_log.Error("[TaskInventoryDictionary] Recursive read lock requested. This should not happen and means something needs to be fixed. For now though, it's safe to continue."); | ||
180 | m_itemLock.ExitReadLock(); | ||
181 | } | ||
182 | if (m_itemLock.RecursiveWriteCount > 0) | ||
183 | { | ||
184 | m_log.Error("[TaskInventoryDictionary] Recursive write lock requested. This should not happen and means something needs to be fixed."); | ||
185 | |||
186 | m_itemLock.ExitWriteLock(); | ||
187 | } | ||
188 | while (!m_itemLock.TryEnterWriteLock(60000)) | ||
189 | { | ||
190 | if (m_itemLock.IsWriteLockHeld) | ||
191 | { | ||
192 | m_log.Error("Thread lock detected while trying to aquire WRITE lock in TaskInventoryDictionary. Locked by thread " + LockedByThread.Name + ". I'm going to try to solve the thread lock automatically to preserve region stability, but this needs to be fixed."); | ||
193 | // System.Console.WriteLine("------------------------------------------"); | ||
194 | // System.Console.WriteLine("My call stack:\n" + Environment.StackTrace); | ||
195 | // System.Console.WriteLine("------------------------------------------"); | ||
196 | // System.Console.WriteLine("Locker's call stack:\n" + WriterStack); | ||
197 | // System.Console.WriteLine("------------------------------------------"); | ||
198 | } | ||
199 | else | ||
200 | { | ||
201 | m_log.Error("Thread lock detected while trying to aquire WRITE lock in TaskInventoryDictionary. Locked by a reader. I'm going to try to solve the thread lock automatically to preserve region stability, but this needs to be fixed."); | ||
202 | // System.Console.WriteLine("------------------------------------------"); | ||
203 | // System.Console.WriteLine("My call stack:\n" + Environment.StackTrace); | ||
204 | // System.Console.WriteLine("------------------------------------------"); | ||
205 | // foreach (KeyValuePair<Thread, string> kvp in ReadLockers) | ||
206 | // { | ||
207 | // System.Console.WriteLine("Locker name {0} call stack:\n" + kvp.Value, kvp.Key.Name); | ||
208 | // System.Console.WriteLine("------------------------------------------"); | ||
209 | // } | ||
210 | } | ||
211 | m_itemLock = new System.Threading.ReaderWriterLockSlim(); | ||
212 | // ReadLockers.Clear(); | ||
213 | } | ||
214 | |||
215 | LockedByThread = Thread.CurrentThread; | ||
216 | // WriterStack = Environment.StackTrace; | ||
217 | } | ||
218 | else | ||
219 | { | ||
220 | if (m_itemLock.RecursiveWriteCount > 0) | ||
221 | { | ||
222 | m_itemLock.ExitWriteLock(); | ||
223 | } | ||
224 | } | ||
225 | } | ||
48 | 226 | ||
49 | #region ICloneable Members | 227 | #region ICloneable Members |
50 | 228 | ||
@@ -52,14 +230,13 @@ namespace OpenSim.Framework | |||
52 | { | 230 | { |
53 | TaskInventoryDictionary clone = new TaskInventoryDictionary(); | 231 | TaskInventoryDictionary clone = new TaskInventoryDictionary(); |
54 | 232 | ||
55 | lock (this) | 233 | m_itemLock.EnterReadLock(); |
234 | foreach (UUID uuid in Keys) | ||
56 | { | 235 | { |
57 | foreach (UUID uuid in Keys) | 236 | clone.Add(uuid, (TaskInventoryItem) this[uuid].Clone()); |
58 | { | ||
59 | clone.Add(uuid, (TaskInventoryItem) this[uuid].Clone()); | ||
60 | } | ||
61 | } | 237 | } |
62 | 238 | m_itemLock.ExitReadLock(); | |
239 | |||
63 | return clone; | 240 | return clone; |
64 | } | 241 | } |
65 | 242 | ||
diff --git a/OpenSim/Framework/TaskInventoryItem.cs b/OpenSim/Framework/TaskInventoryItem.cs index 3b40381..fb818ee 100644 --- a/OpenSim/Framework/TaskInventoryItem.cs +++ b/OpenSim/Framework/TaskInventoryItem.cs | |||
@@ -72,7 +72,7 @@ namespace OpenSim.Framework | |||
72 | private UUID _loadedID = UUID.Zero; | 72 | private UUID _loadedID = UUID.Zero; |
73 | 73 | ||
74 | private bool _ownerChanged = false; | 74 | private bool _ownerChanged = false; |
75 | 75 | ||
76 | // This used ONLY during copy. It can't be relied on at other times! | 76 | // This used ONLY during copy. It can't be relied on at other times! |
77 | private bool _scriptRunning = true; | 77 | private bool _scriptRunning = true; |
78 | 78 | ||
diff --git a/OpenSim/Framework/Tests/MundaneFrameworkTests.cs b/OpenSim/Framework/Tests/MundaneFrameworkTests.cs index 672847d..6fde488 100644 --- a/OpenSim/Framework/Tests/MundaneFrameworkTests.cs +++ b/OpenSim/Framework/Tests/MundaneFrameworkTests.cs | |||
@@ -217,12 +217,12 @@ namespace OpenSim.Framework.Tests | |||
217 | BannedHostNameMask = string.Empty, | 217 | BannedHostNameMask = string.Empty, |
218 | BannedUserID = bannedUserId} | 218 | BannedUserID = bannedUserId} |
219 | ); | 219 | ); |
220 | Assert.IsTrue(es.IsBanned(bannedUserId), "User Should be banned but is not."); | 220 | Assert.IsTrue(es.IsBanned(bannedUserId, 32), "User Should be banned but is not."); |
221 | Assert.IsFalse(es.IsBanned(UUID.Zero), "User Should not be banned but is."); | 221 | Assert.IsFalse(es.IsBanned(UUID.Zero, 32), "User Should not be banned but is."); |
222 | 222 | ||
223 | es.RemoveBan(bannedUserId); | 223 | es.RemoveBan(bannedUserId); |
224 | 224 | ||
225 | Assert.IsFalse(es.IsBanned(bannedUserId), "User Should not be banned but is."); | 225 | Assert.IsFalse(es.IsBanned(bannedUserId, 32), "User Should not be banned but is."); |
226 | 226 | ||
227 | es.AddEstateManager(UUID.Zero); | 227 | es.AddEstateManager(UUID.Zero); |
228 | 228 | ||
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 5c7797a..74551ea 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs | |||
@@ -481,19 +481,25 @@ namespace OpenSim.Framework | |||
481 | /// </summary> | 481 | /// </summary> |
482 | /// <param name="data"></param> | 482 | /// <param name="data"></param> |
483 | /// <returns></returns> | 483 | /// <returns></returns> |
484 | |||
484 | public static string Md5Hash(string data) | 485 | public static string Md5Hash(string data) |
485 | { | 486 | { |
486 | byte[] dataMd5 = ComputeMD5Hash(data); | 487 | return Md5Hash(data, Encoding.Default); |
488 | } | ||
489 | |||
490 | public static string Md5Hash(string data, Encoding encoding) | ||
491 | { | ||
492 | byte[] dataMd5 = ComputeMD5Hash(data, encoding); | ||
487 | StringBuilder sb = new StringBuilder(); | 493 | StringBuilder sb = new StringBuilder(); |
488 | for (int i = 0; i < dataMd5.Length; i++) | 494 | for (int i = 0; i < dataMd5.Length; i++) |
489 | sb.AppendFormat("{0:x2}", dataMd5[i]); | 495 | sb.AppendFormat("{0:x2}", dataMd5[i]); |
490 | return sb.ToString(); | 496 | return sb.ToString(); |
491 | } | 497 | } |
492 | 498 | ||
493 | private static byte[] ComputeMD5Hash(string data) | 499 | private static byte[] ComputeMD5Hash(string data, Encoding encoding) |
494 | { | 500 | { |
495 | MD5 md5 = MD5.Create(); | 501 | MD5 md5 = MD5.Create(); |
496 | return md5.ComputeHash(Encoding.Default.GetBytes(data)); | 502 | return md5.ComputeHash(encoding.GetBytes(data)); |
497 | } | 503 | } |
498 | 504 | ||
499 | /// <summary> | 505 | /// <summary> |
@@ -501,6 +507,12 @@ namespace OpenSim.Framework | |||
501 | /// </summary> | 507 | /// </summary> |
502 | /// <param name="data"></param> | 508 | /// <param name="data"></param> |
503 | /// <returns></returns> | 509 | /// <returns></returns> |
510 | |||
511 | public static string SHA1Hash(string data, Encoding enc) | ||
512 | { | ||
513 | return SHA1Hash(enc.GetBytes(data)); | ||
514 | } | ||
515 | |||
504 | public static string SHA1Hash(string data) | 516 | public static string SHA1Hash(string data) |
505 | { | 517 | { |
506 | return SHA1Hash(Encoding.Default.GetBytes(data)); | 518 | return SHA1Hash(Encoding.Default.GetBytes(data)); |
@@ -1156,19 +1168,19 @@ namespace OpenSim.Framework | |||
1156 | { | 1168 | { |
1157 | string os = String.Empty; | 1169 | string os = String.Empty; |
1158 | 1170 | ||
1159 | if (Environment.OSVersion.Platform != PlatformID.Unix) | 1171 | // if (Environment.OSVersion.Platform != PlatformID.Unix) |
1160 | { | 1172 | // { |
1161 | os = Environment.OSVersion.ToString(); | 1173 | // os = Environment.OSVersion.ToString(); |
1162 | } | 1174 | // } |
1163 | else | 1175 | // else |
1164 | { | 1176 | // { |
1165 | os = ReadEtcIssue(); | 1177 | // os = ReadEtcIssue(); |
1166 | } | 1178 | // } |
1167 | 1179 | // | |
1168 | if (os.Length > 45) | 1180 | // if (os.Length > 45) |
1169 | { | 1181 | // { |
1170 | os = os.Substring(0, 45); | 1182 | // os = os.Substring(0, 45); |
1171 | } | 1183 | // } |
1172 | 1184 | ||
1173 | return os; | 1185 | return os; |
1174 | } | 1186 | } |
@@ -1300,7 +1312,7 @@ namespace OpenSim.Framework | |||
1300 | 1312 | ||
1301 | public static Guid GetHashGuid(string data, string salt) | 1313 | public static Guid GetHashGuid(string data, string salt) |
1302 | { | 1314 | { |
1303 | byte[] hash = ComputeMD5Hash(data + salt); | 1315 | byte[] hash = ComputeMD5Hash(data + salt, Encoding.Default); |
1304 | 1316 | ||
1305 | //string s = BitConverter.ToString(hash); | 1317 | //string s = BitConverter.ToString(hash); |
1306 | 1318 | ||
diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 5c34cf4..b85d93d 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs | |||
@@ -235,6 +235,7 @@ namespace OpenSim.Framework | |||
235 | catch (Exception ex) | 235 | catch (Exception ex) |
236 | { | 236 | { |
237 | errorMessage = ex.Message; | 237 | errorMessage = ex.Message; |
238 | m_log.Debug("[WEB UTIL]: Exception making request: " + ex.ToString()); | ||
238 | } | 239 | } |
239 | finally | 240 | finally |
240 | { | 241 | { |
@@ -318,7 +319,7 @@ namespace OpenSim.Framework | |||
318 | /// </summary> | 319 | /// </summary> |
319 | public static OSDMap PostToService(string url, NameValueCollection data) | 320 | public static OSDMap PostToService(string url, NameValueCollection data) |
320 | { | 321 | { |
321 | return ServiceFormRequest(url,data,10000); | 322 | return ServiceFormRequest(url,data, 20000); |
322 | } | 323 | } |
323 | 324 | ||
324 | public static OSDMap ServiceFormRequest(string url, NameValueCollection data, int timeout) | 325 | public static OSDMap ServiceFormRequest(string url, NameValueCollection data, int timeout) |
@@ -732,7 +733,8 @@ namespace OpenSim.Framework | |||
732 | reqnum, verb, requestUrl); | 733 | reqnum, verb, requestUrl); |
733 | 734 | ||
734 | int tickstart = Util.EnvironmentTickCount(); | 735 | int tickstart = Util.EnvironmentTickCount(); |
735 | int tickdata = 0; | 736 | // int tickdata = 0; |
737 | int tickdiff = 0; | ||
736 | 738 | ||
737 | Type type = typeof(TRequest); | 739 | Type type = typeof(TRequest); |
738 | 740 | ||
@@ -775,8 +777,8 @@ namespace OpenSim.Framework | |||
775 | requestStream.Close(); | 777 | requestStream.Close(); |
776 | 778 | ||
777 | // capture how much time was spent writing | 779 | // capture how much time was spent writing |
778 | tickdata = Util.EnvironmentTickCountSubtract(tickstart); | 780 | // useless in this async |
779 | 781 | // tickdata = Util.EnvironmentTickCountSubtract(tickstart); | |
780 | request.BeginGetResponse(delegate(IAsyncResult ar) | 782 | request.BeginGetResponse(delegate(IAsyncResult ar) |
781 | { | 783 | { |
782 | response = request.EndGetResponse(ar); | 784 | response = request.EndGetResponse(ar); |
@@ -793,7 +795,8 @@ namespace OpenSim.Framework | |||
793 | finally | 795 | finally |
794 | { | 796 | { |
795 | // Let's not close this | 797 | // Let's not close this |
796 | //buffer.Close(); | 798 | // yes do close it |
799 | buffer.Close(); | ||
797 | respStream.Close(); | 800 | respStream.Close(); |
798 | response.Close(); | 801 | response.Close(); |
799 | } | 802 | } |
@@ -861,7 +864,6 @@ namespace OpenSim.Framework | |||
861 | } | 864 | } |
862 | 865 | ||
863 | // m_log.DebugFormat("[ASYNC REQUEST]: Received {0}", deserial.ToString()); | 866 | // m_log.DebugFormat("[ASYNC REQUEST]: Received {0}", deserial.ToString()); |
864 | |||
865 | try | 867 | try |
866 | { | 868 | { |
867 | action(deserial); | 869 | action(deserial); |
@@ -876,9 +878,10 @@ namespace OpenSim.Framework | |||
876 | }, null); | 878 | }, null); |
877 | } | 879 | } |
878 | 880 | ||
879 | int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); | 881 | tickdiff = Util.EnvironmentTickCountSubtract(tickstart); |
880 | if (tickdiff > WebUtil.LongCallTime) | 882 | if (tickdiff > WebUtil.LongCallTime) |
881 | { | 883 | { |
884 | /* | ||
882 | string originalRequest = null; | 885 | string originalRequest = null; |
883 | 886 | ||
884 | if (buffer != null) | 887 | if (buffer != null) |
@@ -897,12 +900,19 @@ namespace OpenSim.Framework | |||
897 | tickdiff, | 900 | tickdiff, |
898 | tickdata, | 901 | tickdata, |
899 | originalRequest); | 902 | originalRequest); |
903 | */ | ||
904 | m_log.InfoFormat( | ||
905 | "[ASYNC REQUEST]: Slow WebRequest SETUP <{0}> {1} {2} took {3}ms", | ||
906 | reqnum, | ||
907 | verb, | ||
908 | requestUrl, | ||
909 | tickdiff); | ||
900 | } | 910 | } |
901 | else if (WebUtil.DebugLevel >= 4) | 911 | else if (WebUtil.DebugLevel >= 4) |
902 | { | 912 | { |
903 | m_log.DebugFormat( | 913 | m_log.DebugFormat( |
904 | "[WEB UTIL]: HTTP OUT {0} took {1}ms, {2}ms writing", | 914 | "[WEB UTIL]: HTTP OUT {0} took {1}ms", |
905 | reqnum, tickdiff, tickdata); | 915 | reqnum, tickdiff); |
906 | } | 916 | } |
907 | } | 917 | } |
908 | } | 918 | } |
@@ -937,6 +947,8 @@ namespace OpenSim.Framework | |||
937 | request.Method = verb; | 947 | request.Method = verb; |
938 | string respstring = String.Empty; | 948 | string respstring = String.Empty; |
939 | 949 | ||
950 | int tickset = Util.EnvironmentTickCountSubtract(tickstart); | ||
951 | |||
940 | using (MemoryStream buffer = new MemoryStream()) | 952 | using (MemoryStream buffer = new MemoryStream()) |
941 | { | 953 | { |
942 | if ((verb == "POST") || (verb == "PUT")) | 954 | if ((verb == "POST") || (verb == "PUT")) |
@@ -1018,6 +1030,7 @@ namespace OpenSim.Framework | |||
1018 | verb, | 1030 | verb, |
1019 | requestUrl, | 1031 | requestUrl, |
1020 | tickdiff, | 1032 | tickdiff, |
1033 | tickset, | ||
1021 | tickdata, | 1034 | tickdata, |
1022 | obj.Length > WebUtil.MaxRequestDiagLength ? obj.Remove(WebUtil.MaxRequestDiagLength) : obj); | 1035 | obj.Length > WebUtil.MaxRequestDiagLength ? obj.Remove(WebUtil.MaxRequestDiagLength) : obj); |
1023 | else if (WebUtil.DebugLevel >= 4) | 1036 | else if (WebUtil.DebugLevel >= 4) |
@@ -1076,6 +1089,8 @@ namespace OpenSim.Framework | |||
1076 | ht.ServicePoint.ConnectionLimit = maxConnections; | 1089 | ht.ServicePoint.ConnectionLimit = maxConnections; |
1077 | 1090 | ||
1078 | request.Method = verb; | 1091 | request.Method = verb; |
1092 | if (pTimeout != 0) | ||
1093 | request.Timeout = pTimeout * 1000; | ||
1079 | MemoryStream buffer = null; | 1094 | MemoryStream buffer = null; |
1080 | 1095 | ||
1081 | if ((verb == "POST") || (verb == "PUT")) | 1096 | if ((verb == "POST") || (verb == "PUT")) |