diff options
Diffstat (limited to 'OpenSim/Framework')
40 files changed, 1460 insertions, 254 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 a02993d..5ddbd61 100644 --- a/OpenSim/Framework/EstateSettings.cs +++ b/OpenSim/Framework/EstateSettings.cs | |||
@@ -362,11 +362,30 @@ namespace OpenSim.Framework | |||
362 | return false; | 362 | return false; |
363 | } | 363 | } |
364 | 364 | ||
365 | public bool IsBanned(UUID avatarID) | 365 | public bool IsBanned(UUID avatarID, int userFlags) |
366 | { | 366 | { |
367 | foreach (EstateBan ban in l_EstateBans) | 367 | foreach (EstateBan ban in l_EstateBans) |
368 | if (ban.BannedUserID == avatarID) | 368 | if (ban.BannedUserID == avatarID) |
369 | 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 | |||
370 | return false; | 389 | return false; |
371 | } | 390 | } |
372 | 391 | ||
@@ -374,7 +393,7 @@ namespace OpenSim.Framework | |||
374 | { | 393 | { |
375 | if (ban == null) | 394 | if (ban == null) |
376 | return; | 395 | return; |
377 | if (!IsBanned(ban.BannedUserID)) | 396 | if (!IsBanned(ban.BannedUserID, 32)) //Ignore age-based bans |
378 | l_EstateBans.Add(ban); | 397 | l_EstateBans.Add(ban); |
379 | } | 398 | } |
380 | 399 | ||
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 59ce2c4..34c240a 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs | |||
@@ -64,14 +64,15 @@ 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, Vector3 AvSize, WearableCacheItem[] CacheItems); | ||
67 | public delegate void CachedTextureRequest(IClientAPI remoteClient, int serial, List<CachedTextureRequestArg> cachedTextureRequest); | 68 | public delegate void CachedTextureRequest(IClientAPI remoteClient, int serial, List<CachedTextureRequestArg> cachedTextureRequest); |
68 | 69 | ||
69 | public delegate void SetAppearance(IClientAPI remoteClient, Primitive.TextureEntry textureEntry, byte[] visualParams); | ||
70 | |||
71 | public delegate void StartAnim(IClientAPI remoteClient, UUID animID); | 70 | public delegate void StartAnim(IClientAPI remoteClient, UUID animID); |
72 | 71 | ||
73 | public delegate void StopAnim(IClientAPI remoteClient, UUID animID); | 72 | public delegate void StopAnim(IClientAPI remoteClient, UUID animID); |
74 | 73 | ||
74 | public delegate void ChangeAnim(UUID animID, bool addOrRemove, bool sendPack); | ||
75 | |||
75 | public delegate void LinkObjects(IClientAPI remoteClient, uint parent, List<uint> children); | 76 | public delegate void LinkObjects(IClientAPI remoteClient, uint parent, List<uint> children); |
76 | 77 | ||
77 | public delegate void DelinkObjects(List<uint> primIds, IClientAPI client); | 78 | public delegate void DelinkObjects(List<uint> primIds, IClientAPI client); |
@@ -132,6 +133,8 @@ namespace OpenSim.Framework | |||
132 | 133 | ||
133 | public delegate void UpdateVector(uint localID, Vector3 pos, IClientAPI remoteClient); | 134 | public delegate void UpdateVector(uint localID, Vector3 pos, IClientAPI remoteClient); |
134 | 135 | ||
136 | public delegate void ClientChangeObject(uint localID, object data ,IClientAPI remoteClient); | ||
137 | |||
135 | public delegate void UpdatePrimRotation(uint localID, Quaternion rot, IClientAPI remoteClient); | 138 | public delegate void UpdatePrimRotation(uint localID, Quaternion rot, IClientAPI remoteClient); |
136 | 139 | ||
137 | public delegate void UpdatePrimSingleRotation(uint localID, Quaternion rot, IClientAPI remoteClient); | 140 | public delegate void UpdatePrimSingleRotation(uint localID, Quaternion rot, IClientAPI remoteClient); |
@@ -268,6 +271,9 @@ namespace OpenSim.Framework | |||
268 | public delegate void MoveInventoryItem( | 271 | public delegate void MoveInventoryItem( |
269 | IClientAPI remoteClient, List<InventoryItemBase> items); | 272 | IClientAPI remoteClient, List<InventoryItemBase> items); |
270 | 273 | ||
274 | public delegate void MoveItemsAndLeaveCopy( | ||
275 | IClientAPI remoteClient, List<InventoryItemBase> items, UUID destFolder); | ||
276 | |||
271 | public delegate void RemoveInventoryItem( | 277 | public delegate void RemoveInventoryItem( |
272 | IClientAPI remoteClient, List<UUID> itemIDs); | 278 | IClientAPI remoteClient, List<UUID> itemIDs); |
273 | 279 | ||
@@ -443,6 +449,7 @@ namespace OpenSim.Framework | |||
443 | public delegate void ClassifiedInfoRequest(UUID classifiedID, IClientAPI client); | 449 | public delegate void ClassifiedInfoRequest(UUID classifiedID, IClientAPI client); |
444 | 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); | 450 | 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); |
445 | public delegate void ClassifiedDelete(UUID classifiedID, IClientAPI client); | 451 | public delegate void ClassifiedDelete(UUID classifiedID, IClientAPI client); |
452 | public delegate void ClassifiedGodDelete(UUID classifiedID, UUID queryID, IClientAPI client); | ||
446 | 453 | ||
447 | public delegate void EventNotificationAddRequest(uint EventID, IClientAPI client); | 454 | public delegate void EventNotificationAddRequest(uint EventID, IClientAPI client); |
448 | public delegate void EventNotificationRemoveRequest(uint EventID, IClientAPI client); | 455 | public delegate void EventNotificationRemoveRequest(uint EventID, IClientAPI client); |
@@ -465,9 +472,9 @@ namespace OpenSim.Framework | |||
465 | 472 | ||
466 | public delegate void AgentFOV(IClientAPI client, float verticalAngle); | 473 | public delegate void AgentFOV(IClientAPI client, float verticalAngle); |
467 | 474 | ||
468 | public delegate void MuteListEntryUpdate(IClientAPI client, UUID MuteID, string Name, int Flags,UUID AgentID); | 475 | public delegate void MuteListEntryUpdate(IClientAPI client, UUID MuteID, string Name, int type, uint flags); |
469 | 476 | ||
470 | public delegate void MuteListEntryRemove(IClientAPI client, UUID MuteID, string Name, UUID AgentID); | 477 | public delegate void MuteListEntryRemove(IClientAPI client, UUID MuteID, string Name); |
471 | 478 | ||
472 | public delegate void AvatarInterestReply(IClientAPI client,UUID target, uint wantmask, string wanttext, uint skillsmask, string skillstext, string languages); | 479 | public delegate void AvatarInterestReply(IClientAPI client,UUID target, uint wantmask, string wanttext, uint skillsmask, string skillstext, string languages); |
473 | 480 | ||
@@ -505,6 +512,7 @@ namespace OpenSim.Framework | |||
505 | public delegate void SimWideDeletesDelegate(IClientAPI client,UUID agentID, int flags, UUID targetID); | 512 | public delegate void SimWideDeletesDelegate(IClientAPI client,UUID agentID, int flags, UUID targetID); |
506 | 513 | ||
507 | public delegate void SendPostcard(IClientAPI client); | 514 | public delegate void SendPostcard(IClientAPI client); |
515 | public delegate void ChangeInventoryItemFlags(IClientAPI client, UUID itemID, uint flags); | ||
508 | 516 | ||
509 | #endregion | 517 | #endregion |
510 | 518 | ||
@@ -794,6 +802,7 @@ namespace OpenSim.Framework | |||
794 | event ObjectDrop OnObjectDrop; | 802 | event ObjectDrop OnObjectDrop; |
795 | event StartAnim OnStartAnim; | 803 | event StartAnim OnStartAnim; |
796 | event StopAnim OnStopAnim; | 804 | event StopAnim OnStopAnim; |
805 | event ChangeAnim OnChangeAnim; | ||
797 | event LinkObjects OnLinkObjects; | 806 | event LinkObjects OnLinkObjects; |
798 | event DelinkObjects OnDelinkObjects; | 807 | event DelinkObjects OnDelinkObjects; |
799 | event RequestMapBlocks OnRequestMapBlocks; | 808 | event RequestMapBlocks OnRequestMapBlocks; |
@@ -858,6 +867,7 @@ namespace OpenSim.Framework | |||
858 | event RequestObjectPropertiesFamily OnRequestObjectPropertiesFamily; | 867 | event RequestObjectPropertiesFamily OnRequestObjectPropertiesFamily; |
859 | event UpdatePrimFlags OnUpdatePrimFlags; | 868 | event UpdatePrimFlags OnUpdatePrimFlags; |
860 | event UpdatePrimTexture OnUpdatePrimTexture; | 869 | event UpdatePrimTexture OnUpdatePrimTexture; |
870 | event ClientChangeObject onClientChangeObject; | ||
861 | event UpdateVector OnUpdatePrimGroupPosition; | 871 | event UpdateVector OnUpdatePrimGroupPosition; |
862 | event UpdateVector OnUpdatePrimSinglePosition; | 872 | event UpdateVector OnUpdatePrimSinglePosition; |
863 | event UpdatePrimRotation OnUpdatePrimGroupRotation; | 873 | event UpdatePrimRotation OnUpdatePrimGroupRotation; |
@@ -882,6 +892,7 @@ namespace OpenSim.Framework | |||
882 | event RequestTaskInventory OnRequestTaskInventory; | 892 | event RequestTaskInventory OnRequestTaskInventory; |
883 | event UpdateInventoryItem OnUpdateInventoryItem; | 893 | event UpdateInventoryItem OnUpdateInventoryItem; |
884 | event CopyInventoryItem OnCopyInventoryItem; | 894 | event CopyInventoryItem OnCopyInventoryItem; |
895 | event MoveItemsAndLeaveCopy OnMoveItemsAndLeaveCopy; | ||
885 | event MoveInventoryItem OnMoveInventoryItem; | 896 | event MoveInventoryItem OnMoveInventoryItem; |
886 | event RemoveInventoryFolder OnRemoveInventoryFolder; | 897 | event RemoveInventoryFolder OnRemoveInventoryFolder; |
887 | event RemoveInventoryItem OnRemoveInventoryItem; | 898 | event RemoveInventoryItem OnRemoveInventoryItem; |
@@ -1000,7 +1011,7 @@ namespace OpenSim.Framework | |||
1000 | event ClassifiedInfoRequest OnClassifiedInfoRequest; | 1011 | event ClassifiedInfoRequest OnClassifiedInfoRequest; |
1001 | event ClassifiedInfoUpdate OnClassifiedInfoUpdate; | 1012 | event ClassifiedInfoUpdate OnClassifiedInfoUpdate; |
1002 | event ClassifiedDelete OnClassifiedDelete; | 1013 | event ClassifiedDelete OnClassifiedDelete; |
1003 | event ClassifiedDelete OnClassifiedGodDelete; | 1014 | event ClassifiedGodDelete OnClassifiedGodDelete; |
1004 | 1015 | ||
1005 | event EventNotificationAddRequest OnEventNotificationAddRequest; | 1016 | event EventNotificationAddRequest OnEventNotificationAddRequest; |
1006 | event EventNotificationRemoveRequest OnEventNotificationRemoveRequest; | 1017 | event EventNotificationRemoveRequest OnEventNotificationRemoveRequest; |
@@ -1039,11 +1050,12 @@ namespace OpenSim.Framework | |||
1039 | event GroupVoteHistoryRequest OnGroupVoteHistoryRequest; | 1050 | event GroupVoteHistoryRequest OnGroupVoteHistoryRequest; |
1040 | event SimWideDeletesDelegate OnSimWideDeletes; | 1051 | event SimWideDeletesDelegate OnSimWideDeletes; |
1041 | event SendPostcard OnSendPostcard; | 1052 | event SendPostcard OnSendPostcard; |
1053 | event ChangeInventoryItemFlags OnChangeInventoryItemFlags; | ||
1042 | event MuteListEntryUpdate OnUpdateMuteListEntry; | 1054 | event MuteListEntryUpdate OnUpdateMuteListEntry; |
1043 | event MuteListEntryRemove OnRemoveMuteListEntry; | 1055 | event MuteListEntryRemove OnRemoveMuteListEntry; |
1044 | event GodlikeMessage onGodlikeMessage; | 1056 | event GodlikeMessage onGodlikeMessage; |
1045 | event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate; | 1057 | event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate; |
1046 | 1058 | event GenericCall2 OnUpdateThrottles; | |
1047 | /// <summary> | 1059 | /// <summary> |
1048 | /// Set the debug level at which packet output should be printed to console. | 1060 | /// Set the debug level at which packet output should be printed to console. |
1049 | /// </summary> | 1061 | /// </summary> |
@@ -1064,7 +1076,7 @@ namespace OpenSim.Framework | |||
1064 | /// If true, attempts the close without checking active status. You do not want to try this except as a last | 1076 | /// If true, attempts the close without checking active status. You do not want to try this except as a last |
1065 | /// ditch attempt where Active == false but the ScenePresence still exists. | 1077 | /// ditch attempt where Active == false but the ScenePresence still exists. |
1066 | /// </param> | 1078 | /// </param> |
1067 | void Close(bool force); | 1079 | void Close(bool sendStop, bool force); |
1068 | 1080 | ||
1069 | void Kick(string message); | 1081 | void Kick(string message); |
1070 | 1082 | ||
@@ -1166,6 +1178,8 @@ namespace OpenSim.Framework | |||
1166 | 1178 | ||
1167 | void SetChildAgentThrottle(byte[] throttle); | 1179 | void SetChildAgentThrottle(byte[] throttle); |
1168 | 1180 | ||
1181 | void SetAgentThrottleSilent(int throttle, int setting); | ||
1182 | |||
1169 | void SendAvatarDataImmediate(ISceneEntity avatar); | 1183 | void SendAvatarDataImmediate(ISceneEntity avatar); |
1170 | 1184 | ||
1171 | /// <summary> | 1185 | /// <summary> |
@@ -1189,6 +1203,7 @@ namespace OpenSim.Framework | |||
1189 | /// </summary> | 1203 | /// </summary> |
1190 | /// <param name="Item"></param> | 1204 | /// <param name="Item"></param> |
1191 | void SendInventoryItemCreateUpdate(InventoryItemBase Item, uint callbackId); | 1205 | void SendInventoryItemCreateUpdate(InventoryItemBase Item, uint callbackId); |
1206 | void SendInventoryItemCreateUpdate(InventoryItemBase Item, UUID transactionID, uint callbackId); | ||
1192 | 1207 | ||
1193 | void SendRemoveInventoryItem(UUID itemID); | 1208 | void SendRemoveInventoryItem(UUID itemID); |
1194 | 1209 | ||
@@ -1208,7 +1223,7 @@ namespace OpenSim.Framework | |||
1208 | /// <param name="node"></param> | 1223 | /// <param name="node"></param> |
1209 | void SendBulkUpdateInventory(InventoryNodeBase node); | 1224 | void SendBulkUpdateInventory(InventoryNodeBase node); |
1210 | 1225 | ||
1211 | void SendXferPacket(ulong xferID, uint packet, byte[] data); | 1226 | void SendXferPacket(ulong xferID, uint packet, byte[] data, bool isTaskInventory); |
1212 | 1227 | ||
1213 | void SendAbortXferPacket(ulong xferID); | 1228 | void SendAbortXferPacket(ulong xferID); |
1214 | 1229 | ||
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..7378d2e 100644 --- a/OpenSim/Framework/IMoneyModule.cs +++ b/OpenSim/Framework/IMoneyModule.cs | |||
@@ -33,13 +33,14 @@ 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); |
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, string text); |
42 | void ApplyUploadCharge(UUID agentID, int amount, string text); | 42 | void ApplyUploadCharge(UUID agentID, int amount, string text); |
43 | void MoveMoney(UUID fromUser, UUID toUser, int amount, string text); | ||
43 | 44 | ||
44 | int UploadCharge { get; } | 45 | int UploadCharge { get; } |
45 | int GroupCreationCharge { get; } | 46 | int GroupCreationCharge { get; } |
diff --git a/OpenSim/Framework/LandData.cs b/OpenSim/Framework/LandData.cs index 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/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..6dde62f 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; |
@@ -707,6 +709,9 @@ namespace OpenSim.Framework | |||
707 | string location = String.Format("{0},{1}", m_regionLocX, m_regionLocY); | 709 | string location = String.Format("{0},{1}", m_regionLocX, m_regionLocY); |
708 | config.Set("Location", location); | 710 | config.Set("Location", location); |
709 | 711 | ||
712 | if (DataStore != String.Empty) | ||
713 | config.Set("Datastore", DataStore); | ||
714 | |||
710 | config.Set("InternalAddress", m_internalEndPoint.Address.ToString()); | 715 | config.Set("InternalAddress", m_internalEndPoint.Address.ToString()); |
711 | config.Set("InternalPort", m_internalEndPoint.Port); | 716 | config.Set("InternalPort", m_internalEndPoint.Port); |
712 | 717 | ||
@@ -921,6 +926,9 @@ namespace OpenSim.Framework | |||
921 | case "sim_location_y": | 926 | case "sim_location_y": |
922 | m_regionLocY = (uint) configuration_result; | 927 | m_regionLocY = (uint) configuration_result; |
923 | break; | 928 | break; |
929 | case "datastore": | ||
930 | DataStore = (string) configuration_result; | ||
931 | break; | ||
924 | case "internal_ip_address": | 932 | case "internal_ip_address": |
925 | IPAddress address = (IPAddress) configuration_result; | 933 | IPAddress address = (IPAddress) configuration_result; |
926 | m_internalEndPoint = new IPEndPoint(address, 0); | 934 | m_internalEndPoint = new IPEndPoint(address, 0); |
@@ -1077,6 +1085,11 @@ namespace OpenSim.Framework | |||
1077 | return regionInfo; | 1085 | return regionInfo; |
1078 | } | 1086 | } |
1079 | 1087 | ||
1088 | public int getInternalEndPointPort() | ||
1089 | { | ||
1090 | return m_internalEndPoint.Port; | ||
1091 | } | ||
1092 | |||
1080 | public Dictionary<string, object> ToKeyValuePairs() | 1093 | public Dictionary<string, object> ToKeyValuePairs() |
1081 | { | 1094 | { |
1082 | Dictionary<string, object> kvp = new Dictionary<string, object>(); | 1095 | 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..c7caf6f 100644 --- a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs +++ b/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs | |||
@@ -48,6 +48,9 @@ namespace OpenSim.Framework.RegionLoader.Web | |||
48 | 48 | ||
49 | public RegionInfo[] LoadRegions() | 49 | public RegionInfo[] LoadRegions() |
50 | { | 50 | { |
51 | int tries = 3; | ||
52 | int wait = 2000; | ||
53 | |||
51 | if (m_configSource == null) | 54 | if (m_configSource == null) |
52 | { | 55 | { |
53 | m_log.Error("[WEBLOADER]: Unable to load configuration source!"); | 56 | m_log.Error("[WEBLOADER]: Unable to load configuration source!"); |
@@ -66,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 | ||
79 | using (HttpWebResponse webResponse = (HttpWebResponse) webRequest.GetResponse()) | 80 | try |
80 | { | 81 | { |
81 | m_log.Debug("[WEBLOADER]: Downloading region information..."); | 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 == "Regions") | ||
97 | { | ||
98 | regionCount = xmlDoc.FirstChild.ChildNodes.Count; | ||
99 | |||
100 | if (regionCount > 0) | ||
101 | { | ||
102 | regionInfos = new RegionInfo[regionCount]; | ||
103 | int i; | ||
104 | for (i = 0; i < xmlDoc.FirstChild.ChildNodes.Count; i++) | ||
105 | { | ||
106 | m_log.Debug(xmlDoc.FirstChild.ChildNodes[i].OuterXml); | ||
107 | regionInfos[i] = | ||
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 | } | ||
82 | 123 | ||
83 | using (Stream s = webResponse.GetResponseStream()) | 124 | if (regionCount > 0 | allowRegionless) |
84 | { | 125 | return regionInfos; |
85 | using (StreamReader reader = new StreamReader(s)) | ||
86 | { | ||
87 | string tempStr = reader.ReadLine(); | ||
88 | while (tempStr != null) | ||
89 | { | ||
90 | xmlSource = xmlSource + tempStr; | ||
91 | tempStr = reader.ReadLine(); | ||
92 | } | ||
93 | } | ||
94 | } | ||
95 | } | ||
96 | 126 | ||
97 | m_log.Debug("[WEBLOADER]: Done downloading region information from server. Total Bytes: " + | 127 | m_log.Debug("[WEBLOADER]: Request yielded no regions."); |
98 | xmlSource.Length); | 128 | tries--; |
99 | XmlDocument xmlDoc = new XmlDocument(); | 129 | if (tries > 0) |
100 | xmlDoc.LoadXml(xmlSource); | ||
101 | if (xmlDoc.FirstChild.Name == "Regions") | ||
102 | { | ||
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 96a030b..74954cc 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..07bd48a 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs | |||
@@ -33,15 +33,20 @@ using log4net; | |||
33 | using HttpServer; | 33 | using HttpServer; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Monitoring; | 35 | using OpenSim.Framework.Monitoring; |
36 | using Amib.Threading; | ||
36 | 37 | ||
38 | |||
39 | /* | ||
37 | namespace OpenSim.Framework.Servers.HttpServer | 40 | namespace OpenSim.Framework.Servers.HttpServer |
38 | { | 41 | { |
42 | |||
39 | public class PollServiceRequestManager | 43 | public class PollServiceRequestManager |
40 | { | 44 | { |
41 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 45 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
42 | 46 | ||
43 | private readonly BaseHttpServer m_server; | 47 | private readonly BaseHttpServer m_server; |
44 | private static Queue m_requests = Queue.Synchronized(new Queue()); | 48 | private static Queue m_requests = Queue.Synchronized(new Queue()); |
49 | private static ManualResetEvent m_ev = new ManualResetEvent(false); | ||
45 | private uint m_WorkerThreadCount = 0; | 50 | private uint m_WorkerThreadCount = 0; |
46 | private Thread[] m_workerThreads; | 51 | private Thread[] m_workerThreads; |
47 | private PollServiceWorkerThread[] m_PollServiceWorkerThreads; | 52 | private PollServiceWorkerThread[] m_PollServiceWorkerThreads; |
@@ -74,7 +79,6 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
74 | ThreadPriority.Normal, | 79 | ThreadPriority.Normal, |
75 | false, | 80 | false, |
76 | true, | 81 | true, |
77 | null, | ||
78 | int.MaxValue); | 82 | int.MaxValue); |
79 | } | 83 | } |
80 | 84 | ||
@@ -84,7 +88,6 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
84 | ThreadPriority.Normal, | 88 | ThreadPriority.Normal, |
85 | false, | 89 | false, |
86 | true, | 90 | true, |
87 | null, | ||
88 | 1000 * 60 * 10); | 91 | 1000 * 60 * 10); |
89 | } | 92 | } |
90 | 93 | ||
@@ -98,15 +101,17 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
98 | { | 101 | { |
99 | lock (m_requests) | 102 | lock (m_requests) |
100 | m_requests.Enqueue(req); | 103 | m_requests.Enqueue(req); |
104 | m_ev.Set(); | ||
101 | } | 105 | } |
102 | 106 | ||
103 | public void ThreadStart() | 107 | public void ThreadStart() |
104 | { | 108 | { |
105 | while (m_running) | 109 | while (m_running) |
106 | { | 110 | { |
111 | m_ev.WaitOne(1000); | ||
112 | m_ev.Reset(); | ||
107 | Watchdog.UpdateThread(); | 113 | Watchdog.UpdateThread(); |
108 | ProcessQueuedRequests(); | 114 | ProcessQueuedRequests(); |
109 | Thread.Sleep(1000); | ||
110 | } | 115 | } |
111 | } | 116 | } |
112 | 117 | ||
@@ -150,8 +155,9 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
150 | foreach (object o in m_requests) | 155 | foreach (object o in m_requests) |
151 | { | 156 | { |
152 | PollServiceHttpRequest req = (PollServiceHttpRequest) o; | 157 | PollServiceHttpRequest req = (PollServiceHttpRequest) o; |
153 | PollServiceWorkerThread.DoHTTPGruntWork( | 158 | m_server.DoHTTPGruntWork( |
154 | m_server, req, req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id)); | 159 | req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id), |
160 | new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext)); | ||
155 | } | 161 | } |
156 | 162 | ||
157 | m_requests.Clear(); | 163 | m_requests.Clear(); |
@@ -162,4 +168,271 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
162 | } | 168 | } |
163 | } | 169 | } |
164 | } | 170 | } |
165 | } \ No newline at end of file | 171 | } |
172 | */ | ||
173 | |||
174 | using System.IO; | ||
175 | using System.Text; | ||
176 | using System.Collections.Generic; | ||
177 | |||
178 | namespace OpenSim.Framework.Servers.HttpServer | ||
179 | { | ||
180 | public class PollServiceRequestManager | ||
181 | { | ||
182 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
183 | |||
184 | private readonly BaseHttpServer m_server; | ||
185 | |||
186 | private BlockingQueue<PollServiceHttpRequest> m_requests = new BlockingQueue<PollServiceHttpRequest>(); | ||
187 | private static Queue<PollServiceHttpRequest> m_slowRequests = new Queue<PollServiceHttpRequest>(); | ||
188 | private static Queue<PollServiceHttpRequest> m_retryRequests = new Queue<PollServiceHttpRequest>(); | ||
189 | |||
190 | private uint m_WorkerThreadCount = 0; | ||
191 | private Thread[] m_workerThreads; | ||
192 | private Thread m_retrysThread; | ||
193 | |||
194 | private bool m_running = true; | ||
195 | private int slowCount = 0; | ||
196 | |||
197 | private SmartThreadPool m_threadPool = new SmartThreadPool(20000, 12, 2); | ||
198 | |||
199 | // private int m_timeout = 1000; // increase timeout 250; now use the event one | ||
200 | |||
201 | public PollServiceRequestManager(BaseHttpServer pSrv, uint pWorkerThreadCount, int pTimeout) | ||
202 | { | ||
203 | m_server = pSrv; | ||
204 | m_WorkerThreadCount = pWorkerThreadCount; | ||
205 | m_workerThreads = new Thread[m_WorkerThreadCount]; | ||
206 | |||
207 | //startup worker threads | ||
208 | for (uint i = 0; i < m_WorkerThreadCount; i++) | ||
209 | { | ||
210 | m_workerThreads[i] | ||
211 | = Watchdog.StartThread( | ||
212 | PoolWorkerJob, | ||
213 | String.Format("PollServiceWorkerThread{0}", i), | ||
214 | ThreadPriority.Normal, | ||
215 | false, | ||
216 | false, | ||
217 | null, | ||
218 | int.MaxValue); | ||
219 | } | ||
220 | |||
221 | m_retrysThread = Watchdog.StartThread( | ||
222 | this.CheckRetries, | ||
223 | "PollServiceWatcherThread", | ||
224 | ThreadPriority.Normal, | ||
225 | false, | ||
226 | true, | ||
227 | null, | ||
228 | 1000 * 60 * 10); | ||
229 | } | ||
230 | |||
231 | |||
232 | private void ReQueueEvent(PollServiceHttpRequest req) | ||
233 | { | ||
234 | if (m_running) | ||
235 | { | ||
236 | lock (m_retryRequests) | ||
237 | m_retryRequests.Enqueue(req); | ||
238 | } | ||
239 | } | ||
240 | |||
241 | public void Enqueue(PollServiceHttpRequest req) | ||
242 | { | ||
243 | if (m_running) | ||
244 | { | ||
245 | if (req.PollServiceArgs.Type != PollServiceEventArgs.EventType.Normal) | ||
246 | { | ||
247 | m_requests.Enqueue(req); | ||
248 | } | ||
249 | else | ||
250 | { | ||
251 | lock (m_slowRequests) | ||
252 | m_slowRequests.Enqueue(req); | ||
253 | } | ||
254 | } | ||
255 | } | ||
256 | |||
257 | private void CheckRetries() | ||
258 | { | ||
259 | while (m_running) | ||
260 | { | ||
261 | Thread.Sleep(100); // let the world move .. back to faster rate | ||
262 | Watchdog.UpdateThread(); | ||
263 | lock (m_retryRequests) | ||
264 | { | ||
265 | while (m_retryRequests.Count > 0 && m_running) | ||
266 | m_requests.Enqueue(m_retryRequests.Dequeue()); | ||
267 | } | ||
268 | slowCount++; | ||
269 | if (slowCount >= 10) | ||
270 | { | ||
271 | slowCount = 0; | ||
272 | |||
273 | lock (m_slowRequests) | ||
274 | { | ||
275 | while (m_slowRequests.Count > 0 && m_running) | ||
276 | m_requests.Enqueue(m_slowRequests.Dequeue()); | ||
277 | } | ||
278 | } | ||
279 | } | ||
280 | } | ||
281 | |||
282 | ~PollServiceRequestManager() | ||
283 | { | ||
284 | m_running = false; | ||
285 | // m_timeout = -10000; // cause all to expire | ||
286 | Thread.Sleep(1000); // let the world move | ||
287 | |||
288 | foreach (Thread t in m_workerThreads) | ||
289 | Watchdog.AbortThread(t.ManagedThreadId); | ||
290 | |||
291 | try | ||
292 | { | ||
293 | foreach (PollServiceHttpRequest req in m_retryRequests) | ||
294 | { | ||
295 | DoHTTPGruntWork(m_server,req, | ||
296 | req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id)); | ||
297 | } | ||
298 | } | ||
299 | catch | ||
300 | { | ||
301 | } | ||
302 | |||
303 | PollServiceHttpRequest wreq; | ||
304 | m_retryRequests.Clear(); | ||
305 | |||
306 | lock (m_slowRequests) | ||
307 | { | ||
308 | while (m_slowRequests.Count > 0 && m_running) | ||
309 | m_requests.Enqueue(m_slowRequests.Dequeue()); | ||
310 | } | ||
311 | |||
312 | while (m_requests.Count() > 0) | ||
313 | { | ||
314 | try | ||
315 | { | ||
316 | wreq = m_requests.Dequeue(0); | ||
317 | DoHTTPGruntWork(m_server,wreq, | ||
318 | wreq.PollServiceArgs.NoEvents(wreq.RequestID, wreq.PollServiceArgs.Id)); | ||
319 | } | ||
320 | catch | ||
321 | { | ||
322 | } | ||
323 | } | ||
324 | |||
325 | m_requests.Clear(); | ||
326 | } | ||
327 | |||
328 | // work threads | ||
329 | |||
330 | private void PoolWorkerJob() | ||
331 | { | ||
332 | while (m_running) | ||
333 | { | ||
334 | PollServiceHttpRequest req = m_requests.Dequeue(5000); | ||
335 | |||
336 | Watchdog.UpdateThread(); | ||
337 | if (req != null) | ||
338 | { | ||
339 | try | ||
340 | { | ||
341 | if (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id)) | ||
342 | { | ||
343 | Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id); | ||
344 | |||
345 | if (responsedata == null) | ||
346 | continue; | ||
347 | |||
348 | if (req.PollServiceArgs.Type == PollServiceEventArgs.EventType.Normal) | ||
349 | { | ||
350 | try | ||
351 | { | ||
352 | DoHTTPGruntWork(m_server, req, responsedata); | ||
353 | } | ||
354 | catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream | ||
355 | { | ||
356 | // Ignore it, no need to reply | ||
357 | } | ||
358 | } | ||
359 | else | ||
360 | { | ||
361 | m_threadPool.QueueWorkItem(x => | ||
362 | { | ||
363 | try | ||
364 | { | ||
365 | DoHTTPGruntWork(m_server, req, responsedata); | ||
366 | } | ||
367 | catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream | ||
368 | { | ||
369 | // Ignore it, no need to reply | ||
370 | } | ||
371 | |||
372 | return null; | ||
373 | }, null); | ||
374 | } | ||
375 | } | ||
376 | else | ||
377 | { | ||
378 | if ((Environment.TickCount - req.RequestTime) > req.PollServiceArgs.TimeOutms) | ||
379 | { | ||
380 | DoHTTPGruntWork(m_server, req, | ||
381 | req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id)); | ||
382 | } | ||
383 | else | ||
384 | { | ||
385 | ReQueueEvent(req); | ||
386 | } | ||
387 | } | ||
388 | } | ||
389 | catch (Exception e) | ||
390 | { | ||
391 | m_log.ErrorFormat("Exception in poll service thread: " + e.ToString()); | ||
392 | } | ||
393 | } | ||
394 | } | ||
395 | } | ||
396 | |||
397 | // DoHTTPGruntWork changed, not sending response | ||
398 | // do the same work around as core | ||
399 | |||
400 | internal static void DoHTTPGruntWork(BaseHttpServer server, PollServiceHttpRequest req, Hashtable responsedata) | ||
401 | { | ||
402 | OSHttpResponse response | ||
403 | = new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext); | ||
404 | |||
405 | byte[] buffer = server.DoHTTPGruntWork(responsedata, response); | ||
406 | |||
407 | response.SendChunked = false; | ||
408 | response.ContentLength64 = buffer.Length; | ||
409 | response.ContentEncoding = Encoding.UTF8; | ||
410 | |||
411 | try | ||
412 | { | ||
413 | response.OutputStream.Write(buffer, 0, buffer.Length); | ||
414 | } | ||
415 | catch (Exception ex) | ||
416 | { | ||
417 | m_log.Warn(string.Format("[POLL SERVICE WORKER THREAD]: Error ", ex)); | ||
418 | } | ||
419 | finally | ||
420 | { | ||
421 | //response.OutputStream.Close(); | ||
422 | try | ||
423 | { | ||
424 | response.OutputStream.Flush(); | ||
425 | response.Send(); | ||
426 | |||
427 | //if (!response.KeepAlive && response.ReuseContext) | ||
428 | // response.FreeContext(); | ||
429 | } | ||
430 | catch (Exception e) | ||
431 | { | ||
432 | m_log.Warn(String.Format("[POLL SERVICE WORKER THREAD]: Error ", e)); | ||
433 | } | ||
434 | } | ||
435 | } | ||
436 | } | ||
437 | } | ||
438 | |||
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs index 5adbcd1..1c529b6 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs | |||
@@ -25,6 +25,8 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | /* Ubit work moved to PollServiceRequestManager | ||
29 | |||
28 | using System; | 30 | using System; |
29 | using System.Collections; | 31 | using System.Collections; |
30 | using System.Collections.Generic; | 32 | using System.Collections.Generic; |
@@ -90,8 +92,15 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
90 | continue; | 92 | continue; |
91 | } | 93 | } |
92 | 94 | ||
93 | Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, str.ReadToEnd()); | 95 | try |
94 | DoHTTPGruntWork(m_server, req, responsedata); | 96 | { |
97 | Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, str.ReadToEnd()); | ||
98 | DoHTTPGruntWork(m_server, req, responsedata); | ||
99 | } | ||
100 | catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream | ||
101 | { | ||
102 | // Ignore it, no need to reply | ||
103 | } | ||
95 | } | 104 | } |
96 | else | 105 | else |
97 | { | 106 | { |
@@ -162,4 +171,5 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
162 | } | 171 | } |
163 | } | 172 | } |
164 | } | 173 | } |
165 | } \ No newline at end of file | 174 | } |
175 | */ \ No newline at end of file | ||
diff --git a/OpenSim/Framework/Servers/ServerBase.cs b/OpenSim/Framework/Servers/ServerBase.cs index 2c4a687..b9e3c18 100644 --- a/OpenSim/Framework/Servers/ServerBase.cs +++ b/OpenSim/Framework/Servers/ServerBase.cs | |||
@@ -598,7 +598,7 @@ namespace OpenSim.Framework.Servers | |||
598 | } | 598 | } |
599 | } | 599 | } |
600 | 600 | ||
601 | protected string GetVersionText() | 601 | public string GetVersionText() |
602 | { | 602 | { |
603 | return String.Format("Version: {0} (interface version {1})", m_version, VersionInfo.MajorInterfaceVersion); | 603 | return String.Format("Version: {0} (interface version {1})", m_version, VersionInfo.MajorInterfaceVersion); |
604 | } | 604 | } |
@@ -699,4 +699,4 @@ namespace OpenSim.Framework.Servers | |||
699 | m_console.OutputFormat(format, components); | 699 | m_console.OutputFormat(format, components); |
700 | } | 700 | } |
701 | } | 701 | } |
702 | } \ No newline at end of file | 702 | } |
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 ada4e89..0852b49 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")) |