diff options
Diffstat (limited to 'OpenSim/Framework')
42 files changed, 1419 insertions, 476 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 494ae5e..b7a0adf 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs | |||
@@ -40,8 +40,17 @@ namespace OpenSim.Framework | |||
40 | /// </summary> | 40 | /// </summary> |
41 | public class AvatarAppearance | 41 | public class AvatarAppearance |
42 | { | 42 | { |
43 | // SL box diferent to size | ||
44 | const float AVBOXAJUST = 0.2f; | ||
45 | // constrains for ubitode physics | ||
46 | const float AVBOXMINX = 0.2f; | ||
47 | const float AVBOXMINY = 0.3f; | ||
48 | const float AVBOXMINZ = 1.2f; | ||
49 | |||
43 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 50 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
44 | 51 | ||
52 | // this is viewer capabilities and weared things dependent | ||
53 | // should be only used as initial default value ( V1 viewers ) | ||
45 | public readonly static int VISUALPARAM_COUNT = 218; | 54 | public readonly static int VISUALPARAM_COUNT = 218; |
46 | 55 | ||
47 | public readonly static int TEXTURE_COUNT = 21; | 56 | public readonly static int TEXTURE_COUNT = 21; |
@@ -53,6 +62,12 @@ namespace OpenSim.Framework | |||
53 | protected AvatarWearable[] m_wearables; | 62 | protected AvatarWearable[] m_wearables; |
54 | protected Dictionary<int, List<AvatarAttachment>> m_attachments; | 63 | protected Dictionary<int, List<AvatarAttachment>> m_attachments; |
55 | protected float m_avatarHeight = 0; | 64 | protected float m_avatarHeight = 0; |
65 | protected Vector3 m_avatarSize = new Vector3(0.45f, 0.6f, 1.9f); // sl Z cloud value | ||
66 | protected Vector3 m_avatarBoxSize = new Vector3(0.45f, 0.6f, 1.9f); | ||
67 | protected float m_avatarFeetOffset = 0; | ||
68 | protected float m_avatarAnimOffset = 0; | ||
69 | protected WearableCacheItem[] m_cacheitems; | ||
70 | protected bool m_cacheItemsDirty = true; | ||
56 | 71 | ||
57 | public virtual int Serial | 72 | public virtual int Serial |
58 | { | 73 | { |
@@ -66,6 +81,21 @@ namespace OpenSim.Framework | |||
66 | set { m_visualparams = value; } | 81 | set { m_visualparams = value; } |
67 | } | 82 | } |
68 | 83 | ||
84 | public virtual Vector3 AvatarSize | ||
85 | { | ||
86 | get { return m_avatarSize; } | ||
87 | } | ||
88 | |||
89 | public virtual Vector3 AvatarBoxSize | ||
90 | { | ||
91 | get { return m_avatarBoxSize; } | ||
92 | } | ||
93 | |||
94 | public virtual float AvatarFeetOffset | ||
95 | { | ||
96 | get { return m_avatarFeetOffset + m_avatarAnimOffset; } | ||
97 | } | ||
98 | |||
69 | public virtual Primitive.TextureEntry Texture | 99 | public virtual Primitive.TextureEntry Texture |
70 | { | 100 | { |
71 | get { return m_texture; } | 101 | get { return m_texture; } |
@@ -87,6 +117,18 @@ namespace OpenSim.Framework | |||
87 | get { return m_avatarHeight; } | 117 | get { return m_avatarHeight; } |
88 | set { m_avatarHeight = value; } | 118 | set { m_avatarHeight = value; } |
89 | } | 119 | } |
120 | |||
121 | public virtual WearableCacheItem[] WearableCacheItems | ||
122 | { | ||
123 | get { return m_cacheitems; } | ||
124 | set { m_cacheitems = value; } | ||
125 | } | ||
126 | |||
127 | public virtual bool WearableCacheItemsDirty | ||
128 | { | ||
129 | get { return m_cacheItemsDirty; } | ||
130 | set { m_cacheItemsDirty = value; } | ||
131 | } | ||
90 | 132 | ||
91 | public AvatarAppearance() | 133 | public AvatarAppearance() |
92 | { | 134 | { |
@@ -96,7 +138,8 @@ namespace OpenSim.Framework | |||
96 | SetDefaultWearables(); | 138 | SetDefaultWearables(); |
97 | SetDefaultTexture(); | 139 | SetDefaultTexture(); |
98 | SetDefaultParams(); | 140 | SetDefaultParams(); |
99 | SetHeight(); | 141 | // SetHeight(); |
142 | SetSize(new Vector3(0.45f,0.6f,1.9f)); | ||
100 | m_attachments = new Dictionary<int, List<AvatarAttachment>>(); | 143 | m_attachments = new Dictionary<int, List<AvatarAttachment>>(); |
101 | } | 144 | } |
102 | 145 | ||
@@ -105,7 +148,7 @@ namespace OpenSim.Framework | |||
105 | // m_log.WarnFormat("[AVATAR APPEARANCE]: create appearance from OSDMap"); | 148 | // m_log.WarnFormat("[AVATAR APPEARANCE]: create appearance from OSDMap"); |
106 | 149 | ||
107 | Unpack(map); | 150 | Unpack(map); |
108 | SetHeight(); | 151 | // SetHeight(); done in Unpack |
109 | } | 152 | } |
110 | 153 | ||
111 | public AvatarAppearance(AvatarWearable[] wearables, Primitive.TextureEntry textureEntry, byte[] visualParams) | 154 | public AvatarAppearance(AvatarWearable[] wearables, Primitive.TextureEntry textureEntry, byte[] visualParams) |
@@ -129,7 +172,9 @@ namespace OpenSim.Framework | |||
129 | else | 172 | else |
130 | SetDefaultParams(); | 173 | SetDefaultParams(); |
131 | 174 | ||
132 | SetHeight(); | 175 | // SetHeight(); |
176 | if(m_avatarHeight == 0) | ||
177 | SetSize(new Vector3(0.45f,0.6f,1.9f)); | ||
133 | 178 | ||
134 | m_attachments = new Dictionary<int, List<AvatarAttachment>>(); | 179 | m_attachments = new Dictionary<int, List<AvatarAttachment>>(); |
135 | } | 180 | } |
@@ -148,7 +193,8 @@ namespace OpenSim.Framework | |||
148 | SetDefaultWearables(); | 193 | SetDefaultWearables(); |
149 | SetDefaultTexture(); | 194 | SetDefaultTexture(); |
150 | SetDefaultParams(); | 195 | SetDefaultParams(); |
151 | SetHeight(); | 196 | // SetHeight(); |
197 | SetSize(new Vector3(0.45f, 0.6f, 1.9f)); | ||
152 | m_attachments = new Dictionary<int, List<AvatarAttachment>>(); | 198 | m_attachments = new Dictionary<int, List<AvatarAttachment>>(); |
153 | 199 | ||
154 | return; | 200 | return; |
@@ -177,7 +223,8 @@ namespace OpenSim.Framework | |||
177 | if (appearance.VisualParams != null) | 223 | if (appearance.VisualParams != null) |
178 | m_visualparams = (byte[])appearance.VisualParams.Clone(); | 224 | m_visualparams = (byte[])appearance.VisualParams.Clone(); |
179 | 225 | ||
180 | m_avatarHeight = appearance.m_avatarHeight; | 226 | // m_avatarHeight = appearance.m_avatarHeight; |
227 | SetSize(appearance.AvatarSize); | ||
181 | 228 | ||
182 | // Copy the attachment, force append mode since that ensures consistency | 229 | // Copy the attachment, force append mode since that ensures consistency |
183 | m_attachments = new Dictionary<int, List<AvatarAttachment>>(); | 230 | m_attachments = new Dictionary<int, List<AvatarAttachment>>(); |
@@ -240,6 +287,21 @@ namespace OpenSim.Framework | |||
240 | // } | 287 | // } |
241 | } | 288 | } |
242 | 289 | ||
290 | /// <summary> | ||
291 | /// Invalidate all of the baked textures in the appearance, useful | ||
292 | /// if you know that none are valid | ||
293 | /// </summary> | ||
294 | public virtual void ResetBakedTextures() | ||
295 | { | ||
296 | SetDefaultTexture(); | ||
297 | |||
298 | //for (int i = 0; i < BAKE_INDICES.Length; i++) | ||
299 | // { | ||
300 | // int idx = BAKE_INDICES[i]; | ||
301 | // m_texture.FaceTextures[idx].TextureID = UUID.Zero; | ||
302 | // } | ||
303 | } | ||
304 | |||
243 | protected virtual void SetDefaultTexture() | 305 | protected virtual void SetDefaultTexture() |
244 | { | 306 | { |
245 | m_texture = new Primitive.TextureEntry(new UUID(AppearanceManager.DEFAULT_AVATAR_TEXTURE)); | 307 | m_texture = new Primitive.TextureEntry(new UUID(AppearanceManager.DEFAULT_AVATAR_TEXTURE)); |
@@ -304,22 +366,33 @@ namespace OpenSim.Framework | |||
304 | // made. We determine if any of the visual parameters actually | 366 | // made. We determine if any of the visual parameters actually |
305 | // changed to know if the appearance should be saved later | 367 | // changed to know if the appearance should be saved later |
306 | bool changed = false; | 368 | bool changed = false; |
307 | for (int i = 0; i < AvatarAppearance.VISUALPARAM_COUNT; i++) | 369 | |
370 | int newsize = visualParams.Length; | ||
371 | |||
372 | if (newsize != m_visualparams.Length) | ||
308 | { | 373 | { |
309 | if (visualParams[i] != m_visualparams[i]) | 374 | changed = true; |
375 | m_visualparams = (byte[])visualParams.Clone(); | ||
376 | } | ||
377 | else | ||
378 | { | ||
379 | |||
380 | for (int i = 0; i < newsize; i++) | ||
310 | { | 381 | { |
311 | // DEBUG ON | 382 | if (visualParams[i] != m_visualparams[i]) |
312 | // m_log.WarnFormat("[AVATARAPPEARANCE] vparams changed [{0}] {1} ==> {2}", | 383 | { |
313 | // i,m_visualparams[i],visualParams[i]); | 384 | // DEBUG ON |
314 | // DEBUG OFF | 385 | // m_log.WarnFormat("[AVATARAPPEARANCE] vparams changed [{0}] {1} ==> {2}", |
315 | m_visualparams[i] = visualParams[i]; | 386 | // i,m_visualparams[i],visualParams[i]); |
316 | changed = true; | 387 | // DEBUG OFF |
388 | m_visualparams[i] = visualParams[i]; | ||
389 | changed = true; | ||
390 | } | ||
317 | } | 391 | } |
318 | } | 392 | } |
319 | |||
320 | // Reset the height if the visual parameters actually changed | 393 | // Reset the height if the visual parameters actually changed |
321 | if (changed) | 394 | // if (changed) |
322 | SetHeight(); | 395 | // SetHeight(); |
323 | 396 | ||
324 | return changed; | 397 | return changed; |
325 | } | 398 | } |
@@ -335,6 +408,7 @@ namespace OpenSim.Framework | |||
335 | /// </summary> | 408 | /// </summary> |
336 | public virtual void SetHeight() | 409 | public virtual void SetHeight() |
337 | { | 410 | { |
411 | /* | ||
338 | // Start with shortest possible female avatar height | 412 | // Start with shortest possible female avatar height |
339 | m_avatarHeight = 1.14597f; | 413 | m_avatarHeight = 1.14597f; |
340 | // Add offset for male avatars | 414 | // Add offset for male avatars |
@@ -347,6 +421,35 @@ namespace OpenSim.Framework | |||
347 | + 0.07f * (float)m_visualparams[(int)VPElement.SHOES_PLATFORM_HEIGHT] / 255.0f | 421 | + 0.07f * (float)m_visualparams[(int)VPElement.SHOES_PLATFORM_HEIGHT] / 255.0f |
348 | + 0.08f * (float)m_visualparams[(int)VPElement.SHOES_HEEL_HEIGHT] / 255.0f | 422 | + 0.08f * (float)m_visualparams[(int)VPElement.SHOES_HEEL_HEIGHT] / 255.0f |
349 | + 0.076f * (float)m_visualparams[(int)VPElement.SHAPE_NECK_LENGTH] / 255.0f; | 423 | + 0.076f * (float)m_visualparams[(int)VPElement.SHAPE_NECK_LENGTH] / 255.0f; |
424 | */ | ||
425 | } | ||
426 | |||
427 | public void SetSize(Vector3 avSize) | ||
428 | { | ||
429 | if (avSize.X > 32f) | ||
430 | avSize.X = 32f; | ||
431 | else if (avSize.X < 0.1f) | ||
432 | avSize.X = 0.1f; | ||
433 | |||
434 | if (avSize.Y > 32f) | ||
435 | avSize.Y = 32f; | ||
436 | else if (avSize.Y < 0.1f) | ||
437 | avSize.Y = 0.1f; | ||
438 | if (avSize.Z > 32f) | ||
439 | avSize.Z = 32f; | ||
440 | else if (avSize.Z < 0.1f) | ||
441 | avSize.Z = 0.1f; | ||
442 | |||
443 | m_avatarSize = avSize; | ||
444 | m_avatarBoxSize = avSize; | ||
445 | m_avatarBoxSize.Z += AVBOXAJUST; | ||
446 | if (m_avatarBoxSize.X < AVBOXMINX) | ||
447 | m_avatarBoxSize.X = AVBOXMINX; | ||
448 | if (m_avatarBoxSize.Y < AVBOXMINY) | ||
449 | m_avatarBoxSize.Y = AVBOXMINY; | ||
450 | if (m_avatarBoxSize.Z < AVBOXMINZ) | ||
451 | m_avatarBoxSize.Z = AVBOXMINZ; | ||
452 | m_avatarHeight = m_avatarSize.Z; | ||
350 | } | 453 | } |
351 | 454 | ||
352 | public virtual void SetWearable(int wearableId, AvatarWearable wearable) | 455 | public virtual void SetWearable(int wearableId, AvatarWearable wearable) |
@@ -377,7 +480,8 @@ namespace OpenSim.Framework | |||
377 | } | 480 | } |
378 | 481 | ||
379 | s += "Visual Params: "; | 482 | s += "Visual Params: "; |
380 | for (uint j = 0; j < AvatarAppearance.VISUALPARAM_COUNT; j++) | 483 | // for (uint j = 0; j < AvatarAppearance.VISUALPARAM_COUNT; j++) |
484 | for (uint j = 0; j < m_visualparams.Length; j++) | ||
381 | s += String.Format("{0},",m_visualparams[j]); | 485 | s += String.Format("{0},",m_visualparams[j]); |
382 | s += "\n"; | 486 | s += "\n"; |
383 | 487 | ||
@@ -393,18 +497,16 @@ namespace OpenSim.Framework | |||
393 | /// </remarks> | 497 | /// </remarks> |
394 | public List<AvatarAttachment> GetAttachments() | 498 | public List<AvatarAttachment> GetAttachments() |
395 | { | 499 | { |
396 | List<AvatarAttachment> alist = new List<AvatarAttachment>(); | ||
397 | |||
398 | lock (m_attachments) | 500 | lock (m_attachments) |
399 | { | 501 | { |
502 | List<AvatarAttachment> alist = new List<AvatarAttachment>(); | ||
400 | foreach (KeyValuePair<int, List<AvatarAttachment>> kvp in m_attachments) | 503 | foreach (KeyValuePair<int, List<AvatarAttachment>> kvp in m_attachments) |
401 | { | 504 | { |
402 | foreach (AvatarAttachment attach in kvp.Value) | 505 | foreach (AvatarAttachment attach in kvp.Value) |
403 | alist.Add(new AvatarAttachment(attach)); | 506 | alist.Add(new AvatarAttachment(attach)); |
404 | } | 507 | } |
405 | } | 508 | return alist; |
406 | 509 | } | |
407 | return alist; | ||
408 | } | 510 | } |
409 | 511 | ||
410 | internal void AppendAttachment(AvatarAttachment attach) | 512 | internal void AppendAttachment(AvatarAttachment attach) |
@@ -548,7 +650,6 @@ namespace OpenSim.Framework | |||
548 | return kvp.Key; | 650 | return kvp.Key; |
549 | } | 651 | } |
550 | } | 652 | } |
551 | |||
552 | return 0; | 653 | return 0; |
553 | } | 654 | } |
554 | 655 | ||
@@ -619,12 +720,14 @@ namespace OpenSim.Framework | |||
619 | OSDBinary visualparams = new OSDBinary(m_visualparams); | 720 | OSDBinary visualparams = new OSDBinary(m_visualparams); |
620 | data["visualparams"] = visualparams; | 721 | data["visualparams"] = visualparams; |
621 | 722 | ||
622 | // Attachments | 723 | lock (m_attachments) |
623 | List<AvatarAttachment> attachments = GetAttachments(); | 724 | { |
624 | OSDArray attachs = new OSDArray(attachments.Count); | 725 | // Attachments |
625 | foreach (AvatarAttachment attach in GetAttachments()) | 726 | OSDArray attachs = new OSDArray(m_attachments.Count); |
626 | attachs.Add(attach.Pack()); | 727 | foreach (AvatarAttachment attach in GetAttachments()) |
627 | data["attachments"] = attachs; | 728 | attachs.Add(attach.Pack()); |
729 | data["attachments"] = attachs; | ||
730 | } | ||
628 | 731 | ||
629 | return data; | 732 | return data; |
630 | } | 733 | } |
@@ -638,7 +741,8 @@ namespace OpenSim.Framework | |||
638 | if ((data != null) && (data["serial"] != null)) | 741 | if ((data != null) && (data["serial"] != null)) |
639 | m_serial = data["serial"].AsInteger(); | 742 | m_serial = data["serial"].AsInteger(); |
640 | if ((data != null) && (data["height"] != null)) | 743 | if ((data != null) && (data["height"] != null)) |
641 | m_avatarHeight = (float)data["height"].AsReal(); | 744 | // m_avatarHeight = (float)data["height"].AsReal(); |
745 | SetSize(new Vector3(0.45f,0.6f, (float)data["height"].AsReal())); | ||
642 | 746 | ||
643 | try | 747 | try |
644 | { | 748 | { |
@@ -1471,7 +1575,58 @@ namespace OpenSim.Framework | |||
1471 | SHAPE_EYELID_INNER_CORNER_UP = 214, | 1575 | SHAPE_EYELID_INNER_CORNER_UP = 214, |
1472 | SKIRT_SKIRT_RED = 215, | 1576 | SKIRT_SKIRT_RED = 215, |
1473 | SKIRT_SKIRT_GREEN = 216, | 1577 | SKIRT_SKIRT_GREEN = 216, |
1474 | SKIRT_SKIRT_BLUE = 217 | 1578 | SKIRT_SKIRT_BLUE = 217, |
1579 | |||
1580 | /// <summary> | ||
1581 | /// Avatar Physics section. These are 0 type visual params which get transmitted. | ||
1582 | /// </summary> | ||
1583 | |||
1584 | /// <summary> | ||
1585 | /// Breast Part 1 | ||
1586 | /// </summary> | ||
1587 | BREAST_PHYSICS_MASS = 218, | ||
1588 | BREAST_PHYSICS_GRAVITY = 219, | ||
1589 | BREAST_PHYSICS_DRAG = 220, | ||
1590 | BREAST_PHYSICS_UPDOWN_MAX_EFFECT = 221, | ||
1591 | BREAST_PHYSICS_UPDOWN_SPRING = 222, | ||
1592 | BREAST_PHYSICS_UPDOWN_GAIN = 223, | ||
1593 | BREAST_PHYSICS_UPDOWN_DAMPING = 224, | ||
1594 | BREAST_PHYSICS_INOUT_MAX_EFFECT = 225, | ||
1595 | BREAST_PHYSICS_INOUT_SPRING = 226, | ||
1596 | BREAST_PHYSICS_INOUT_GAIN = 227, | ||
1597 | BREAST_PHYSICS_INOUT_DAMPING = 228, | ||
1598 | /// <summary> | ||
1599 | /// Belly | ||
1600 | /// </summary> | ||
1601 | BELLY_PHYISCS_MASS = 229, | ||
1602 | BELLY_PHYSICS_GRAVITY = 230, | ||
1603 | BELLY_PHYSICS_DRAG = 231, | ||
1604 | BELLY_PHYISCS_UPDOWN_MAX_EFFECT = 232, | ||
1605 | BELLY_PHYSICS_UPDOWN_SPRING = 233, | ||
1606 | BELLY_PHYSICS_UPDOWN_GAIN = 234, | ||
1607 | BELLY_PHYSICS_UPDOWN_DAMPING = 235, | ||
1608 | |||
1609 | /// <summary> | ||
1610 | /// Butt | ||
1611 | /// </summary> | ||
1612 | BUTT_PHYSICS_MASS = 236, | ||
1613 | BUTT_PHYSICS_GRAVITY = 237, | ||
1614 | BUTT_PHYSICS_DRAG = 238, | ||
1615 | BUTT_PHYSICS_UPDOWN_MAX_EFFECT = 239, | ||
1616 | BUTT_PHYSICS_UPDOWN_SPRING = 240, | ||
1617 | BUTT_PHYSICS_UPDOWN_GAIN = 241, | ||
1618 | BUTT_PHYSICS_UPDOWN_DAMPING = 242, | ||
1619 | BUTT_PHYSICS_LEFTRIGHT_MAX_EFFECT = 243, | ||
1620 | BUTT_PHYSICS_LEFTRIGHT_SPRING = 244, | ||
1621 | BUTT_PHYSICS_LEFTRIGHT_GAIN = 245, | ||
1622 | BUTT_PHYSICS_LEFTRIGHT_DAMPING = 246, | ||
1623 | /// <summary> | ||
1624 | /// Breast Part 2 | ||
1625 | /// </summary> | ||
1626 | BREAST_PHYSICS_LEFTRIGHT_MAX_EFFECT = 247, | ||
1627 | BREAST_PHYSICS_LEFTRIGHT_SPRING= 248, | ||
1628 | BREAST_PHYSICS_LEFTRIGHT_GAIN = 249, | ||
1629 | BREAST_PHYSICS_LEFTRIGHT_DAMPING = 250 | ||
1475 | } | 1630 | } |
1476 | #endregion | 1631 | #endregion |
1477 | } | 1632 | } |
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 dfe60aa..8c32734 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) |
@@ -310,6 +315,8 @@ namespace OpenSim.Framework | |||
310 | public Animation AnimState = null; | 315 | public Animation AnimState = null; |
311 | 316 | ||
312 | public UUID GranterID; | 317 | public UUID GranterID; |
318 | public UUID ParentPart; | ||
319 | public Vector3 SitOffset; | ||
313 | 320 | ||
314 | // Appearance | 321 | // Appearance |
315 | public AvatarAppearance Appearance; | 322 | public AvatarAppearance Appearance; |
@@ -480,6 +487,10 @@ namespace OpenSim.Framework | |||
480 | } | 487 | } |
481 | args["attach_objects"] = attObjs; | 488 | args["attach_objects"] = attObjs; |
482 | } | 489 | } |
490 | |||
491 | args["parent_part"] = OSD.FromUUID(ParentPart); | ||
492 | args["sit_offset"] = OSD.FromString(SitOffset.ToString()); | ||
493 | |||
483 | return args; | 494 | return args; |
484 | } | 495 | } |
485 | 496 | ||
@@ -711,6 +722,11 @@ namespace OpenSim.Framework | |||
711 | } | 722 | } |
712 | } | 723 | } |
713 | } | 724 | } |
725 | |||
726 | if (args["parent_part"] != null) | ||
727 | ParentPart = args["parent_part"].AsUUID(); | ||
728 | if (args["sit_offset"] != null) | ||
729 | Vector3.TryParse(args["sit_offset"].AsString(), out SitOffset); | ||
714 | } | 730 | } |
715 | 731 | ||
716 | public AgentData() | 732 | 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/CommandConsole.cs b/OpenSim/Framework/Console/CommandConsole.cs index b9f402a..9490013 100644 --- a/OpenSim/Framework/Console/CommandConsole.cs +++ b/OpenSim/Framework/Console/CommandConsole.cs | |||
@@ -83,7 +83,7 @@ namespace OpenSim.Framework.Console | |||
83 | = "To enter an argument that contains spaces, surround the argument with double quotes.\nFor example, show object name \"My long object name\"\n"; | 83 | = "To enter an argument that contains spaces, surround the argument with double quotes.\nFor example, show object name \"My long object name\"\n"; |
84 | 84 | ||
85 | public const string ItemHelpText | 85 | public const string ItemHelpText |
86 | = @"For more information, type 'help all' to get a list of all commands, | 86 | = @"For more information, type 'help' to get a list of all commands, |
87 | or type help <item>' where <item> is one of the following:"; | 87 | or type help <item>' where <item> is one of the following:"; |
88 | 88 | ||
89 | /// <value> | 89 | /// <value> |
@@ -116,12 +116,14 @@ namespace OpenSim.Framework.Console | |||
116 | if (helpParts.Count == 0) | 116 | if (helpParts.Count == 0) |
117 | { | 117 | { |
118 | help.Add(GeneralHelpText); | 118 | help.Add(GeneralHelpText); |
119 | help.Add(ItemHelpText); | 119 | help.AddRange(CollectAllCommandsHelp()); |
120 | help.AddRange(CollectModulesHelp(tree)); | ||
121 | } | 120 | } |
122 | else if (helpParts.Count == 1 && helpParts[0] == "all") | 121 | else if (helpParts.Count == 1 && helpParts[0] == "categories") |
123 | { | 122 | { |
124 | help.AddRange(CollectAllCommandsHelp()); | 123 | help.Add(""); // Will become a newline. |
124 | help.Add(GeneralHelpText); | ||
125 | help.Add(ItemHelpText); | ||
126 | help.AddRange(CollectModulesHelp(tree)); | ||
125 | } | 127 | } |
126 | else | 128 | else |
127 | { | 129 | { |
@@ -145,8 +147,11 @@ namespace OpenSim.Framework.Console | |||
145 | { | 147 | { |
146 | foreach (List<CommandInfo> commands in m_modulesCommands.Values) | 148 | foreach (List<CommandInfo> commands in m_modulesCommands.Values) |
147 | { | 149 | { |
148 | var ourHelpText = commands.ConvertAll(c => string.Format("{0} - {1}", c.help_text, c.long_help)); | 150 | foreach (CommandInfo c in commands) |
149 | help.AddRange(ourHelpText); | 151 | { |
152 | if (c.long_help != String.Empty) | ||
153 | help.Add(string.Format("{0} - {1}", c.help_text, c.long_help)); | ||
154 | } | ||
150 | } | 155 | } |
151 | } | 156 | } |
152 | 157 | ||
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/GridInstantMessage.cs b/OpenSim/Framework/GridInstantMessage.cs index 6ae0488..da3690c 100644 --- a/OpenSim/Framework/GridInstantMessage.cs +++ b/OpenSim/Framework/GridInstantMessage.cs | |||
@@ -53,6 +53,24 @@ namespace OpenSim.Framework | |||
53 | binaryBucket = new byte[0]; | 53 | binaryBucket = new byte[0]; |
54 | } | 54 | } |
55 | 55 | ||
56 | public GridInstantMessage(GridInstantMessage im, bool addTimestamp) | ||
57 | { | ||
58 | fromAgentID = im.fromAgentID; | ||
59 | fromAgentName = im.fromAgentName; | ||
60 | toAgentID = im.toAgentID; | ||
61 | dialog = im.dialog; | ||
62 | fromGroup = im.fromGroup; | ||
63 | message = im.message; | ||
64 | imSessionID = im.imSessionID; | ||
65 | offline = im.offline; | ||
66 | Position = im.Position; | ||
67 | binaryBucket = im.binaryBucket; | ||
68 | RegionID = im.RegionID; | ||
69 | |||
70 | if (addTimestamp) | ||
71 | timestamp = (uint)Util.UnixTimeSinceEpoch(); | ||
72 | } | ||
73 | |||
56 | public GridInstantMessage(IScene scene, UUID _fromAgentID, | 74 | public GridInstantMessage(IScene scene, UUID _fromAgentID, |
57 | string _fromAgentName, UUID _toAgentID, | 75 | string _fromAgentName, UUID _toAgentID, |
58 | byte _dialog, bool _fromGroup, string _message, | 76 | byte _dialog, bool _fromGroup, string _message, |
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index f6b7689..ad3471a 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs | |||
@@ -64,12 +64,14 @@ namespace OpenSim.Framework | |||
64 | 64 | ||
65 | public delegate void NetworkStats(int inPackets, int outPackets, int unAckedBytes); | 65 | public delegate void NetworkStats(int inPackets, int outPackets, int unAckedBytes); |
66 | 66 | ||
67 | public delegate void SetAppearance(IClientAPI remoteClient, Primitive.TextureEntry textureEntry, byte[] visualParams); | 67 | public delegate void SetAppearance(IClientAPI remoteClient, Primitive.TextureEntry textureEntry, byte[] visualParams, Vector3 AvSize, WearableCacheItem[] CacheItems); |
68 | 68 | ||
69 | public delegate void StartAnim(IClientAPI remoteClient, UUID animID); | 69 | public delegate void StartAnim(IClientAPI remoteClient, UUID animID); |
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); |
@@ -130,6 +132,8 @@ namespace OpenSim.Framework | |||
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 | ||
@@ -313,7 +320,7 @@ namespace OpenSim.Framework | |||
313 | public delegate void ObjectPermissions( | 320 | public delegate void ObjectPermissions( |
314 | IClientAPI controller, UUID agentID, UUID sessionID, byte field, uint localId, uint mask, byte set); | 321 | IClientAPI controller, UUID agentID, UUID sessionID, byte field, uint localId, uint mask, byte set); |
315 | 322 | ||
316 | public delegate void EconomyDataRequest(UUID agentID); | 323 | public delegate void EconomyDataRequest(IClientAPI client); |
317 | 324 | ||
318 | public delegate void ObjectIncludeInSearch(IClientAPI remoteClient, bool IncludeInSearch, uint localID); | 325 | public delegate void ObjectIncludeInSearch(IClientAPI remoteClient, bool IncludeInSearch, uint localID); |
319 | 326 | ||
@@ -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,11 +1048,12 @@ 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; |
1042 | event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate; | 1055 | event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate; |
1043 | 1056 | event GenericCall2 OnUpdateThrottles; | |
1044 | /// <summary> | 1057 | /// <summary> |
1045 | /// Set the debug level at which packet output should be printed to console. | 1058 | /// Set the debug level at which packet output should be printed to console. |
1046 | /// </summary> | 1059 | /// </summary> |
@@ -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 | ||
@@ -1116,8 +1129,8 @@ namespace OpenSim.Framework | |||
1116 | 1129 | ||
1117 | void SendInstantMessage(GridInstantMessage im); | 1130 | void SendInstantMessage(GridInstantMessage im); |
1118 | 1131 | ||
1119 | void SendGenericMessage(string method, List<string> message); | 1132 | void SendGenericMessage(string method, UUID invoice, List<string> message); |
1120 | void SendGenericMessage(string method, List<byte[]> message); | 1133 | void SendGenericMessage(string method, UUID invoice, List<byte[]> message); |
1121 | 1134 | ||
1122 | void SendLayerData(float[] map); | 1135 | void SendLayerData(float[] map); |
1123 | void SendLayerData(int px, int py, float[] map); | 1136 | void SendLayerData(int px, int py, float[] map); |
@@ -1155,13 +1168,16 @@ namespace OpenSim.Framework | |||
1155 | void SendTeleportStart(uint flags); | 1168 | void SendTeleportStart(uint flags); |
1156 | void SendTeleportProgress(uint flags, string message); | 1169 | void SendTeleportProgress(uint flags, string message); |
1157 | 1170 | ||
1158 | void SendMoneyBalance(UUID transaction, bool success, byte[] description, int balance); | 1171 | void SendMoneyBalance(UUID transaction, bool success, byte[] description, int balance, int transactionType, UUID sourceID, bool sourceIsGroup, UUID destID, bool destIsGroup, int amount, string item); |
1172 | |||
1159 | void SendPayPrice(UUID objectID, int[] payPrice); | 1173 | void SendPayPrice(UUID objectID, int[] payPrice); |
1160 | 1174 | ||
1161 | void SendCoarseLocationUpdate(List<UUID> users, List<Vector3> CoarseLocations); | 1175 | void SendCoarseLocationUpdate(List<UUID> users, List<Vector3> CoarseLocations); |
1162 | 1176 | ||
1163 | void SetChildAgentThrottle(byte[] throttle); | 1177 | void SetChildAgentThrottle(byte[] throttle); |
1164 | 1178 | ||
1179 | void SetAgentThrottleSilent(int throttle, int setting); | ||
1180 | |||
1165 | void SendAvatarDataImmediate(ISceneEntity avatar); | 1181 | void SendAvatarDataImmediate(ISceneEntity avatar); |
1166 | 1182 | ||
1167 | /// <summary> | 1183 | /// <summary> |
@@ -1185,6 +1201,7 @@ namespace OpenSim.Framework | |||
1185 | /// </summary> | 1201 | /// </summary> |
1186 | /// <param name="Item"></param> | 1202 | /// <param name="Item"></param> |
1187 | void SendInventoryItemCreateUpdate(InventoryItemBase Item, uint callbackId); | 1203 | void SendInventoryItemCreateUpdate(InventoryItemBase Item, uint callbackId); |
1204 | void SendInventoryItemCreateUpdate(InventoryItemBase Item, UUID transactionID, uint callbackId); | ||
1188 | 1205 | ||
1189 | void SendRemoveInventoryItem(UUID itemID); | 1206 | void SendRemoveInventoryItem(UUID itemID); |
1190 | 1207 | ||
@@ -1204,7 +1221,7 @@ namespace OpenSim.Framework | |||
1204 | /// <param name="node"></param> | 1221 | /// <param name="node"></param> |
1205 | void SendBulkUpdateInventory(InventoryNodeBase node); | 1222 | void SendBulkUpdateInventory(InventoryNodeBase node); |
1206 | 1223 | ||
1207 | void SendXferPacket(ulong xferID, uint packet, byte[] data); | 1224 | void SendXferPacket(ulong xferID, uint packet, byte[] data, bool isTaskInventory); |
1208 | 1225 | ||
1209 | void SendAbortXferPacket(ulong xferID); | 1226 | void SendAbortXferPacket(ulong xferID); |
1210 | 1227 | ||
@@ -1250,8 +1267,6 @@ namespace OpenSim.Framework | |||
1250 | void SendDialog(string objectname, UUID objectID, UUID ownerID, string ownerFirstName, string ownerLastName, string msg, UUID textureID, int ch, | 1267 | void SendDialog(string objectname, UUID objectID, UUID ownerID, string ownerFirstName, string ownerLastName, string msg, UUID textureID, int ch, |
1251 | string[] buttonlabels); | 1268 | string[] buttonlabels); |
1252 | 1269 | ||
1253 | bool AddMoney(int debit); | ||
1254 | |||
1255 | /// <summary> | 1270 | /// <summary> |
1256 | /// Update the client as to where the sun is currently located. | 1271 | /// Update the client as to where the sun is currently located. |
1257 | /// </summary> | 1272 | /// </summary> |
diff --git a/OpenSim/Framework/IImprovedAssetCache.cs b/OpenSim/Framework/IImprovedAssetCache.cs index 251215a..a0b8b55 100644 --- a/OpenSim/Framework/IImprovedAssetCache.cs +++ b/OpenSim/Framework/IImprovedAssetCache.cs | |||
@@ -33,6 +33,7 @@ namespace OpenSim.Framework | |||
33 | { | 33 | { |
34 | void Cache(AssetBase asset); | 34 | void Cache(AssetBase asset); |
35 | AssetBase Get(string id); | 35 | AssetBase Get(string id); |
36 | bool Check(string id); | ||
36 | void Expire(string id); | 37 | void Expire(string id); |
37 | void Clear(); | 38 | void Clear(); |
38 | } | 39 | } |
diff --git a/OpenSim/Framework/ILandObject.cs b/OpenSim/Framework/ILandObject.cs index 4f98d7b..7a24d1e 100644 --- a/OpenSim/Framework/ILandObject.cs +++ b/OpenSim/Framework/ILandObject.cs | |||
@@ -70,6 +70,7 @@ namespace OpenSim.Framework | |||
70 | void UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client); | 70 | void UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client); |
71 | bool IsEitherBannedOrRestricted(UUID avatar); | 71 | bool IsEitherBannedOrRestricted(UUID avatar); |
72 | bool IsBannedFromLand(UUID avatar); | 72 | bool IsBannedFromLand(UUID avatar); |
73 | bool CanBeOnThisLand(UUID avatar, float posHeight); | ||
73 | bool IsRestrictedFromLand(UUID avatar); | 74 | bool IsRestrictedFromLand(UUID avatar); |
74 | bool IsInLandAccessList(UUID avatar); | 75 | bool IsInLandAccessList(UUID avatar); |
75 | void SendLandUpdateToClient(IClientAPI remote_client); | 76 | void SendLandUpdateToClient(IClientAPI remote_client); |
diff --git a/OpenSim/Framework/IMoneyModule.cs b/OpenSim/Framework/IMoneyModule.cs index 1e09728..55c9613 100644 --- a/OpenSim/Framework/IMoneyModule.cs +++ b/OpenSim/Framework/IMoneyModule.cs | |||
@@ -33,13 +33,15 @@ namespace OpenSim.Framework | |||
33 | public interface IMoneyModule | 33 | public interface IMoneyModule |
34 | { | 34 | { |
35 | bool ObjectGiveMoney(UUID objectID, UUID fromID, UUID toID, | 35 | bool ObjectGiveMoney(UUID objectID, UUID fromID, UUID toID, |
36 | int amount); | 36 | int amount, UUID txn, out string reason); |
37 | 37 | ||
38 | int GetBalance(UUID agentID); | 38 | int GetBalance(UUID agentID); |
39 | bool UploadCovered(UUID agentID, int amount); | 39 | bool UploadCovered(UUID agentID, int amount); |
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, MoneyTransactionType type); |
42 | void ApplyCharge(UUID agentID, int amount, MoneyTransactionType type, string extraData); | ||
42 | void ApplyUploadCharge(UUID agentID, int amount, string text); | 43 | void ApplyUploadCharge(UUID agentID, int amount, string text); |
44 | void MoveMoney(UUID fromUser, UUID toUser, int amount, string text); | ||
43 | 45 | ||
44 | int UploadCharge { get; } | 46 | int UploadCharge { get; } |
45 | int GroupCreationCharge { get; } | 47 | int GroupCreationCharge { get; } |
diff --git a/OpenSim/Framework/LandData.cs b/OpenSim/Framework/LandData.cs index fc02f33..4dffd3f 100644 --- a/OpenSim/Framework/LandData.cs +++ b/OpenSim/Framework/LandData.cs | |||
@@ -67,9 +67,9 @@ 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.AllowVoiceChat; |
73 | 73 | ||
74 | private byte _landingType = 0; | 74 | private byte _landingType = 0; |
75 | private string _name = "Your Parcel"; | 75 | private string _name = "Your Parcel"; |
diff --git a/OpenSim/Framework/LocklessQueue.cs b/OpenSim/Framework/LocklessQueue.cs index 84f887c..9bd9baf 100644 --- a/OpenSim/Framework/LocklessQueue.cs +++ b/OpenSim/Framework/LocklessQueue.cs | |||
@@ -29,7 +29,7 @@ using System.Threading; | |||
29 | 29 | ||
30 | namespace OpenSim.Framework | 30 | namespace OpenSim.Framework |
31 | { | 31 | { |
32 | public sealed class LocklessQueue<T> | 32 | public class LocklessQueue<T> |
33 | { | 33 | { |
34 | private sealed class SingleLinkNode | 34 | private sealed class SingleLinkNode |
35 | { | 35 | { |
@@ -41,7 +41,7 @@ namespace OpenSim.Framework | |||
41 | SingleLinkNode tail; | 41 | SingleLinkNode tail; |
42 | int count; | 42 | int count; |
43 | 43 | ||
44 | public int Count { get { return count; } } | 44 | public virtual int Count { get { return count; } } |
45 | 45 | ||
46 | public LocklessQueue() | 46 | public LocklessQueue() |
47 | { | 47 | { |
@@ -76,7 +76,7 @@ namespace OpenSim.Framework | |||
76 | Interlocked.Increment(ref count); | 76 | Interlocked.Increment(ref count); |
77 | } | 77 | } |
78 | 78 | ||
79 | public bool Dequeue(out T item) | 79 | public virtual bool Dequeue(out T item) |
80 | { | 80 | { |
81 | item = default(T); | 81 | item = default(T); |
82 | SingleLinkNode oldHead = null; | 82 | SingleLinkNode oldHead = null; |
@@ -136,4 +136,4 @@ namespace OpenSim.Framework | |||
136 | (object)Interlocked.CompareExchange<SingleLinkNode>(ref location, newValue, comparand); | 136 | (object)Interlocked.CompareExchange<SingleLinkNode>(ref location, newValue, comparand); |
137 | } | 137 | } |
138 | } | 138 | } |
139 | } \ No newline at end of file | 139 | } |
diff --git a/OpenSim/Framework/Monitoring/BaseStatsCollector.cs b/OpenSim/Framework/Monitoring/BaseStatsCollector.cs index be1d02b..23dba09 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 3f992b1..69d2db5 100644 --- a/OpenSim/Framework/Monitoring/Watchdog.cs +++ b/OpenSim/Framework/Monitoring/Watchdog.cs | |||
@@ -385,4 +385,4 @@ namespace OpenSim.Framework.Monitoring | |||
385 | m_watchdogTimer.Start(); | 385 | m_watchdogTimer.Start(); |
386 | } | 386 | } |
387 | } | 387 | } |
388 | } \ No newline at end of file | 388 | } |
diff --git a/OpenSim/Framework/NetworkServersInfo.cs b/OpenSim/Framework/NetworkServersInfo.cs index 4b7d4c7..dfe9695 100644 --- a/OpenSim/Framework/NetworkServersInfo.cs +++ b/OpenSim/Framework/NetworkServersInfo.cs | |||
@@ -41,6 +41,7 @@ namespace OpenSim.Framework | |||
41 | 41 | ||
42 | // "Out of band" managemnt https | 42 | // "Out of band" managemnt https |
43 | public bool ssl_listener = false; | 43 | public bool ssl_listener = false; |
44 | public bool ssl_external = false; | ||
44 | public uint https_port = 0; | 45 | public uint https_port = 0; |
45 | public string cert_path = String.Empty; | 46 | public string cert_path = String.Empty; |
46 | public string cert_pass = String.Empty; | 47 | public string cert_pass = String.Empty; |
@@ -64,6 +65,7 @@ namespace OpenSim.Framework | |||
64 | 65 | ||
65 | // "Out of band management https" | 66 | // "Out of band management https" |
66 | ssl_listener = config.Configs["Network"].GetBoolean("https_listener",false); | 67 | ssl_listener = config.Configs["Network"].GetBoolean("https_listener",false); |
68 | ssl_external = config.Configs["Network"].GetBoolean("https_external",false); | ||
67 | if( ssl_listener) | 69 | if( ssl_listener) |
68 | { | 70 | { |
69 | cert_path = config.Configs["Network"].GetString("cert_path",String.Empty); | 71 | cert_path = config.Configs["Network"].GetString("cert_path",String.Empty); |
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 c1e1a4f..df928dc 100644 --- a/OpenSim/Framework/PrimitiveBaseShape.cs +++ b/OpenSim/Framework/PrimitiveBaseShape.cs | |||
@@ -717,7 +717,12 @@ namespace OpenSim.Framework | |||
717 | return _lightColorR; | 717 | return _lightColorR; |
718 | } | 718 | } |
719 | set { | 719 | set { |
720 | _lightColorR = value; | 720 | if (value < 0) |
721 | _lightColorR = 0; | ||
722 | else if (value > 1.0f) | ||
723 | _lightColorR = 1.0f; | ||
724 | else | ||
725 | _lightColorR = value; | ||
721 | } | 726 | } |
722 | } | 727 | } |
723 | 728 | ||
@@ -726,7 +731,12 @@ namespace OpenSim.Framework | |||
726 | return _lightColorG; | 731 | return _lightColorG; |
727 | } | 732 | } |
728 | set { | 733 | set { |
729 | _lightColorG = value; | 734 | if (value < 0) |
735 | _lightColorG = 0; | ||
736 | else if (value > 1.0f) | ||
737 | _lightColorG = 1.0f; | ||
738 | else | ||
739 | _lightColorG = value; | ||
730 | } | 740 | } |
731 | } | 741 | } |
732 | 742 | ||
@@ -735,7 +745,12 @@ namespace OpenSim.Framework | |||
735 | return _lightColorB; | 745 | return _lightColorB; |
736 | } | 746 | } |
737 | set { | 747 | set { |
738 | _lightColorB = value; | 748 | if (value < 0) |
749 | _lightColorB = 0; | ||
750 | else if (value > 1.0f) | ||
751 | _lightColorB = 1.0f; | ||
752 | else | ||
753 | _lightColorB = value; | ||
739 | } | 754 | } |
740 | } | 755 | } |
741 | 756 | ||
@@ -744,7 +759,12 @@ namespace OpenSim.Framework | |||
744 | return _lightColorA; | 759 | return _lightColorA; |
745 | } | 760 | } |
746 | set { | 761 | set { |
747 | _lightColorA = value; | 762 | if (value < 0) |
763 | _lightColorA = 0; | ||
764 | else if (value > 1.0f) | ||
765 | _lightColorA = 1.0f; | ||
766 | else | ||
767 | _lightColorA = value; | ||
748 | } | 768 | } |
749 | } | 769 | } |
750 | 770 | ||
@@ -858,6 +878,11 @@ namespace OpenSim.Framework | |||
858 | 878 | ||
859 | public ulong GetMeshKey(Vector3 size, float lod) | 879 | public ulong GetMeshKey(Vector3 size, float lod) |
860 | { | 880 | { |
881 | return GetMeshKey(size, lod, false); | ||
882 | } | ||
883 | |||
884 | public ulong GetMeshKey(Vector3 size, float lod, bool convex) | ||
885 | { | ||
861 | ulong hash = 5381; | 886 | ulong hash = 5381; |
862 | 887 | ||
863 | hash = djb2(hash, this.PathCurve); | 888 | hash = djb2(hash, this.PathCurve); |
@@ -903,6 +928,9 @@ namespace OpenSim.Framework | |||
903 | hash = djb2(hash, scaleBytes[i]); | 928 | hash = djb2(hash, scaleBytes[i]); |
904 | } | 929 | } |
905 | 930 | ||
931 | if(convex) | ||
932 | hash = djb2(hash, 0xa5); | ||
933 | |||
906 | return hash; | 934 | return hash; |
907 | } | 935 | } |
908 | 936 | ||
@@ -1406,7 +1434,7 @@ namespace OpenSim.Framework | |||
1406 | prim.Textures = this.Textures; | 1434 | prim.Textures = this.Textures; |
1407 | 1435 | ||
1408 | prim.Properties = new Primitive.ObjectProperties(); | 1436 | prim.Properties = new Primitive.ObjectProperties(); |
1409 | prim.Properties.Name = "Primitive"; | 1437 | prim.Properties.Name = "Object"; |
1410 | prim.Properties.Description = ""; | 1438 | prim.Properties.Description = ""; |
1411 | prim.Properties.CreatorID = UUID.Zero; | 1439 | prim.Properties.CreatorID = UUID.Zero; |
1412 | prim.Properties.GroupID = UUID.Zero; | 1440 | 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 24b9c89..24ec181 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; |
@@ -222,10 +224,12 @@ namespace OpenSim.Framework | |||
222 | // | 224 | // |
223 | public RegionInfo(string description, XmlNode xmlNode, bool skipConsoleConfig, IConfigSource configSource) | 225 | public RegionInfo(string description, XmlNode xmlNode, bool skipConsoleConfig, IConfigSource configSource) |
224 | { | 226 | { |
225 | // m_configSource = configSource; | 227 | XmlElement elem = (XmlElement)xmlNode; |
226 | configMember = | 228 | string name = elem.GetAttribute("Name"); |
227 | new ConfigurationMember(xmlNode, description, loadConfigurationOptions, handleIncomingConfiguration, !skipConsoleConfig); | 229 | string xmlstr = "<Nini>" + xmlNode.OuterXml + "</Nini>"; |
228 | configMember.performConfigurationRetrieve(); | 230 | XmlConfigSource source = new XmlConfigSource(XmlReader.Create(new StringReader(xmlstr))); |
231 | ReadNiniConfig(source, name); | ||
232 | |||
229 | m_serverURI = string.Empty; | 233 | m_serverURI = string.Empty; |
230 | } | 234 | } |
231 | 235 | ||
@@ -707,6 +711,9 @@ namespace OpenSim.Framework | |||
707 | string location = String.Format("{0},{1}", m_regionLocX, m_regionLocY); | 711 | string location = String.Format("{0},{1}", m_regionLocX, m_regionLocY); |
708 | config.Set("Location", location); | 712 | config.Set("Location", location); |
709 | 713 | ||
714 | if (DataStore != String.Empty) | ||
715 | config.Set("Datastore", DataStore); | ||
716 | |||
710 | config.Set("InternalAddress", m_internalEndPoint.Address.ToString()); | 717 | config.Set("InternalAddress", m_internalEndPoint.Address.ToString()); |
711 | config.Set("InternalPort", m_internalEndPoint.Port); | 718 | config.Set("InternalPort", m_internalEndPoint.Port); |
712 | 719 | ||
@@ -921,6 +928,9 @@ namespace OpenSim.Framework | |||
921 | case "sim_location_y": | 928 | case "sim_location_y": |
922 | m_regionLocY = (uint) configuration_result; | 929 | m_regionLocY = (uint) configuration_result; |
923 | break; | 930 | break; |
931 | case "datastore": | ||
932 | DataStore = (string) configuration_result; | ||
933 | break; | ||
924 | case "internal_ip_address": | 934 | case "internal_ip_address": |
925 | IPAddress address = (IPAddress) configuration_result; | 935 | IPAddress address = (IPAddress) configuration_result; |
926 | m_internalEndPoint = new IPEndPoint(address, 0); | 936 | m_internalEndPoint = new IPEndPoint(address, 0); |
@@ -1077,6 +1087,11 @@ namespace OpenSim.Framework | |||
1077 | return regionInfo; | 1087 | return regionInfo; |
1078 | } | 1088 | } |
1079 | 1089 | ||
1090 | public int getInternalEndPointPort() | ||
1091 | { | ||
1092 | return m_internalEndPoint.Port; | ||
1093 | } | ||
1094 | |||
1080 | public Dictionary<string, object> ToKeyValuePairs() | 1095 | public Dictionary<string, object> ToKeyValuePairs() |
1081 | { | 1096 | { |
1082 | Dictionary<string, object> kvp = new Dictionary<string, object>(); | 1097 | 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 05c64fa..65de563 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,82 +69,74 @@ 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); |
74 | 77 | webRequest.Timeout = 30000; //30 Second Timeout | |
75 | try | 78 | m_log.DebugFormat("[WEBLOADER]: Sending download request to {0}", url); |
76 | { | ||
77 | string xmlSource = String.Empty; | ||
78 | |||
79 | using (HttpWebResponse webResponse = (HttpWebResponse) webRequest.GetResponse()) | ||
80 | { | ||
81 | m_log.Debug("[WEBLOADER]: Downloading region information..."); | ||
82 | 79 | ||
83 | using (Stream s = webResponse.GetResponseStream()) | 80 | try |
81 | { | ||
82 | HttpWebResponse webResponse = (HttpWebResponse) webRequest.GetResponse(); | ||
83 | m_log.Debug("[WEBLOADER]: Downloading region information..."); | ||
84 | StreamReader reader = new StreamReader(webResponse.GetResponseStream()); | ||
85 | string xmlSource = String.Empty; | ||
86 | string tempStr = reader.ReadLine(); | ||
87 | while (tempStr != null) | ||
88 | { | ||
89 | xmlSource = xmlSource + tempStr; | ||
90 | tempStr = reader.ReadLine(); | ||
91 | } | ||
92 | m_log.Debug("[WEBLOADER]: Done downloading region information from server. Total Bytes: " + | ||
93 | xmlSource.Length); | ||
94 | XmlDocument xmlDoc = new XmlDocument(); | ||
95 | xmlDoc.LoadXml(xmlSource); | ||
96 | if (xmlDoc.FirstChild.Name == "Nini") | ||
84 | { | 97 | { |
85 | using (StreamReader reader = new StreamReader(s)) | 98 | regionCount = xmlDoc.FirstChild.ChildNodes.Count; |
86 | { | 99 | |
87 | string tempStr = reader.ReadLine(); | 100 | if (regionCount > 0) |
88 | while (tempStr != null) | 101 | { |
89 | { | 102 | regionInfos = new RegionInfo[regionCount]; |
90 | xmlSource = xmlSource + tempStr; | 103 | int i; |
91 | tempStr = reader.ReadLine(); | 104 | for (i = 0; i < xmlDoc.FirstChild.ChildNodes.Count; i++) |
92 | } | 105 | { |
93 | } | 106 | m_log.Debug(xmlDoc.FirstChild.ChildNodes[i].OuterXml); |
94 | } | 107 | regionInfos[i] = |
95 | } | 108 | new RegionInfo("REGION CONFIG #" + (i + 1), xmlDoc.FirstChild.ChildNodes[i],false,m_configSource); |
109 | } | ||
110 | } | ||
111 | } | ||
112 | } | ||
113 | catch (WebException ex) | ||
114 | { | ||
115 | if (((HttpWebResponse)ex.Response).StatusCode == HttpStatusCode.NotFound) | ||
116 | { | ||
117 | if (!allowRegionless) | ||
118 | throw ex; | ||
119 | } | ||
120 | else | ||
121 | throw ex; | ||
122 | } | ||
96 | 123 | ||
97 | m_log.Debug("[WEBLOADER]: Done downloading region information from server. Total Bytes: " + | 124 | if (regionCount > 0 | allowRegionless) |
98 | xmlSource.Length); | 125 | return regionInfos; |
99 | XmlDocument xmlDoc = new XmlDocument(); | 126 | |
100 | xmlDoc.LoadXml(xmlSource); | 127 | m_log.Debug("[WEBLOADER]: Request yielded no regions."); |
101 | if (xmlDoc.FirstChild.Name == "Regions") | 128 | tries--; |
102 | { | 129 | if (tries > 0) |
103 | regionCount = xmlDoc.FirstChild.ChildNodes.Count; | ||
104 | |||
105 | if (regionCount > 0) | ||
106 | { | ||
107 | regionInfos = new RegionInfo[regionCount]; | ||
108 | int i; | ||
109 | for (i = 0; i < xmlDoc.FirstChild.ChildNodes.Count; i++) | ||
110 | { | ||
111 | m_log.Debug(xmlDoc.FirstChild.ChildNodes[i].OuterXml); | ||
112 | regionInfos[i] = | ||
113 | new RegionInfo("REGION CONFIG #" + (i + 1), xmlDoc.FirstChild.ChildNodes[i],false,m_configSource); | ||
114 | } | ||
115 | } | ||
116 | } | ||
117 | } | ||
118 | catch (WebException ex) | ||
119 | { | ||
120 | using (HttpWebResponse response = (HttpWebResponse)ex.Response) | ||
121 | { | 130 | { |
122 | if (response.StatusCode == HttpStatusCode.NotFound) | 131 | m_log.Debug("[WEBLOADER]: Retrying"); |
123 | { | 132 | System.Threading.Thread.Sleep(wait); |
124 | if (!allowRegionless) | ||
125 | throw ex; | ||
126 | } | ||
127 | else | ||
128 | { | ||
129 | throw ex; | ||
130 | } | ||
131 | } | 133 | } |
132 | } | 134 | } |
133 | 135 | ||
134 | if (regionCount > 0 | allowRegionless) | 136 | m_log.Error("[WEBLOADER]: No region configs were available."); |
135 | { | 137 | return null; |
136 | return regionInfos; | ||
137 | } | ||
138 | else | ||
139 | { | ||
140 | m_log.Error("[WEBLOADER]: No region configs were available."); | ||
141 | return null; | ||
142 | } | ||
143 | } | 138 | } |
144 | } | 139 | } |
145 | } | 140 | } |
146 | } | 141 | } |
147 | } \ No newline at end of file | 142 | } |
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 035b3ad..6c04c69 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs | |||
@@ -133,7 +133,17 @@ namespace OpenSim.Framework.Servers | |||
133 | /// Performs initialisation of the scene, such as loading configuration from disk. | 133 | /// Performs initialisation of the scene, such as loading configuration from disk. |
134 | /// </summary> | 134 | /// </summary> |
135 | public virtual void Startup() | 135 | public virtual void Startup() |
136 | { | 136 | { |
137 | m_log.Info("[STARTUP]: Beginning startup processing"); | ||
138 | |||
139 | m_log.Info("[STARTUP]: Careminster version: " + m_version + Environment.NewLine); | ||
140 | // clr version potentially is more confusing than helpful, since it doesn't tell us if we're running under Mono/MS .NET and | ||
141 | // the clr version number doesn't match the project version number under Mono. | ||
142 | //m_log.Info("[STARTUP]: Virtual machine runtime version: " + Environment.Version + Environment.NewLine); | ||
143 | m_log.InfoFormat( | ||
144 | "[STARTUP]: Operating system version: {0}, .NET platform {1}, {2}-bit\n", | ||
145 | Environment.OSVersion, Environment.OSVersion.Platform, Util.Is64BitProcess() ? "64" : "32"); | ||
146 | |||
137 | StartupSpecific(); | 147 | StartupSpecific(); |
138 | 148 | ||
139 | TimeSpan timeTaken = DateTime.Now - m_startuptime; | 149 | TimeSpan timeTaken = DateTime.Now - m_startuptime; |
@@ -179,4 +189,4 @@ namespace OpenSim.Framework.Servers | |||
179 | } | 189 | } |
180 | } | 190 | } |
181 | } | 191 | } |
182 | } \ No newline at end of file | 192 | } |
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index dfdd566..97035e3 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | |||
@@ -395,6 +395,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
395 | StreamReader reader = new StreamReader(requestStream, encoding); | 395 | StreamReader reader = new StreamReader(requestStream, encoding); |
396 | 396 | ||
397 | string requestBody = reader.ReadToEnd(); | 397 | string requestBody = reader.ReadToEnd(); |
398 | reader.Close(); | ||
398 | 399 | ||
399 | Hashtable keysvals = new Hashtable(); | 400 | Hashtable keysvals = new Hashtable(); |
400 | Hashtable headervals = new Hashtable(); | 401 | Hashtable headervals = new Hashtable(); |
@@ -736,7 +737,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
736 | // Every month or so this will wrap and give bad numbers, not really a problem | 737 | // Every month or so this will wrap and give bad numbers, not really a problem |
737 | // since its just for reporting | 738 | // since its just for reporting |
738 | int tickdiff = requestEndTick - requestStartTick; | 739 | int tickdiff = requestEndTick - requestStartTick; |
739 | if (tickdiff > 3000 && requestHandler != null && requestHandler.Name != "GetTexture") | 740 | if (tickdiff > 3000 && (requestHandler == null || requestHandler.Name == null || requestHandler.Name != "GetTexture")) |
740 | { | 741 | { |
741 | m_log.InfoFormat( | 742 | m_log.InfoFormat( |
742 | "[BASE HTTP SERVER]: Slow handling of {0} {1} {2} {3} {4} from {5} took {6}ms", | 743 | "[BASE HTTP SERVER]: Slow handling of {0} {1} {2} {3} {4} from {5} took {6}ms", |
@@ -1657,10 +1658,40 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1657 | 1658 | ||
1658 | internal byte[] DoHTTPGruntWork(Hashtable responsedata, OSHttpResponse response) | 1659 | internal byte[] DoHTTPGruntWork(Hashtable responsedata, OSHttpResponse response) |
1659 | { | 1660 | { |
1660 | //m_log.Info("[BASE HTTP SERVER]: Doing HTTP Grunt work with response"); | 1661 | int responsecode; |
1661 | int responsecode = (int)responsedata["int_response_code"]; | 1662 | string responseString = String.Empty; |
1662 | string responseString = (string)responsedata["str_response_string"]; | 1663 | byte[] responseData = null; |
1663 | string contentType = (string)responsedata["content_type"]; | 1664 | string contentType; |
1665 | |||
1666 | if (responsedata == null) | ||
1667 | { | ||
1668 | responsecode = 500; | ||
1669 | responseString = "No response could be obtained"; | ||
1670 | contentType = "text/plain"; | ||
1671 | responsedata = new Hashtable(); | ||
1672 | } | ||
1673 | else | ||
1674 | { | ||
1675 | try | ||
1676 | { | ||
1677 | //m_log.Info("[BASE HTTP SERVER]: Doing HTTP Grunt work with response"); | ||
1678 | responsecode = (int)responsedata["int_response_code"]; | ||
1679 | if (responsedata["bin_response_data"] != null) | ||
1680 | responseData = (byte[])responsedata["bin_response_data"]; | ||
1681 | else | ||
1682 | responseString = (string)responsedata["str_response_string"]; | ||
1683 | contentType = (string)responsedata["content_type"]; | ||
1684 | if (responseString == null) | ||
1685 | responseString = String.Empty; | ||
1686 | } | ||
1687 | catch | ||
1688 | { | ||
1689 | responsecode = 500; | ||
1690 | responseString = "No response could be obtained"; | ||
1691 | contentType = "text/plain"; | ||
1692 | responsedata = new Hashtable(); | ||
1693 | } | ||
1694 | } | ||
1664 | 1695 | ||
1665 | if (responsedata.ContainsKey("error_status_text")) | 1696 | if (responsedata.ContainsKey("error_status_text")) |
1666 | { | 1697 | { |
@@ -1705,25 +1736,40 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1705 | 1736 | ||
1706 | response.AddHeader("Content-Type", contentType); | 1737 | response.AddHeader("Content-Type", contentType); |
1707 | 1738 | ||
1739 | if (responsedata.ContainsKey("headers")) | ||
1740 | { | ||
1741 | Hashtable headerdata = (Hashtable)responsedata["headers"]; | ||
1742 | |||
1743 | foreach (string header in headerdata.Keys) | ||
1744 | response.AddHeader(header, (string)headerdata[header]); | ||
1745 | } | ||
1746 | |||
1708 | byte[] buffer; | 1747 | byte[] buffer; |
1709 | 1748 | ||
1710 | if (!(contentType.Contains("image") | 1749 | if (responseData != null) |
1711 | || contentType.Contains("x-shockwave-flash") | ||
1712 | || contentType.Contains("application/x-oar") | ||
1713 | || contentType.Contains("application/vnd.ll.mesh"))) | ||
1714 | { | 1750 | { |
1715 | // Text | 1751 | buffer = responseData; |
1716 | buffer = Encoding.UTF8.GetBytes(responseString); | ||
1717 | } | 1752 | } |
1718 | else | 1753 | else |
1719 | { | 1754 | { |
1720 | // Binary! | 1755 | if (!(contentType.Contains("image") |
1721 | buffer = Convert.FromBase64String(responseString); | 1756 | || contentType.Contains("x-shockwave-flash") |
1722 | } | 1757 | || contentType.Contains("application/x-oar") |
1758 | || contentType.Contains("application/vnd.ll.mesh"))) | ||
1759 | { | ||
1760 | // Text | ||
1761 | buffer = Encoding.UTF8.GetBytes(responseString); | ||
1762 | } | ||
1763 | else | ||
1764 | { | ||
1765 | // Binary! | ||
1766 | buffer = Convert.FromBase64String(responseString); | ||
1767 | } | ||
1723 | 1768 | ||
1724 | response.SendChunked = false; | 1769 | response.SendChunked = false; |
1725 | response.ContentLength64 = buffer.Length; | 1770 | response.ContentLength64 = buffer.Length; |
1726 | response.ContentEncoding = Encoding.UTF8; | 1771 | response.ContentEncoding = Encoding.UTF8; |
1772 | } | ||
1727 | 1773 | ||
1728 | return buffer; | 1774 | return buffer; |
1729 | } | 1775 | } |
@@ -1804,8 +1850,8 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1804 | m_httpListener2.Start(64); | 1850 | m_httpListener2.Start(64); |
1805 | 1851 | ||
1806 | // Long Poll Service Manager with 3 worker threads a 25 second timeout for no events | 1852 | // Long Poll Service Manager with 3 worker threads a 25 second timeout for no events |
1807 | m_PollServiceManager = new PollServiceRequestManager(this, 3, 25000); | 1853 | // m_PollServiceManager = new PollServiceRequestManager(this, 3, 25000); |
1808 | m_PollServiceManager.Start(); | 1854 | m_PollServiceManager = new PollServiceRequestManager(this, 4, 25000); |
1809 | HTTPDRunning = true; | 1855 | HTTPDRunning = true; |
1810 | 1856 | ||
1811 | //HttpListenerContext context; | 1857 | //HttpListenerContext context; |
@@ -1839,7 +1885,9 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1839 | 1885 | ||
1840 | public void httpServerException(object source, Exception exception) | 1886 | public void httpServerException(object source, Exception exception) |
1841 | { | 1887 | { |
1842 | m_log.Error(String.Format("[BASE HTTP SERVER]: {0} had an exception: {1} ", source.ToString(), exception.Message), exception); | 1888 | if (source.ToString() == "HttpServer.HttpListener" && exception.ToString().StartsWith("Mono.Security.Protocol.Tls.TlsException")) |
1889 | return; | ||
1890 | m_log.ErrorFormat("[BASE HTTP SERVER]: {0} had an exception {1}", source.ToString(), exception.ToString()); | ||
1843 | /* | 1891 | /* |
1844 | if (HTTPDRunning)// && NotSocketErrors > 5) | 1892 | if (HTTPDRunning)// && NotSocketErrors > 5) |
1845 | { | 1893 | { |
@@ -1856,7 +1904,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1856 | HTTPDRunning = false; | 1904 | HTTPDRunning = false; |
1857 | try | 1905 | try |
1858 | { | 1906 | { |
1859 | m_PollServiceManager.Stop(); | 1907 | // m_PollServiceManager.Stop(); |
1860 | 1908 | ||
1861 | m_httpListener2.ExceptionThrown -= httpServerException; | 1909 | m_httpListener2.ExceptionThrown -= httpServerException; |
1862 | //m_httpListener2.DisconnectHandler = null; | 1910 | //m_httpListener2.DisconnectHandler = null; |
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs index 3089351..c19ac32 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,30 @@ 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 | Mesh = 4 | ||
58 | } | ||
48 | 59 | ||
49 | public PollServiceEventArgs( | 60 | public PollServiceEventArgs( |
50 | RequestMethod pRequest, | 61 | RequestMethod pRequest, |
51 | HasEventsMethod pHasEvents, GetEventsMethod pGetEvents, NoEventsMethod pNoEvents, | 62 | HasEventsMethod pHasEvents, GetEventsMethod pGetEvents, NoEventsMethod pNoEvents, |
52 | UUID pId) | 63 | UUID pId, int pTimeOutms) |
53 | { | 64 | { |
54 | Request = pRequest; | 65 | Request = pRequest; |
55 | HasEvents = pHasEvents; | 66 | HasEvents = pHasEvents; |
56 | GetEvents = pGetEvents; | 67 | GetEvents = pGetEvents; |
57 | NoEvents = pNoEvents; | 68 | NoEvents = pNoEvents; |
58 | Id = pId; | 69 | Id = pId; |
70 | TimeOutms = pTimeOutms; | ||
71 | Type = EventType.Normal; | ||
59 | } | 72 | } |
60 | } | 73 | } |
61 | } \ No newline at end of file | 74 | } |
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index 3e84c55..5406f00 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs | |||
@@ -33,53 +33,54 @@ 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; | ||
37 | using System.IO; | ||
38 | using System.Text; | ||
39 | using System.Collections.Generic; | ||
36 | 40 | ||
37 | namespace OpenSim.Framework.Servers.HttpServer | 41 | namespace OpenSim.Framework.Servers.HttpServer |
38 | { | 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 | |
49 | private BlockingQueue<PollServiceHttpRequest> m_requests = new BlockingQueue<PollServiceHttpRequest>(); | ||
50 | private static Queue<PollServiceHttpRequest> m_slowRequests = new Queue<PollServiceHttpRequest>(); | ||
51 | private static Queue<PollServiceHttpRequest> m_retryRequests = new Queue<PollServiceHttpRequest>(); | ||
52 | |||
45 | private uint m_WorkerThreadCount = 0; | 53 | private uint m_WorkerThreadCount = 0; |
46 | private Thread[] m_workerThreads; | 54 | private Thread[] m_workerThreads; |
47 | private PollServiceWorkerThread[] m_PollServiceWorkerThreads; | 55 | private Thread m_retrysThread; |
48 | private volatile bool m_running = true; | 56 | |
49 | private int m_pollTimeout; | 57 | private bool m_running = true; |
58 | private int slowCount = 0; | ||
59 | |||
60 | private SmartThreadPool m_threadPool = new SmartThreadPool(20000, 12, 2); | ||
50 | 61 | ||
51 | public PollServiceRequestManager(BaseHttpServer pSrv, uint pWorkerThreadCount, int pTimeout) | 62 | public PollServiceRequestManager(BaseHttpServer pSrv, uint pWorkerThreadCount, int pTimeout) |
52 | { | 63 | { |
53 | m_server = pSrv; | 64 | m_server = pSrv; |
54 | m_WorkerThreadCount = pWorkerThreadCount; | 65 | m_WorkerThreadCount = pWorkerThreadCount; |
55 | m_pollTimeout = pTimeout; | ||
56 | } | ||
57 | |||
58 | public void Start() | ||
59 | { | ||
60 | m_running = true; | ||
61 | m_workerThreads = new Thread[m_WorkerThreadCount]; | 66 | m_workerThreads = new Thread[m_WorkerThreadCount]; |
62 | m_PollServiceWorkerThreads = new PollServiceWorkerThread[m_WorkerThreadCount]; | ||
63 | 67 | ||
64 | //startup worker threads | 68 | //startup worker threads |
65 | for (uint i = 0; i < m_WorkerThreadCount; i++) | 69 | for (uint i = 0; i < m_WorkerThreadCount; i++) |
66 | { | 70 | { |
67 | m_PollServiceWorkerThreads[i] = new PollServiceWorkerThread(m_server, m_pollTimeout); | ||
68 | m_PollServiceWorkerThreads[i].ReQueue += ReQueueEvent; | ||
69 | |||
70 | m_workerThreads[i] | 71 | m_workerThreads[i] |
71 | = Watchdog.StartThread( | 72 | = Watchdog.StartThread( |
72 | m_PollServiceWorkerThreads[i].ThreadStart, | 73 | PoolWorkerJob, |
73 | String.Format("PollServiceWorkerThread{0}", i), | 74 | String.Format("PollServiceWorkerThread{0}", i), |
74 | ThreadPriority.Normal, | 75 | ThreadPriority.Normal, |
75 | false, | 76 | false, |
76 | true, | 77 | false, |
77 | null, | 78 | null, |
78 | int.MaxValue); | 79 | int.MaxValue); |
79 | } | 80 | } |
80 | 81 | ||
81 | Watchdog.StartThread( | 82 | m_retrysThread = Watchdog.StartThread( |
82 | this.ThreadStart, | 83 | this.CheckRetries, |
83 | "PollServiceWatcherThread", | 84 | "PollServiceWatcherThread", |
84 | ThreadPriority.Normal, | 85 | ThreadPriority.Normal, |
85 | false, | 86 | false, |
@@ -88,78 +89,206 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
88 | 1000 * 60 * 10); | 89 | 1000 * 60 * 10); |
89 | } | 90 | } |
90 | 91 | ||
91 | internal void ReQueueEvent(PollServiceHttpRequest req) | 92 | |
93 | private void ReQueueEvent(PollServiceHttpRequest req) | ||
92 | { | 94 | { |
93 | // Do accounting stuff here | 95 | if (m_running) |
94 | Enqueue(req); | 96 | { |
97 | lock (m_retryRequests) | ||
98 | m_retryRequests.Enqueue(req); | ||
99 | } | ||
95 | } | 100 | } |
96 | 101 | ||
97 | public void Enqueue(PollServiceHttpRequest req) | 102 | public void Enqueue(PollServiceHttpRequest req) |
98 | { | 103 | { |
99 | lock (m_requests) | 104 | if (m_running) |
100 | m_requests.Enqueue(req); | 105 | { |
106 | if (req.PollServiceArgs.Type != PollServiceEventArgs.EventType.Normal) | ||
107 | { | ||
108 | m_requests.Enqueue(req); | ||
109 | } | ||
110 | else | ||
111 | { | ||
112 | lock (m_slowRequests) | ||
113 | m_slowRequests.Enqueue(req); | ||
114 | } | ||
115 | } | ||
101 | } | 116 | } |
102 | 117 | ||
103 | public void ThreadStart() | 118 | private void CheckRetries() |
104 | { | 119 | { |
105 | while (m_running) | 120 | while (m_running) |
106 | { | 121 | { |
122 | Thread.Sleep(100); // let the world move .. back to faster rate | ||
107 | Watchdog.UpdateThread(); | 123 | Watchdog.UpdateThread(); |
108 | ProcessQueuedRequests(); | 124 | lock (m_retryRequests) |
109 | Thread.Sleep(1000); | 125 | { |
126 | while (m_retryRequests.Count > 0 && m_running) | ||
127 | m_requests.Enqueue(m_retryRequests.Dequeue()); | ||
128 | } | ||
129 | slowCount++; | ||
130 | if (slowCount >= 10) | ||
131 | { | ||
132 | slowCount = 0; | ||
133 | |||
134 | lock (m_slowRequests) | ||
135 | { | ||
136 | while (m_slowRequests.Count > 0 && m_running) | ||
137 | m_requests.Enqueue(m_slowRequests.Dequeue()); | ||
138 | } | ||
139 | } | ||
110 | } | 140 | } |
111 | } | 141 | } |
112 | 142 | ||
113 | private void ProcessQueuedRequests() | 143 | ~PollServiceRequestManager() |
114 | { | 144 | { |
115 | lock (m_requests) | 145 | m_running = false; |
146 | Thread.Sleep(1000); // let the world move | ||
147 | |||
148 | foreach (Thread t in m_workerThreads) | ||
149 | Watchdog.AbortThread(t.ManagedThreadId); | ||
150 | |||
151 | try | ||
152 | { | ||
153 | foreach (PollServiceHttpRequest req in m_retryRequests) | ||
154 | { | ||
155 | DoHTTPGruntWork(m_server,req, | ||
156 | req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id)); | ||
157 | } | ||
158 | } | ||
159 | catch | ||
160 | { | ||
161 | } | ||
162 | |||
163 | PollServiceHttpRequest wreq; | ||
164 | m_retryRequests.Clear(); | ||
165 | |||
166 | lock (m_slowRequests) | ||
116 | { | 167 | { |
117 | if (m_requests.Count == 0) | 168 | while (m_slowRequests.Count > 0 && m_running) |
118 | return; | 169 | m_requests.Enqueue(m_slowRequests.Dequeue()); |
170 | } | ||
171 | |||
172 | while (m_requests.Count() > 0) | ||
173 | { | ||
174 | try | ||
175 | { | ||
176 | wreq = m_requests.Dequeue(0); | ||
177 | DoHTTPGruntWork(m_server,wreq, | ||
178 | wreq.PollServiceArgs.NoEvents(wreq.RequestID, wreq.PollServiceArgs.Id)); | ||
179 | } | ||
180 | catch | ||
181 | { | ||
182 | } | ||
183 | } | ||
119 | 184 | ||
120 | // m_log.DebugFormat("[POLL SERVICE REQUEST MANAGER]: Processing {0} requests", m_requests.Count); | 185 | m_requests.Clear(); |
186 | } | ||
121 | 187 | ||
122 | int reqperthread = (int) (m_requests.Count/m_WorkerThreadCount) + 1; | 188 | // work threads |
123 | 189 | ||
124 | // For Each WorkerThread | 190 | private void PoolWorkerJob() |
125 | for (int tc = 0; tc < m_WorkerThreadCount && m_requests.Count > 0; tc++) | 191 | { |
192 | while (m_running) | ||
193 | { | ||
194 | PollServiceHttpRequest req = m_requests.Dequeue(5000); | ||
195 | |||
196 | Watchdog.UpdateThread(); | ||
197 | if (req != null) | ||
126 | { | 198 | { |
127 | //Loop over number of requests each thread handles. | 199 | try |
128 | for (int i = 0; i < reqperthread && m_requests.Count > 0; i++) | ||
129 | { | 200 | { |
130 | try | 201 | if (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id)) |
131 | { | 202 | { |
132 | m_PollServiceWorkerThreads[tc].Enqueue((PollServiceHttpRequest)m_requests.Dequeue()); | 203 | Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id); |
204 | |||
205 | if (responsedata == null) | ||
206 | continue; | ||
207 | |||
208 | if (req.PollServiceArgs.Type == PollServiceEventArgs.EventType.Normal) // This is the event queue | ||
209 | { | ||
210 | try | ||
211 | { | ||
212 | DoHTTPGruntWork(m_server, req, responsedata); | ||
213 | } | ||
214 | catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream | ||
215 | { | ||
216 | // Ignore it, no need to reply | ||
217 | } | ||
218 | } | ||
219 | else | ||
220 | { | ||
221 | m_threadPool.QueueWorkItem(x => | ||
222 | { | ||
223 | try | ||
224 | { | ||
225 | DoHTTPGruntWork(m_server, req, responsedata); | ||
226 | } | ||
227 | catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream | ||
228 | { | ||
229 | // Ignore it, no need to reply | ||
230 | } | ||
231 | |||
232 | return null; | ||
233 | }, null); | ||
234 | } | ||
133 | } | 235 | } |
134 | catch (InvalidOperationException) | 236 | else |
135 | { | 237 | { |
136 | // The queue is empty, we did our calculations wrong! | 238 | if ((Environment.TickCount - req.RequestTime) > req.PollServiceArgs.TimeOutms) |
137 | return; | 239 | { |
240 | DoHTTPGruntWork(m_server, req, | ||
241 | req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id)); | ||
242 | } | ||
243 | else | ||
244 | { | ||
245 | ReQueueEvent(req); | ||
246 | } | ||
138 | } | 247 | } |
139 | 248 | } | |
249 | catch (Exception e) | ||
250 | { | ||
251 | m_log.ErrorFormat("Exception in poll service thread: " + e.ToString()); | ||
140 | } | 252 | } |
141 | } | 253 | } |
142 | } | 254 | } |
143 | |||
144 | } | 255 | } |
145 | 256 | ||
146 | public void Stop() | 257 | // DoHTTPGruntWork changed, not sending response |
258 | // do the same work around as core | ||
259 | |||
260 | internal static void DoHTTPGruntWork(BaseHttpServer server, PollServiceHttpRequest req, Hashtable responsedata) | ||
147 | { | 261 | { |
148 | m_running = false; | 262 | OSHttpResponse response |
263 | = new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext); | ||
149 | 264 | ||
150 | foreach (object o in m_requests) | 265 | byte[] buffer = server.DoHTTPGruntWork(responsedata, response); |
151 | { | ||
152 | PollServiceHttpRequest req = (PollServiceHttpRequest) o; | ||
153 | PollServiceWorkerThread.DoHTTPGruntWork( | ||
154 | m_server, req, req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id)); | ||
155 | } | ||
156 | 266 | ||
157 | m_requests.Clear(); | 267 | response.SendChunked = false; |
268 | response.ContentLength64 = buffer.Length; | ||
269 | response.ContentEncoding = Encoding.UTF8; | ||
158 | 270 | ||
159 | foreach (Thread t in m_workerThreads) | 271 | try |
160 | { | 272 | { |
161 | t.Abort(); | 273 | response.OutputStream.Write(buffer, 0, buffer.Length); |
274 | } | ||
275 | catch (Exception ex) | ||
276 | { | ||
277 | m_log.Warn(string.Format("[POLL SERVICE WORKER THREAD]: Error ", ex)); | ||
278 | } | ||
279 | finally | ||
280 | { | ||
281 | try | ||
282 | { | ||
283 | response.OutputStream.Flush(); | ||
284 | response.Send(); | ||
285 | } | ||
286 | catch (Exception e) | ||
287 | { | ||
288 | m_log.Warn(String.Format("[POLL SERVICE WORKER THREAD]: Error ", e)); | ||
289 | } | ||
162 | } | 290 | } |
163 | } | 291 | } |
164 | } | 292 | } |
165 | } \ No newline at end of file | 293 | } |
294 | |||
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs deleted file mode 100644 index 5adbcd1..0000000 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs +++ /dev/null | |||
@@ -1,165 +0,0 @@ | |||
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 System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.IO; | ||
32 | using System.Text; | ||
33 | using HttpServer; | ||
34 | using OpenMetaverse; | ||
35 | using System.Reflection; | ||
36 | using log4net; | ||
37 | using OpenSim.Framework.Monitoring; | ||
38 | |||
39 | namespace OpenSim.Framework.Servers.HttpServer | ||
40 | { | ||
41 | public delegate void ReQueuePollServiceItem(PollServiceHttpRequest req); | ||
42 | |||
43 | public class PollServiceWorkerThread | ||
44 | { | ||
45 | private static readonly ILog m_log = | ||
46 | LogManager.GetLogger( | ||
47 | MethodBase.GetCurrentMethod().DeclaringType); | ||
48 | |||
49 | public event ReQueuePollServiceItem ReQueue; | ||
50 | |||
51 | private readonly BaseHttpServer m_server; | ||
52 | private BlockingQueue<PollServiceHttpRequest> m_request; | ||
53 | private bool m_running = true; | ||
54 | private int m_timeout = 250; | ||
55 | |||
56 | public PollServiceWorkerThread(BaseHttpServer pSrv, int pTimeout) | ||
57 | { | ||
58 | m_request = new BlockingQueue<PollServiceHttpRequest>(); | ||
59 | m_server = pSrv; | ||
60 | m_timeout = pTimeout; | ||
61 | } | ||
62 | |||
63 | public void ThreadStart() | ||
64 | { | ||
65 | Run(); | ||
66 | } | ||
67 | |||
68 | public void Run() | ||
69 | { | ||
70 | while (m_running) | ||
71 | { | ||
72 | PollServiceHttpRequest req = m_request.Dequeue(); | ||
73 | |||
74 | Watchdog.UpdateThread(); | ||
75 | |||
76 | try | ||
77 | { | ||
78 | if (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id)) | ||
79 | { | ||
80 | StreamReader str; | ||
81 | try | ||
82 | { | ||
83 | str = new StreamReader(req.Request.Body); | ||
84 | } | ||
85 | catch (System.ArgumentException) | ||
86 | { | ||
87 | // Stream was not readable means a child agent | ||
88 | // was closed due to logout, leaving the | ||
89 | // Event Queue request orphaned. | ||
90 | continue; | ||
91 | } | ||
92 | |||
93 | Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, str.ReadToEnd()); | ||
94 | DoHTTPGruntWork(m_server, req, responsedata); | ||
95 | } | ||
96 | else | ||
97 | { | ||
98 | if ((Environment.TickCount - req.RequestTime) > m_timeout) | ||
99 | { | ||
100 | DoHTTPGruntWork( | ||
101 | m_server, | ||
102 | req, | ||
103 | req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id)); | ||
104 | } | ||
105 | else | ||
106 | { | ||
107 | ReQueuePollServiceItem reQueueItem = ReQueue; | ||
108 | if (reQueueItem != null) | ||
109 | reQueueItem(req); | ||
110 | } | ||
111 | } | ||
112 | } | ||
113 | catch (Exception e) | ||
114 | { | ||
115 | m_log.ErrorFormat("Exception in poll service thread: " + e.ToString()); | ||
116 | } | ||
117 | } | ||
118 | } | ||
119 | |||
120 | internal void Enqueue(PollServiceHttpRequest pPollServiceHttpRequest) | ||
121 | { | ||
122 | m_request.Enqueue(pPollServiceHttpRequest); | ||
123 | } | ||
124 | |||
125 | /// <summary> | ||
126 | /// FIXME: This should be part of BaseHttpServer | ||
127 | /// </summary> | ||
128 | internal static void DoHTTPGruntWork(BaseHttpServer server, PollServiceHttpRequest req, Hashtable responsedata) | ||
129 | { | ||
130 | OSHttpResponse response | ||
131 | = new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext); | ||
132 | |||
133 | byte[] buffer = server.DoHTTPGruntWork(responsedata, response); | ||
134 | |||
135 | response.SendChunked = false; | ||
136 | response.ContentLength64 = buffer.Length; | ||
137 | response.ContentEncoding = Encoding.UTF8; | ||
138 | |||
139 | try | ||
140 | { | ||
141 | response.OutputStream.Write(buffer, 0, buffer.Length); | ||
142 | } | ||
143 | catch (Exception ex) | ||
144 | { | ||
145 | m_log.Warn(string.Format("[POLL SERVICE WORKER THREAD]: Error ", ex)); | ||
146 | } | ||
147 | finally | ||
148 | { | ||
149 | //response.OutputStream.Close(); | ||
150 | try | ||
151 | { | ||
152 | response.OutputStream.Flush(); | ||
153 | response.Send(); | ||
154 | |||
155 | //if (!response.KeepAlive && response.ReuseContext) | ||
156 | // response.FreeContext(); | ||
157 | } | ||
158 | catch (Exception e) | ||
159 | { | ||
160 | m_log.Warn(String.Format("[POLL SERVICE WORKER THREAD]: Error ", e)); | ||
161 | } | ||
162 | } | ||
163 | } | ||
164 | } | ||
165 | } \ No newline at end of file | ||
diff --git a/OpenSim/Framework/Servers/ServerBase.cs b/OpenSim/Framework/Servers/ServerBase.cs index 657444c..1ff8aca 100644 --- a/OpenSim/Framework/Servers/ServerBase.cs +++ b/OpenSim/Framework/Servers/ServerBase.cs | |||
@@ -593,7 +593,7 @@ namespace OpenSim.Framework.Servers | |||
593 | } | 593 | } |
594 | } | 594 | } |
595 | 595 | ||
596 | protected string GetVersionText() | 596 | public string GetVersionText() |
597 | { | 597 | { |
598 | return String.Format("Version: {0} (interface version {1})", m_version, VersionInfo.MajorInterfaceVersion); | 598 | return String.Format("Version: {0} (interface version {1})", m_version, VersionInfo.MajorInterfaceVersion); |
599 | } | 599 | } |
@@ -694,4 +694,4 @@ namespace OpenSim.Framework.Servers | |||
694 | m_console.OutputFormat(format, components); | 694 | m_console.OutputFormat(format, components); |
695 | } | 695 | } |
696 | } | 696 | } |
697 | } \ No newline at end of file | 697 | } |
diff --git a/OpenSim/Framework/Servers/Tests/OSHttpTests.cs b/OpenSim/Framework/Servers/Tests/OSHttpTests.cs index 5b912b4..deae45c 100644 --- a/OpenSim/Framework/Servers/Tests/OSHttpTests.cs +++ b/OpenSim/Framework/Servers/Tests/OSHttpTests.cs | |||
@@ -81,6 +81,10 @@ namespace OpenSim.Framework.Servers.Tests | |||
81 | /// </summary> | 81 | /// </summary> |
82 | public event EventHandler<RequestEventArgs> RequestReceived = delegate { }; | 82 | public event EventHandler<RequestEventArgs> RequestReceived = delegate { }; |
83 | 83 | ||
84 | public bool CanSend { get { return true; } } | ||
85 | public string RemoteEndPoint { get { return ""; } } | ||
86 | public string RemoteEndPointAddress { get { return ""; } } | ||
87 | public string RemoteEndPointPort { get { return ""; } } | ||
84 | } | 88 | } |
85 | 89 | ||
86 | public class TestHttpRequest: IHttpRequest | 90 | public class TestHttpRequest: IHttpRequest |
diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs index 80568e0..737c14d 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.6"; | 32 | private const string VERSION_NUMBER = "0.7.6CM"; |
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 8af2c41..62ecbd1 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 |
@@ -47,6 +51,180 @@ namespace OpenSim.Framework | |||
47 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 51 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
48 | 52 | ||
49 | private static XmlSerializer tiiSerializer = new XmlSerializer(typeof (TaskInventoryItem)); | 53 | private static XmlSerializer tiiSerializer = new XmlSerializer(typeof (TaskInventoryItem)); |
54 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
55 | |||
56 | private Thread LockedByThread; | ||
57 | // private string WriterStack; | ||
58 | |||
59 | // private Dictionary<Thread, string> ReadLockers = | ||
60 | // new Dictionary<Thread, string>(); | ||
61 | |||
62 | /// <value> | ||
63 | /// An advanced lock for inventory data | ||
64 | /// </value> | ||
65 | private System.Threading.ReaderWriterLockSlim m_itemLock = new System.Threading.ReaderWriterLockSlim(); | ||
66 | |||
67 | /// <summary> | ||
68 | /// Are we readlocked by the calling thread? | ||
69 | /// </summary> | ||
70 | public bool IsReadLockedByMe() | ||
71 | { | ||
72 | if (m_itemLock.RecursiveReadCount > 0) | ||
73 | { | ||
74 | return true; | ||
75 | } | ||
76 | else | ||
77 | { | ||
78 | return false; | ||
79 | } | ||
80 | } | ||
81 | |||
82 | /// <summary> | ||
83 | /// Lock our inventory list for reading (many can read, one can write) | ||
84 | /// </summary> | ||
85 | public void LockItemsForRead(bool locked) | ||
86 | { | ||
87 | if (locked) | ||
88 | { | ||
89 | if (m_itemLock.IsWriteLockHeld && LockedByThread != null) | ||
90 | { | ||
91 | if (!LockedByThread.IsAlive) | ||
92 | { | ||
93 | //Locked by dead thread, reset. | ||
94 | m_itemLock = new System.Threading.ReaderWriterLockSlim(); | ||
95 | } | ||
96 | } | ||
97 | |||
98 | if (m_itemLock.RecursiveReadCount > 0) | ||
99 | { | ||
100 | 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."); | ||
101 | try | ||
102 | { | ||
103 | // That call stack is useful for end users only. RealProgrammers need a full dump. Commented. | ||
104 | // StackTrace stackTrace = new StackTrace(); // get call stack | ||
105 | // StackFrame[] stackFrames = stackTrace.GetFrames(); // get method calls (frames) | ||
106 | // | ||
107 | // // write call stack method names | ||
108 | // foreach (StackFrame stackFrame in stackFrames) | ||
109 | // { | ||
110 | // m_log.Error("[SceneObjectGroup.m_parts] "+(stackFrame.GetMethod().Name)); // write method name | ||
111 | // } | ||
112 | |||
113 | // The below is far more useful | ||
114 | // System.Console.WriteLine("------------------------------------------"); | ||
115 | // System.Console.WriteLine("My call stack:\n" + Environment.StackTrace); | ||
116 | // System.Console.WriteLine("------------------------------------------"); | ||
117 | // foreach (KeyValuePair<Thread, string> kvp in ReadLockers) | ||
118 | // { | ||
119 | // System.Console.WriteLine("Locker name {0} call stack:\n" + kvp.Value, kvp.Key.Name); | ||
120 | // System.Console.WriteLine("------------------------------------------"); | ||
121 | // } | ||
122 | } | ||
123 | catch | ||
124 | {} | ||
125 | m_itemLock.ExitReadLock(); | ||
126 | } | ||
127 | if (m_itemLock.RecursiveWriteCount > 0) | ||
128 | { | ||
129 | m_log.Error("[TaskInventoryDictionary] Recursive write lock requested. This should not happen and means something needs to be fixed."); | ||
130 | // try | ||
131 | // { | ||
132 | // System.Console.WriteLine("------------------------------------------"); | ||
133 | // System.Console.WriteLine("My call stack:\n" + Environment.StackTrace); | ||
134 | // System.Console.WriteLine("------------------------------------------"); | ||
135 | // System.Console.WriteLine("Locker's call stack:\n" + WriterStack); | ||
136 | // System.Console.WriteLine("------------------------------------------"); | ||
137 | // } | ||
138 | // catch | ||
139 | // {} | ||
140 | m_itemLock.ExitWriteLock(); | ||
141 | } | ||
142 | |||
143 | while (!m_itemLock.TryEnterReadLock(60000)) | ||
144 | { | ||
145 | 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."); | ||
146 | if (m_itemLock.IsWriteLockHeld) | ||
147 | { | ||
148 | m_itemLock = new System.Threading.ReaderWriterLockSlim(); | ||
149 | // System.Console.WriteLine("------------------------------------------"); | ||
150 | // System.Console.WriteLine("My call stack:\n" + Environment.StackTrace); | ||
151 | // System.Console.WriteLine("------------------------------------------"); | ||
152 | // System.Console.WriteLine("Locker's call stack:\n" + WriterStack); | ||
153 | // System.Console.WriteLine("------------------------------------------"); | ||
154 | // LockedByThread = null; | ||
155 | // ReadLockers.Clear(); | ||
156 | } | ||
157 | } | ||
158 | // ReadLockers[Thread.CurrentThread] = Environment.StackTrace; | ||
159 | } | ||
160 | else | ||
161 | { | ||
162 | if (m_itemLock.RecursiveReadCount>0) | ||
163 | { | ||
164 | m_itemLock.ExitReadLock(); | ||
165 | } | ||
166 | // if (m_itemLock.RecursiveReadCount == 0) | ||
167 | // ReadLockers.Remove(Thread.CurrentThread); | ||
168 | } | ||
169 | } | ||
170 | |||
171 | /// <summary> | ||
172 | /// Lock our inventory list for writing (many can read, one can write) | ||
173 | /// </summary> | ||
174 | public void LockItemsForWrite(bool locked) | ||
175 | { | ||
176 | if (locked) | ||
177 | { | ||
178 | //Enter a write lock, wait indefinately for one to open. | ||
179 | if (m_itemLock.RecursiveReadCount > 0) | ||
180 | { | ||
181 | 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."); | ||
182 | m_itemLock.ExitReadLock(); | ||
183 | } | ||
184 | if (m_itemLock.RecursiveWriteCount > 0) | ||
185 | { | ||
186 | m_log.Error("[TaskInventoryDictionary] Recursive write lock requested. This should not happen and means something needs to be fixed."); | ||
187 | |||
188 | m_itemLock.ExitWriteLock(); | ||
189 | } | ||
190 | while (!m_itemLock.TryEnterWriteLock(60000)) | ||
191 | { | ||
192 | if (m_itemLock.IsWriteLockHeld) | ||
193 | { | ||
194 | 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."); | ||
195 | // System.Console.WriteLine("------------------------------------------"); | ||
196 | // System.Console.WriteLine("My call stack:\n" + Environment.StackTrace); | ||
197 | // System.Console.WriteLine("------------------------------------------"); | ||
198 | // System.Console.WriteLine("Locker's call stack:\n" + WriterStack); | ||
199 | // System.Console.WriteLine("------------------------------------------"); | ||
200 | } | ||
201 | else | ||
202 | { | ||
203 | 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."); | ||
204 | // System.Console.WriteLine("------------------------------------------"); | ||
205 | // System.Console.WriteLine("My call stack:\n" + Environment.StackTrace); | ||
206 | // System.Console.WriteLine("------------------------------------------"); | ||
207 | // foreach (KeyValuePair<Thread, string> kvp in ReadLockers) | ||
208 | // { | ||
209 | // System.Console.WriteLine("Locker name {0} call stack:\n" + kvp.Value, kvp.Key.Name); | ||
210 | // System.Console.WriteLine("------------------------------------------"); | ||
211 | // } | ||
212 | } | ||
213 | m_itemLock = new System.Threading.ReaderWriterLockSlim(); | ||
214 | // ReadLockers.Clear(); | ||
215 | } | ||
216 | |||
217 | LockedByThread = Thread.CurrentThread; | ||
218 | // WriterStack = Environment.StackTrace; | ||
219 | } | ||
220 | else | ||
221 | { | ||
222 | if (m_itemLock.RecursiveWriteCount > 0) | ||
223 | { | ||
224 | m_itemLock.ExitWriteLock(); | ||
225 | } | ||
226 | } | ||
227 | } | ||
50 | 228 | ||
51 | #region ICloneable Members | 229 | #region ICloneable Members |
52 | 230 | ||
@@ -54,14 +232,13 @@ namespace OpenSim.Framework | |||
54 | { | 232 | { |
55 | TaskInventoryDictionary clone = new TaskInventoryDictionary(); | 233 | TaskInventoryDictionary clone = new TaskInventoryDictionary(); |
56 | 234 | ||
57 | lock (this) | 235 | m_itemLock.EnterReadLock(); |
236 | foreach (UUID uuid in Keys) | ||
58 | { | 237 | { |
59 | foreach (UUID uuid in Keys) | 238 | clone.Add(uuid, (TaskInventoryItem) this[uuid].Clone()); |
60 | { | ||
61 | clone.Add(uuid, (TaskInventoryItem) this[uuid].Clone()); | ||
62 | } | ||
63 | } | 239 | } |
64 | 240 | m_itemLock.ExitReadLock(); | |
241 | |||
65 | return clone; | 242 | return clone; |
66 | } | 243 | } |
67 | 244 | ||
diff --git a/OpenSim/Framework/TaskInventoryItem.cs b/OpenSim/Framework/TaskInventoryItem.cs index a06f8e7..574ee56 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 | public UUID AssetID { | 76 | public UUID AssetID { |
77 | get { | 77 | get { |
78 | return _assetID; | 78 | return _assetID; |
diff --git a/OpenSim/Framework/Tests/MundaneFrameworkTests.cs b/OpenSim/Framework/Tests/MundaneFrameworkTests.cs index 1dc8053..0fbdaf3 100644 --- a/OpenSim/Framework/Tests/MundaneFrameworkTests.cs +++ b/OpenSim/Framework/Tests/MundaneFrameworkTests.cs | |||
@@ -218,12 +218,12 @@ namespace OpenSim.Framework.Tests | |||
218 | BannedHostNameMask = string.Empty, | 218 | BannedHostNameMask = string.Empty, |
219 | BannedUserID = bannedUserId} | 219 | BannedUserID = bannedUserId} |
220 | ); | 220 | ); |
221 | Assert.IsTrue(es.IsBanned(bannedUserId), "User Should be banned but is not."); | 221 | Assert.IsTrue(es.IsBanned(bannedUserId, 32), "User Should be banned but is not."); |
222 | Assert.IsFalse(es.IsBanned(UUID.Zero), "User Should not be banned but is."); | 222 | Assert.IsFalse(es.IsBanned(UUID.Zero, 32), "User Should not be banned but is."); |
223 | 223 | ||
224 | es.RemoveBan(bannedUserId); | 224 | es.RemoveBan(bannedUserId); |
225 | 225 | ||
226 | Assert.IsFalse(es.IsBanned(bannedUserId), "User Should not be banned but is."); | 226 | Assert.IsFalse(es.IsBanned(bannedUserId, 32), "User Should not be banned but is."); |
227 | 227 | ||
228 | es.AddEstateManager(UUID.Zero); | 228 | es.AddEstateManager(UUID.Zero); |
229 | 229 | ||
diff --git a/OpenSim/Framework/ThrottleOutPacketType.cs b/OpenSim/Framework/ThrottleOutPacketType.cs index ca4b126..87899f0 100644 --- a/OpenSim/Framework/ThrottleOutPacketType.cs +++ b/OpenSim/Framework/ThrottleOutPacketType.cs | |||
@@ -47,6 +47,8 @@ namespace OpenSim.Framework | |||
47 | Texture = 5, | 47 | Texture = 5, |
48 | /// <summary>Non-texture assets</summary> | 48 | /// <summary>Non-texture assets</summary> |
49 | Asset = 6, | 49 | Asset = 6, |
50 | |||
51 | HighPriority = 128, | ||
50 | } | 52 | } |
51 | 53 | ||
52 | [Flags] | 54 | [Flags] |
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index bde4673..557f38e 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs | |||
@@ -516,19 +516,25 @@ namespace OpenSim.Framework | |||
516 | /// </summary> | 516 | /// </summary> |
517 | /// <param name="data"></param> | 517 | /// <param name="data"></param> |
518 | /// <returns></returns> | 518 | /// <returns></returns> |
519 | |||
519 | public static string Md5Hash(string data) | 520 | public static string Md5Hash(string data) |
520 | { | 521 | { |
521 | byte[] dataMd5 = ComputeMD5Hash(data); | 522 | return Md5Hash(data, Encoding.Default); |
523 | } | ||
524 | |||
525 | public static string Md5Hash(string data, Encoding encoding) | ||
526 | { | ||
527 | byte[] dataMd5 = ComputeMD5Hash(data, encoding); | ||
522 | StringBuilder sb = new StringBuilder(); | 528 | StringBuilder sb = new StringBuilder(); |
523 | for (int i = 0; i < dataMd5.Length; i++) | 529 | for (int i = 0; i < dataMd5.Length; i++) |
524 | sb.AppendFormat("{0:x2}", dataMd5[i]); | 530 | sb.AppendFormat("{0:x2}", dataMd5[i]); |
525 | return sb.ToString(); | 531 | return sb.ToString(); |
526 | } | 532 | } |
527 | 533 | ||
528 | private static byte[] ComputeMD5Hash(string data) | 534 | private static byte[] ComputeMD5Hash(string data, Encoding encoding) |
529 | { | 535 | { |
530 | MD5 md5 = MD5.Create(); | 536 | MD5 md5 = MD5.Create(); |
531 | return md5.ComputeHash(Encoding.Default.GetBytes(data)); | 537 | return md5.ComputeHash(encoding.GetBytes(data)); |
532 | } | 538 | } |
533 | 539 | ||
534 | /// <summary> | 540 | /// <summary> |
@@ -536,6 +542,12 @@ namespace OpenSim.Framework | |||
536 | /// </summary> | 542 | /// </summary> |
537 | /// <param name="data"></param> | 543 | /// <param name="data"></param> |
538 | /// <returns></returns> | 544 | /// <returns></returns> |
545 | |||
546 | public static string SHA1Hash(string data, Encoding enc) | ||
547 | { | ||
548 | return SHA1Hash(enc.GetBytes(data)); | ||
549 | } | ||
550 | |||
539 | public static string SHA1Hash(string data) | 551 | public static string SHA1Hash(string data) |
540 | { | 552 | { |
541 | return SHA1Hash(Encoding.Default.GetBytes(data)); | 553 | return SHA1Hash(Encoding.Default.GetBytes(data)); |
@@ -1277,19 +1289,19 @@ namespace OpenSim.Framework | |||
1277 | { | 1289 | { |
1278 | string os = String.Empty; | 1290 | string os = String.Empty; |
1279 | 1291 | ||
1280 | if (Environment.OSVersion.Platform != PlatformID.Unix) | 1292 | // if (Environment.OSVersion.Platform != PlatformID.Unix) |
1281 | { | 1293 | // { |
1282 | os = Environment.OSVersion.ToString(); | 1294 | // os = Environment.OSVersion.ToString(); |
1283 | } | 1295 | // } |
1284 | else | 1296 | // else |
1285 | { | 1297 | // { |
1286 | os = ReadEtcIssue(); | 1298 | // os = ReadEtcIssue(); |
1287 | } | 1299 | // } |
1288 | 1300 | // | |
1289 | if (os.Length > 45) | 1301 | // if (os.Length > 45) |
1290 | { | 1302 | // { |
1291 | os = os.Substring(0, 45); | 1303 | // os = os.Substring(0, 45); |
1292 | } | 1304 | // } |
1293 | 1305 | ||
1294 | return os; | 1306 | return os; |
1295 | } | 1307 | } |
@@ -1421,7 +1433,7 @@ namespace OpenSim.Framework | |||
1421 | 1433 | ||
1422 | public static Guid GetHashGuid(string data, string salt) | 1434 | public static Guid GetHashGuid(string data, string salt) |
1423 | { | 1435 | { |
1424 | byte[] hash = ComputeMD5Hash(data + salt); | 1436 | byte[] hash = ComputeMD5Hash(data + salt, Encoding.Default); |
1425 | 1437 | ||
1426 | //string s = BitConverter.ToString(hash); | 1438 | //string s = BitConverter.ToString(hash); |
1427 | 1439 | ||
@@ -2233,4 +2245,112 @@ namespace OpenSim.Framework | |||
2233 | return str.Replace("_", "\\_").Replace("%", "\\%"); | 2245 | return str.Replace("_", "\\_").Replace("%", "\\%"); |
2234 | } | 2246 | } |
2235 | } | 2247 | } |
2248 | |||
2249 | public class DoubleQueue<T> where T:class | ||
2250 | { | ||
2251 | private Queue<T> m_lowQueue = new Queue<T>(); | ||
2252 | private Queue<T> m_highQueue = new Queue<T>(); | ||
2253 | |||
2254 | private object m_syncRoot = new object(); | ||
2255 | private Semaphore m_s = new Semaphore(0, 1); | ||
2256 | |||
2257 | public DoubleQueue() | ||
2258 | { | ||
2259 | } | ||
2260 | |||
2261 | public virtual int Count | ||
2262 | { | ||
2263 | get { return m_highQueue.Count + m_lowQueue.Count; } | ||
2264 | } | ||
2265 | |||
2266 | public virtual void Enqueue(T data) | ||
2267 | { | ||
2268 | Enqueue(m_lowQueue, data); | ||
2269 | } | ||
2270 | |||
2271 | public virtual void EnqueueLow(T data) | ||
2272 | { | ||
2273 | Enqueue(m_lowQueue, data); | ||
2274 | } | ||
2275 | |||
2276 | public virtual void EnqueueHigh(T data) | ||
2277 | { | ||
2278 | Enqueue(m_highQueue, data); | ||
2279 | } | ||
2280 | |||
2281 | private void Enqueue(Queue<T> q, T data) | ||
2282 | { | ||
2283 | lock (m_syncRoot) | ||
2284 | { | ||
2285 | m_lowQueue.Enqueue(data); | ||
2286 | m_s.WaitOne(0); | ||
2287 | m_s.Release(); | ||
2288 | } | ||
2289 | } | ||
2290 | |||
2291 | public virtual T Dequeue() | ||
2292 | { | ||
2293 | return Dequeue(Timeout.Infinite); | ||
2294 | } | ||
2295 | |||
2296 | public virtual T Dequeue(int tmo) | ||
2297 | { | ||
2298 | return Dequeue(TimeSpan.FromMilliseconds(tmo)); | ||
2299 | } | ||
2300 | |||
2301 | public virtual T Dequeue(TimeSpan wait) | ||
2302 | { | ||
2303 | T res = null; | ||
2304 | |||
2305 | if (!Dequeue(wait, ref res)) | ||
2306 | return null; | ||
2307 | |||
2308 | return res; | ||
2309 | } | ||
2310 | |||
2311 | public bool Dequeue(int timeout, ref T res) | ||
2312 | { | ||
2313 | return Dequeue(TimeSpan.FromMilliseconds(timeout), ref res); | ||
2314 | } | ||
2315 | |||
2316 | public bool Dequeue(TimeSpan wait, ref T res) | ||
2317 | { | ||
2318 | if (!m_s.WaitOne(wait)) | ||
2319 | return false; | ||
2320 | |||
2321 | lock (m_syncRoot) | ||
2322 | { | ||
2323 | if (m_highQueue.Count > 0) | ||
2324 | res = m_highQueue.Dequeue(); | ||
2325 | else | ||
2326 | res = m_lowQueue.Dequeue(); | ||
2327 | |||
2328 | if (m_highQueue.Count == 0 && m_lowQueue.Count == 0) | ||
2329 | return true; | ||
2330 | |||
2331 | try | ||
2332 | { | ||
2333 | m_s.Release(); | ||
2334 | } | ||
2335 | catch | ||
2336 | { | ||
2337 | } | ||
2338 | |||
2339 | return true; | ||
2340 | } | ||
2341 | } | ||
2342 | |||
2343 | public virtual void Clear() | ||
2344 | { | ||
2345 | |||
2346 | lock (m_syncRoot) | ||
2347 | { | ||
2348 | // Make sure sem count is 0 | ||
2349 | m_s.WaitOne(0); | ||
2350 | |||
2351 | m_lowQueue.Clear(); | ||
2352 | m_highQueue.Clear(); | ||
2353 | } | ||
2354 | } | ||
2355 | } | ||
2236 | } | 2356 | } |
diff --git a/OpenSim/Framework/WearableCacheItem.cs b/OpenSim/Framework/WearableCacheItem.cs new file mode 100644 index 0000000..1aecf79 --- /dev/null +++ b/OpenSim/Framework/WearableCacheItem.cs | |||
@@ -0,0 +1,157 @@ | |||
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 System; | ||
29 | using System.Collections.Generic; | ||
30 | using OpenMetaverse; | ||
31 | using OpenMetaverse.StructuredData; | ||
32 | |||
33 | namespace OpenSim.Framework | ||
34 | { | ||
35 | [Serializable] | ||
36 | public class WearableCacheItem | ||
37 | { | ||
38 | public uint TextureIndex { get; set; } | ||
39 | public UUID CacheId { get; set; } | ||
40 | public UUID TextureID { get; set; } | ||
41 | public AssetBase TextureAsset { get; set; } | ||
42 | |||
43 | |||
44 | public static WearableCacheItem[] GetDefaultCacheItem() | ||
45 | { | ||
46 | int itemmax = 21; | ||
47 | WearableCacheItem[] retitems = new WearableCacheItem[itemmax]; | ||
48 | for (uint i=0;i<itemmax;i++) | ||
49 | retitems[i] = new WearableCacheItem() {CacheId = UUID.Zero, TextureID = UUID.Zero, TextureIndex = i + 1}; | ||
50 | return retitems; | ||
51 | } | ||
52 | public static WearableCacheItem[] FromOSD(OSD pInput, IImprovedAssetCache dataCache) | ||
53 | { | ||
54 | List<WearableCacheItem> ret = new List<WearableCacheItem>(); | ||
55 | if (pInput.Type == OSDType.Array) | ||
56 | { | ||
57 | OSDArray itemarray = (OSDArray) pInput; | ||
58 | foreach (OSDMap item in itemarray) | ||
59 | { | ||
60 | ret.Add(new WearableCacheItem() | ||
61 | { | ||
62 | TextureIndex = item["textureindex"].AsUInteger(), | ||
63 | CacheId = item["cacheid"].AsUUID(), | ||
64 | TextureID = item["textureid"].AsUUID() | ||
65 | }); | ||
66 | |||
67 | if (dataCache != null && item.ContainsKey("assetdata")) | ||
68 | { | ||
69 | AssetBase asset = new AssetBase(item["textureid"].AsUUID(),"BakedTexture",(sbyte)AssetType.Texture,UUID.Zero.ToString()); | ||
70 | asset.Temporary = true; | ||
71 | asset.Data = item["assetdata"].AsBinary(); | ||
72 | dataCache.Cache(asset); | ||
73 | } | ||
74 | } | ||
75 | } | ||
76 | else if (pInput.Type == OSDType.Map) | ||
77 | { | ||
78 | OSDMap item = (OSDMap) pInput; | ||
79 | ret.Add(new WearableCacheItem(){ | ||
80 | TextureIndex = item["textureindex"].AsUInteger(), | ||
81 | CacheId = item["cacheid"].AsUUID(), | ||
82 | TextureID = item["textureid"].AsUUID() | ||
83 | }); | ||
84 | if (dataCache != null && item.ContainsKey("assetdata")) | ||
85 | { | ||
86 | string assetCreator = item["assetcreator"].AsString(); | ||
87 | string assetName = item["assetname"].AsString(); | ||
88 | AssetBase asset = new AssetBase(item["textureid"].AsUUID(), assetName, (sbyte)AssetType.Texture, assetCreator); | ||
89 | asset.Temporary = true; | ||
90 | asset.Data = item["assetdata"].AsBinary(); | ||
91 | dataCache.Cache(asset); | ||
92 | } | ||
93 | } | ||
94 | else | ||
95 | { | ||
96 | return new WearableCacheItem[0]; | ||
97 | } | ||
98 | return ret.ToArray(); | ||
99 | |||
100 | } | ||
101 | public static OSD ToOSD(WearableCacheItem[] pcacheItems, IImprovedAssetCache dataCache) | ||
102 | { | ||
103 | OSDArray arr = new OSDArray(); | ||
104 | foreach (WearableCacheItem item in pcacheItems) | ||
105 | { | ||
106 | OSDMap itemmap = new OSDMap(); | ||
107 | itemmap.Add("textureindex", OSD.FromUInteger(item.TextureIndex)); | ||
108 | itemmap.Add("cacheid", OSD.FromUUID(item.CacheId)); | ||
109 | itemmap.Add("textureid", OSD.FromUUID(item.TextureID)); | ||
110 | if (dataCache != null) | ||
111 | { | ||
112 | if (dataCache.Check(item.TextureID.ToString())) | ||
113 | { | ||
114 | AssetBase assetItem = dataCache.Get(item.TextureID.ToString()); | ||
115 | if (assetItem != null) | ||
116 | { | ||
117 | itemmap.Add("assetdata", OSD.FromBinary(assetItem.Data)); | ||
118 | itemmap.Add("assetcreator", OSD.FromString(assetItem.CreatorID)); | ||
119 | itemmap.Add("assetname", OSD.FromString(assetItem.Name)); | ||
120 | } | ||
121 | } | ||
122 | } | ||
123 | arr.Add(itemmap); | ||
124 | } | ||
125 | return arr; | ||
126 | } | ||
127 | public static WearableCacheItem SearchTextureIndex(uint pTextureIndex,WearableCacheItem[] pcacheItems) | ||
128 | { | ||
129 | for (int i = 0; i < pcacheItems.Length; i++) | ||
130 | { | ||
131 | if (pcacheItems[i].TextureIndex == pTextureIndex) | ||
132 | return pcacheItems[i]; | ||
133 | } | ||
134 | return null; | ||
135 | } | ||
136 | public static WearableCacheItem SearchTextureCacheId(UUID pCacheId, WearableCacheItem[] pcacheItems) | ||
137 | { | ||
138 | for (int i = 0; i < pcacheItems.Length; i++) | ||
139 | { | ||
140 | if (pcacheItems[i].CacheId == pCacheId) | ||
141 | return pcacheItems[i]; | ||
142 | } | ||
143 | return null; | ||
144 | } | ||
145 | public static WearableCacheItem SearchTextureTextureId(UUID pTextureId, WearableCacheItem[] pcacheItems) | ||
146 | { | ||
147 | for (int i = 0; i < pcacheItems.Length; i++) | ||
148 | { | ||
149 | if (pcacheItems[i].TextureID == pTextureId) | ||
150 | return pcacheItems[i]; | ||
151 | } | ||
152 | return null; | ||
153 | } | ||
154 | } | ||
155 | |||
156 | |||
157 | } | ||
diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 701fbb0..bf57fd4 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 | } |
@@ -862,7 +865,6 @@ namespace OpenSim.Framework | |||
862 | } | 865 | } |
863 | 866 | ||
864 | // m_log.DebugFormat("[ASYNC REQUEST]: Received {0}", deserial.ToString()); | 867 | // m_log.DebugFormat("[ASYNC REQUEST]: Received {0}", deserial.ToString()); |
865 | |||
866 | try | 868 | try |
867 | { | 869 | { |
868 | action(deserial); | 870 | action(deserial); |
@@ -877,9 +879,10 @@ namespace OpenSim.Framework | |||
877 | }, null); | 879 | }, null); |
878 | } | 880 | } |
879 | 881 | ||
880 | int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); | 882 | tickdiff = Util.EnvironmentTickCountSubtract(tickstart); |
881 | if (tickdiff > WebUtil.LongCallTime) | 883 | if (tickdiff > WebUtil.LongCallTime) |
882 | { | 884 | { |
885 | /* | ||
883 | string originalRequest = null; | 886 | string originalRequest = null; |
884 | 887 | ||
885 | if (buffer != null) | 888 | if (buffer != null) |
@@ -898,12 +901,19 @@ namespace OpenSim.Framework | |||
898 | tickdiff, | 901 | tickdiff, |
899 | tickdata, | 902 | tickdata, |
900 | originalRequest); | 903 | originalRequest); |
904 | */ | ||
905 | m_log.InfoFormat( | ||
906 | "[ASYNC REQUEST]: Slow WebRequest SETUP <{0}> {1} {2} took {3}ms", | ||
907 | reqnum, | ||
908 | verb, | ||
909 | requestUrl, | ||
910 | tickdiff); | ||
901 | } | 911 | } |
902 | else if (WebUtil.DebugLevel >= 4) | 912 | else if (WebUtil.DebugLevel >= 4) |
903 | { | 913 | { |
904 | m_log.DebugFormat( | 914 | m_log.DebugFormat( |
905 | "[WEB UTIL]: HTTP OUT {0} took {1}ms, {2}ms writing", | 915 | "[WEB UTIL]: HTTP OUT {0} took {1}ms", |
906 | reqnum, tickdiff, tickdata); | 916 | reqnum, tickdiff); |
907 | } | 917 | } |
908 | } | 918 | } |
909 | } | 919 | } |
@@ -938,6 +948,8 @@ namespace OpenSim.Framework | |||
938 | request.Method = verb; | 948 | request.Method = verb; |
939 | string respstring = String.Empty; | 949 | string respstring = String.Empty; |
940 | 950 | ||
951 | int tickset = Util.EnvironmentTickCountSubtract(tickstart); | ||
952 | |||
941 | using (MemoryStream buffer = new MemoryStream()) | 953 | using (MemoryStream buffer = new MemoryStream()) |
942 | { | 954 | { |
943 | if ((verb == "POST") || (verb == "PUT")) | 955 | if ((verb == "POST") || (verb == "PUT")) |
@@ -1017,6 +1029,7 @@ namespace OpenSim.Framework | |||
1017 | verb, | 1029 | verb, |
1018 | requestUrl, | 1030 | requestUrl, |
1019 | tickdiff, | 1031 | tickdiff, |
1032 | tickset, | ||
1020 | tickdata, | 1033 | tickdata, |
1021 | obj.Length > WebUtil.MaxRequestDiagLength ? obj.Remove(WebUtil.MaxRequestDiagLength) : obj); | 1034 | obj.Length > WebUtil.MaxRequestDiagLength ? obj.Remove(WebUtil.MaxRequestDiagLength) : obj); |
1022 | else if (WebUtil.DebugLevel >= 4) | 1035 | else if (WebUtil.DebugLevel >= 4) |
@@ -1075,6 +1088,8 @@ namespace OpenSim.Framework | |||
1075 | ht.ServicePoint.ConnectionLimit = maxConnections; | 1088 | ht.ServicePoint.ConnectionLimit = maxConnections; |
1076 | 1089 | ||
1077 | request.Method = verb; | 1090 | request.Method = verb; |
1091 | if (pTimeout != 0) | ||
1092 | request.Timeout = pTimeout * 1000; | ||
1078 | MemoryStream buffer = null; | 1093 | MemoryStream buffer = null; |
1079 | 1094 | ||
1080 | if ((verb == "POST") || (verb == "PUT")) | 1095 | if ((verb == "POST") || (verb == "PUT")) |