aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authorUbitUmarov2015-09-01 14:54:35 +0100
committerUbitUmarov2015-09-01 14:54:35 +0100
commit371c9dd2af01a2e7422ec901ee1f80757284a78c (patch)
tree058d2a513cacb12efcce0c0df0ae14ad135dbfe2 /OpenSim/Framework
parentremove lixo (diff)
parentdont change camera on crossings (diff)
downloadopensim-SC_OLD-371c9dd2af01a2e7422ec901ee1f80757284a78c.zip
opensim-SC_OLD-371c9dd2af01a2e7422ec901ee1f80757284a78c.tar.gz
opensim-SC_OLD-371c9dd2af01a2e7422ec901ee1f80757284a78c.tar.bz2
opensim-SC_OLD-371c9dd2af01a2e7422ec901ee1f80757284a78c.tar.xz
bad merge?
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/AnimationSet.cs168
-rw-r--r--OpenSim/Framework/AssetBase.cs13
-rw-r--r--OpenSim/Framework/AvatarAppearance.cs49
-rw-r--r--OpenSim/Framework/AvatarWearable.cs21
-rw-r--r--OpenSim/Framework/BlockingQueue.cs5
-rw-r--r--OpenSim/Framework/ChildAgentDataUpdate.cs202
-rw-r--r--OpenSim/Framework/ColliderData.cs1
-rw-r--r--OpenSim/Framework/Communications/RestClient.cs48
-rw-r--r--OpenSim/Framework/Console/CommandConsole.cs19
-rw-r--r--OpenSim/Framework/CustomTypes.cs43
-rw-r--r--OpenSim/Framework/EstateSettings.cs23
-rw-r--r--OpenSim/Framework/IClientAPI.cs41
-rw-r--r--OpenSim/Framework/ILandChannel.cs2
-rw-r--r--OpenSim/Framework/ILandObject.cs2
-rw-r--r--OpenSim/Framework/IMoneyModule.cs3
-rw-r--r--OpenSim/Framework/LandData.cs34
-rw-r--r--OpenSim/Framework/LandUpdateArgs.cs3
-rw-r--r--OpenSim/Framework/LocklessQueue.cs8
-rw-r--r--OpenSim/Framework/Monitoring/BaseStatsCollector.cs21
-rw-r--r--OpenSim/Framework/Monitoring/ServerStatsCollector.cs43
-rw-r--r--OpenSim/Framework/Monitoring/Stats/Stat.cs13
-rw-r--r--OpenSim/Framework/Monitoring/StatsManager.cs15
-rw-r--r--OpenSim/Framework/Monitoring/Watchdog.cs2
-rw-r--r--OpenSim/Framework/NetworkServersInfo.cs2
-rw-r--r--OpenSim/Framework/OSChatMessage.cs21
-rw-r--r--OpenSim/Framework/ObjectChangeData.cs80
-rw-r--r--OpenSim/Framework/ParcelMediaCommandEnum.cs2
-rw-r--r--OpenSim/Framework/PermissionsUtil.cs4
-rw-r--r--OpenSim/Framework/PluginLoader.cs18
-rw-r--r--OpenSim/Framework/PrimitiveBaseShape.cs38
-rw-r--r--OpenSim/Framework/PriorityQueue.cs37
-rw-r--r--OpenSim/Framework/RegionInfo.cs270
-rw-r--r--OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs110
-rw-r--r--OpenSim/Framework/RegionSettings.cs24
-rw-r--r--OpenSim/Framework/Servers/BaseOpenSimServer.cs29
-rw-r--r--OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs107
-rw-r--r--OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs4
-rw-r--r--OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs60
-rw-r--r--OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs215
-rw-r--r--OpenSim/Framework/Servers/ServerBase.cs4
-rw-r--r--OpenSim/Framework/Servers/Tests/OSHttpTests.cs326
-rw-r--r--OpenSim/Framework/TaskInventoryDictionary.cs189
-rw-r--r--OpenSim/Framework/TaskInventoryItem.cs2
-rw-r--r--OpenSim/Framework/TerrainData.cs320
-rw-r--r--OpenSim/Framework/Tests/MundaneFrameworkTests.cs6
-rw-r--r--OpenSim/Framework/ThrottleOutPacketType.cs2
-rw-r--r--OpenSim/Framework/UserProfileData.cs4
-rw-r--r--OpenSim/Framework/UserProfiles.cs8
-rw-r--r--OpenSim/Framework/Util.cs253
-rw-r--r--OpenSim/Framework/VersionInfo.cs8
-rw-r--r--OpenSim/Framework/WearableCacheItem.cs70
-rw-r--r--OpenSim/Framework/WebUtil.cs151
52 files changed, 2809 insertions, 334 deletions
diff --git a/OpenSim/Framework/AnimationSet.cs b/OpenSim/Framework/AnimationSet.cs
new file mode 100644
index 0000000..6c5b15c
--- /dev/null
+++ b/OpenSim/Framework/AnimationSet.cs
@@ -0,0 +1,168 @@
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
28using System;
29using System.Collections.Generic;
30using OpenMetaverse;
31
32namespace OpenSim.Framework
33{
34 public delegate bool AnimationSetValidator(UUID animID);
35
36 public class AnimationSet
37 {
38 private bool m_parseError = false;
39
40 public const uint createBasePermitions = (uint)(PermissionMask.All); // no export ?
41 public const uint createNextPermitions = (uint)(PermissionMask.Copy | PermissionMask.Modify);
42
43 public const uint allowedBasePermitions = (uint)(PermissionMask.Copy | PermissionMask.Modify);
44 public const uint allowedNextPermitions = 0;
45
46 public static void setCreateItemPermitions(InventoryItemBase it)
47 {
48 if (it == null)
49 return;
50
51 it.BasePermissions = createBasePermitions;
52 it.CurrentPermissions = createBasePermitions;
53 // it.GroupPermissions &= allowedPermitions;
54 it.NextPermissions = createNextPermitions;
55 // it.EveryOnePermissions &= allowedPermitions;
56 it.GroupPermissions = 0;
57 it.EveryOnePermissions = 0;
58 }
59
60 public static void enforceItemPermitions(InventoryItemBase it, bool IsCreator)
61 {
62 if (it == null)
63 return;
64
65 uint bp;
66 uint np;
67
68 if (IsCreator)
69 {
70 bp = createBasePermitions;
71 np = createNextPermitions;
72 }
73 else
74 {
75 bp = allowedBasePermitions;
76 np = allowedNextPermitions;
77 }
78
79 it.BasePermissions &= bp;
80 it.CurrentPermissions &= bp;
81 // it.GroupPermissions &= allowedPermitions;
82 it.NextPermissions &= np;
83 // it.EveryOnePermissions &= allowedPermitions;
84 it.GroupPermissions = 0;
85 it.EveryOnePermissions = 0;
86 }
87
88 public int AnimationCount { get; private set; }
89 private Dictionary<string, KeyValuePair<string, UUID>> m_animations = new Dictionary<string, KeyValuePair<string, UUID>>();
90
91 public UUID GetAnimation(string index)
92 {
93 KeyValuePair<string, UUID> val;
94 if (m_animations.TryGetValue(index, out val))
95 return val.Value;
96
97 return UUID.Zero;
98 }
99
100 public string GetAnimationName(string index)
101 {
102 KeyValuePair<string, UUID> val;
103 if (m_animations.TryGetValue(index, out val))
104 return val.Key;
105
106 return String.Empty;
107 }
108
109 public void SetAnimation(string index, string name, UUID anim)
110 {
111 if (anim == UUID.Zero)
112 {
113 m_animations.Remove(index);
114 return;
115 }
116
117 m_animations[index] = new KeyValuePair<string, UUID>(name, anim);
118 }
119
120 public AnimationSet(Byte[] data)
121 {
122 string assetData = System.Text.Encoding.ASCII.GetString(data);
123 Console.WriteLine("--------------------");
124 Console.WriteLine("AnimationSet length {0} bytes", assetData.Length);
125 Console.WriteLine(assetData);
126 Console.WriteLine("--------------------");
127 }
128
129 public Byte[] ToBytes()
130 {
131 // If there was an error parsing the input, we give back an
132 // empty set rather than the original data.
133 if (m_parseError)
134 {
135 string dummy = "version 1\ncount 0\n";
136 return System.Text.Encoding.ASCII.GetBytes(dummy);
137 }
138
139 string assetData = String.Format("version 1\ncount {0}\n", m_animations.Count);
140 foreach (KeyValuePair<string, KeyValuePair<string, UUID>> kvp in m_animations)
141 assetData += String.Format("{0} {1} {2}\n", kvp.Key, kvp.Value.Value.ToString(), kvp.Value.Key);
142 return System.Text.Encoding.ASCII.GetBytes(assetData);
143 }
144
145 public bool Validate(AnimationSetValidator val)
146 {
147 if (m_parseError)
148 return false;
149
150 List<string> badAnims = new List<string>();
151
152 bool allOk = true;
153 foreach (KeyValuePair<string, KeyValuePair<string, UUID>> kvp in m_animations)
154 {
155 if (!val(kvp.Value.Value))
156 {
157 allOk = false;
158 badAnims.Add(kvp.Key);
159 }
160 }
161
162 foreach (string idx in badAnims)
163 m_animations.Remove(idx);
164
165 return allOk;
166 }
167 }
168}
diff --git a/OpenSim/Framework/AssetBase.cs b/OpenSim/Framework/AssetBase.cs
index 2f04d2e..3937d9c 100644
--- a/OpenSim/Framework/AssetBase.cs
+++ b/OpenSim/Framework/AssetBase.cs
@@ -63,6 +63,8 @@ namespace OpenSim.Framework
63 /// </summary> 63 /// </summary>
64 private AssetMetadata m_metadata; 64 private AssetMetadata m_metadata;
65 65
66 private int m_uploadAttempts;
67
66 // This is needed for .NET serialization!!! 68 // This is needed for .NET serialization!!!
67 // Do NOT "Optimize" away! 69 // Do NOT "Optimize" away!
68 public AssetBase() 70 public AssetBase()
@@ -148,7 +150,12 @@ namespace OpenSim.Framework
148 Type == (sbyte)AssetType.Folder || 150 Type == (sbyte)AssetType.Folder ||
149 Type == (sbyte)AssetType.ImageJPEG || 151 Type == (sbyte)AssetType.ImageJPEG ||
150 Type == (sbyte)AssetType.ImageTGA || 152 Type == (sbyte)AssetType.ImageTGA ||
153<<<<<<< HEAD
151 Type == (sbyte)AssetType.LSLBytecode); 154 Type == (sbyte)AssetType.LSLBytecode);
155=======
156 Type == (sbyte)AssetType.Mesh ||
157 Type == (sbyte) AssetType.LSLBytecode);
158>>>>>>> avn/ubitvar
152 } 159 }
153 } 160 }
154 161
@@ -197,6 +204,12 @@ namespace OpenSim.Framework
197 set { m_metadata.Type = value; } 204 set { m_metadata.Type = value; }
198 } 205 }
199 206
207 public int UploadAttempts
208 {
209 get { return m_uploadAttempts; }
210 set { m_uploadAttempts = value; }
211 }
212
200 /// <summary> 213 /// <summary>
201 /// Is this a region only asset, or does this exist on the asset server also 214 /// Is this a region only asset, or does this exist on the asset server also
202 /// </summary> 215 /// </summary>
diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs
index 69113b1..72c6bfc 100644
--- a/OpenSim/Framework/AvatarAppearance.cs
+++ b/OpenSim/Framework/AvatarAppearance.cs
@@ -53,7 +53,11 @@ namespace OpenSim.Framework
53 // should be only used as initial default value ( V1 viewers ) 53 // should be only used as initial default value ( V1 viewers )
54 public readonly static int VISUALPARAM_COUNT = 218; 54 public readonly static int VISUALPARAM_COUNT = 218;
55 55
56 public readonly static int TEXTURE_COUNT = 21; 56// public readonly static int TEXTURE_COUNT = 21
57 // 21 bad, make it be updated as libovm gets update
58 // also keeping in sync with it
59 public readonly static int TEXTURE_COUNT = Primitive.TextureEntry.MAX_FACES;
60
57 public readonly static byte[] BAKE_INDICES = new byte[] { 8, 9, 10, 11, 19, 20 }; 61 public readonly static byte[] BAKE_INDICES = new byte[] { 8, 9, 10, 11, 19, 20 };
58 62
59 protected int m_serial = 0; 63 protected int m_serial = 0;
@@ -179,11 +183,16 @@ namespace OpenSim.Framework
179 m_attachments = new Dictionary<int, List<AvatarAttachment>>(); 183 m_attachments = new Dictionary<int, List<AvatarAttachment>>();
180 } 184 }
181 185
182 public AvatarAppearance(AvatarAppearance appearance) : this(appearance, true) 186 public AvatarAppearance(AvatarAppearance appearance): this(appearance, true,true)
183 { 187 {
184 } 188 }
185 189
186 public AvatarAppearance(AvatarAppearance appearance, bool copyWearables) 190 public AvatarAppearance(AvatarAppearance appearance, bool copyWearables)
191 : this(appearance, copyWearables, true)
192 {
193 }
194
195 public AvatarAppearance(AvatarAppearance appearance, bool copyWearables, bool copyBaked)
187 { 196 {
188// m_log.WarnFormat("[AVATAR APPEARANCE] create from an existing appearance"); 197// m_log.WarnFormat("[AVATAR APPEARANCE] create from an existing appearance");
189 198
@@ -217,6 +226,10 @@ namespace OpenSim.Framework
217 { 226 {
218 byte[] tbytes = appearance.Texture.GetBytes(); 227 byte[] tbytes = appearance.Texture.GetBytes();
219 m_texture = new Primitive.TextureEntry(tbytes,0,tbytes.Length); 228 m_texture = new Primitive.TextureEntry(tbytes,0,tbytes.Length);
229 if (copyBaked && appearance.m_cacheitems != null)
230 m_cacheitems = (WearableCacheItem[])appearance.m_cacheitems.Clone();
231 else
232 m_cacheitems = null;
220 } 233 }
221 234
222 m_visualparams = null; 235 m_visualparams = null;
@@ -458,7 +471,10 @@ namespace OpenSim.Framework
458// m_log.WarnFormat("[AVATARAPPEARANCE] set wearable {0} --> {1}:{2}",wearableId,wearable.ItemID,wearable.AssetID); 471// m_log.WarnFormat("[AVATARAPPEARANCE] set wearable {0} --> {1}:{2}",wearableId,wearable.ItemID,wearable.AssetID);
459// DEBUG OFF 472// DEBUG OFF
460 m_wearables[wearableId].Clear(); 473 m_wearables[wearableId].Clear();
461 for (int i = 0; i < wearable.Count; i++) 474 int count = wearable.Count;
475 if (count > AvatarWearable.MAX_WEARABLES)
476 count = AvatarWearable.MAX_WEARABLES;
477 for (int i = 0; i < count; i++)
462 m_wearables[wearableId].Add(wearable[i].ItemID, wearable[i].AssetID); 478 m_wearables[wearableId].Add(wearable[i].ItemID, wearable[i].AssetID);
463 } 479 }
464 480
@@ -722,6 +738,13 @@ namespace OpenSim.Framework
722 } 738 }
723 data["textures"] = textures; 739 data["textures"] = textures;
724 740
741 if (m_cacheitems != null)
742 {
743 OSDArray baked = WearableCacheItem.BakedToOSD(m_cacheitems);
744 if (baked != null)
745 data["bakedcache"] = baked;
746 }
747
725 // Visual Parameters 748 // Visual Parameters
726 OSDBinary visualparams = new OSDBinary(m_visualparams); 749 OSDBinary visualparams = new OSDBinary(m_visualparams);
727 data["visualparams"] = visualparams; 750 data["visualparams"] = visualparams;
@@ -757,7 +780,12 @@ namespace OpenSim.Framework
757 if ((data != null) && (data["wearables"] != null) && (data["wearables"]).Type == OSDType.Array) 780 if ((data != null) && (data["wearables"] != null) && (data["wearables"]).Type == OSDType.Array)
758 { 781 {
759 OSDArray wears = (OSDArray)(data["wearables"]); 782 OSDArray wears = (OSDArray)(data["wearables"]);
760 for (int i = 0; i < wears.Count; i++) 783
784 int count = wears.Count;
785 if (count > AvatarWearable.MAX_WEARABLES)
786 count = AvatarWearable.MAX_WEARABLES;
787
788 for (int i = 0; i < count; i++)
761 m_wearables[i] = new AvatarWearable((OSDArray)wears[i]); 789 m_wearables[i] = new AvatarWearable((OSDArray)wears[i]);
762 } 790 }
763 else 791 else
@@ -783,6 +811,12 @@ namespace OpenSim.Framework
783 m_log.Warn("[AVATAR APPEARANCE]: failed to unpack textures"); 811 m_log.Warn("[AVATAR APPEARANCE]: failed to unpack textures");
784 } 812 }
785 813
814 if ((data != null) && (data["bakedcache"] != null) && (data["bakedcache"]).Type == OSDType.Array)
815 {
816 OSDArray bakedOSDArray = (OSDArray)(data["bakedcache"]);
817 m_cacheitems = WearableCacheItem.BakedFromOSD(bakedOSDArray);
818 }
819
786 // Visual Parameters 820 // Visual Parameters
787 SetDefaultParams(); 821 SetDefaultParams();
788 if ((data != null) && (data["visualparams"] != null)) 822 if ((data != null) && (data["visualparams"] != null))
@@ -1632,7 +1666,12 @@ namespace OpenSim.Framework
1632 BREAST_PHYSICS_LEFTRIGHT_MAX_EFFECT = 247, 1666 BREAST_PHYSICS_LEFTRIGHT_MAX_EFFECT = 247,
1633 BREAST_PHYSICS_LEFTRIGHT_SPRING= 248, 1667 BREAST_PHYSICS_LEFTRIGHT_SPRING= 248,
1634 BREAST_PHYSICS_LEFTRIGHT_GAIN = 249, 1668 BREAST_PHYSICS_LEFTRIGHT_GAIN = 249,
1635 BREAST_PHYSICS_LEFTRIGHT_DAMPING = 250 1669 BREAST_PHYSICS_LEFTRIGHT_DAMPING = 250,
1670
1671 // Ubit: 07/96/2013 new parameters
1672 _APPEARANCEMESSAGE_VERSION = 251, //ID 11000
1673
1674 SHAPE_HOVER = 252, //ID 11001
1636 } 1675 }
1637 #endregion 1676 #endregion
1638 } 1677 }
diff --git a/OpenSim/Framework/AvatarWearable.cs b/OpenSim/Framework/AvatarWearable.cs
index 8e27596..0ba4e65 100644
--- a/OpenSim/Framework/AvatarWearable.cs
+++ b/OpenSim/Framework/AvatarWearable.cs
@@ -62,10 +62,16 @@ 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;
67 70
68 public static readonly int MAX_WEARABLES = 15; 71// public static readonly int MAX_WEARABLES = 15;
72 public static readonly int PHYSICS = 15;
73 public static int MAX_WEARABLES = 16;
74
69 75
70 public static readonly UUID DEFAULT_BODY_ITEM = new UUID("66c41e39-38f9-f75a-024e-585989bfaba9"); 76 public static readonly UUID DEFAULT_BODY_ITEM = new UUID("66c41e39-38f9-f75a-024e-585989bfaba9");
71 public static readonly UUID DEFAULT_BODY_ASSET = new UUID("66c41e39-38f9-f75a-024e-585989bfab73"); 77 public static readonly UUID DEFAULT_BODY_ASSET = new UUID("66c41e39-38f9-f75a-024e-585989bfab73");
@@ -219,7 +225,7 @@ namespace OpenSim.Framework
219 { 225 {
220 get 226 get
221 { 227 {
222 AvatarWearable[] defaultWearables = new AvatarWearable[MAX_WEARABLES]; //should be 15 of these 228 AvatarWearable[] defaultWearables = new AvatarWearable[MAX_WEARABLES];
223 for (int i = 0; i < MAX_WEARABLES; i++) 229 for (int i = 0; i < MAX_WEARABLES; i++)
224 { 230 {
225 defaultWearables[i] = new AvatarWearable(); 231 defaultWearables[i] = new AvatarWearable();
@@ -242,10 +248,13 @@ namespace OpenSim.Framework
242 248
243// // Alpha 249// // Alpha
244// defaultWearables[ALPHA].Add(DEFAULT_ALPHA_ITEM, DEFAULT_ALPHA_ASSET); 250// defaultWearables[ALPHA].Add(DEFAULT_ALPHA_ITEM, DEFAULT_ALPHA_ASSET);
245 251
246// // Tattoo 252 // // Tattoo
247// defaultWearables[TATTOO].Add(DEFAULT_TATTOO_ITEM, DEFAULT_TATTOO_ASSET); 253 // defaultWearables[TATTOO].Add(DEFAULT_TATTOO_ITEM, DEFAULT_TATTOO_ASSET);
248 254
255 // // Physics
256 // defaultWearables[PHYSICS].Add(DEFAULT_TATTOO_ITEM, DEFAULT_TATTOO_ASSET);
257
249 return defaultWearables; 258 return defaultWearables;
250 } 259 }
251 } 260 }
diff --git a/OpenSim/Framework/BlockingQueue.cs b/OpenSim/Framework/BlockingQueue.cs
index d11ad11..daf99a8 100644
--- a/OpenSim/Framework/BlockingQueue.cs
+++ b/OpenSim/Framework/BlockingQueue.cs
@@ -76,10 +76,9 @@ namespace OpenSim.Framework
76 { 76 {
77 lock (m_queueSync) 77 lock (m_queueSync)
78 { 78 {
79 bool success = true; 79 if (m_queue.Count < 1 && m_pqueue.Count < 1)
80 while (m_queue.Count < 1 && m_pqueue.Count < 1 && success)
81 { 80 {
82 success = Monitor.Wait(m_queueSync, msTimeout); 81 Monitor.Wait(m_queueSync, msTimeout);
83 } 82 }
84 83
85 if (m_pqueue.Count > 0) 84 if (m_pqueue.Count > 0)
diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs
index 2a8e67d..a714d86 100644
--- a/OpenSim/Framework/ChildAgentDataUpdate.cs
+++ b/OpenSim/Framework/ChildAgentDataUpdate.cs
@@ -94,6 +94,7 @@ namespace OpenSim.Framework
94 // This probably shouldn't be here 94 // This probably shouldn't be here
95 public byte[] Throttles; 95 public byte[] Throttles;
96 96
97 public Dictionary<ulong, string> ChildrenCapSeeds = null;
97 98
98 public OSDMap Pack() 99 public OSDMap Pack()
99 { 100 {
@@ -119,6 +120,19 @@ namespace OpenSim.Framework
119 if ((Throttles != null) && (Throttles.Length > 0)) 120 if ((Throttles != null) && (Throttles.Length > 0))
120 args["throttles"] = OSD.FromBinary(Throttles); 121 args["throttles"] = OSD.FromBinary(Throttles);
121 122
123 if (ChildrenCapSeeds != null && ChildrenCapSeeds.Count > 0)
124 {
125 OSDArray childrenSeeds = new OSDArray(ChildrenCapSeeds.Count);
126 foreach (KeyValuePair<ulong, string> kvp in ChildrenCapSeeds)
127 {
128 OSDMap pair = new OSDMap();
129 pair["handle"] = OSD.FromString(kvp.Key.ToString());
130 pair["seed"] = OSD.FromString(kvp.Value);
131 childrenSeeds.Add(pair);
132 }
133 args["children_seeds"] = childrenSeeds;
134 }
135
122 return args; 136 return args;
123 } 137 }
124 138
@@ -165,6 +179,30 @@ namespace OpenSim.Framework
165 179
166 if (args["throttles"] != null) 180 if (args["throttles"] != null)
167 Throttles = args["throttles"].AsBinary(); 181 Throttles = args["throttles"].AsBinary();
182
183 if (args.ContainsKey("children_seeds") && (args["children_seeds"] != null) &&
184 (args["children_seeds"].Type == OSDType.Array))
185 {
186 OSDArray childrenSeeds = (OSDArray)(args["children_seeds"]);
187 ChildrenCapSeeds = new Dictionary<ulong, string>();
188 foreach (OSD o in childrenSeeds)
189 {
190 if (o.Type == OSDType.Map)
191 {
192 ulong handle = 0;
193 string seed = "";
194 OSDMap pair = (OSDMap)o;
195 if (pair["handle"] != null)
196 if (!UInt64.TryParse(pair["handle"].AsString(), out handle))
197 continue;
198 if (pair["seed"] != null)
199 seed = pair["seed"].AsString();
200 if (!ChildrenCapSeeds.ContainsKey(handle))
201 ChildrenCapSeeds.Add(handle, seed);
202 }
203 }
204 }
205
168 } 206 }
169 207
170 /// <summary> 208 /// <summary>
@@ -317,9 +355,11 @@ namespace OpenSim.Framework
317 public UUID ActiveGroupID; 355 public UUID ActiveGroupID;
318 356
319 public AgentGroupData[] Groups; 357 public AgentGroupData[] Groups;
358 public Dictionary<ulong, string> ChildrenCapSeeds = null;
320 public Animation[] Anims; 359 public Animation[] Anims;
321 public Animation DefaultAnim = null; 360 public Animation DefaultAnim = null;
322 public Animation AnimState = null; 361 public Animation AnimState = null;
362 public Byte MotionState = 0;
323 363
324 public UUID GranterID; 364 public UUID GranterID;
325 public UUID ParentPart; 365 public UUID ParentPart;
@@ -349,6 +389,8 @@ namespace OpenSim.Framework
349 public List<ISceneObject> AttachmentObjects; 389 public List<ISceneObject> AttachmentObjects;
350 public List<string> AttachmentObjectStates; 390 public List<string> AttachmentObjectStates;
351 391
392 public Dictionary<string, UUID> MovementAnimationOverRides = new Dictionary<string, UUID>();
393
352 public virtual OSDMap Pack() 394 public virtual OSDMap Pack()
353 { 395 {
354// m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Pack data"); 396// m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Pack data");
@@ -399,6 +441,19 @@ namespace OpenSim.Framework
399 args["groups"] = groups; 441 args["groups"] = groups;
400 } 442 }
401 443
444 if (ChildrenCapSeeds != null && ChildrenCapSeeds.Count > 0)
445 {
446 OSDArray childrenSeeds = new OSDArray(ChildrenCapSeeds.Count);
447 foreach (KeyValuePair<ulong, string> kvp in ChildrenCapSeeds)
448 {
449 OSDMap pair = new OSDMap();
450 pair["handle"] = OSD.FromString(kvp.Key.ToString());
451 pair["seed"] = OSD.FromString(kvp.Value);
452 childrenSeeds.Add(pair);
453 }
454 args["children_seeds"] = childrenSeeds;
455 }
456
402 if ((Anims != null) && (Anims.Length > 0)) 457 if ((Anims != null) && (Anims.Length > 0))
403 { 458 {
404 OSDArray anims = new OSDArray(Anims.Length); 459 OSDArray anims = new OSDArray(Anims.Length);
@@ -417,6 +472,26 @@ namespace OpenSim.Framework
417 args["animation_state"] = AnimState.PackUpdateMessage(); 472 args["animation_state"] = AnimState.PackUpdateMessage();
418 } 473 }
419 474
475 if (MovementAnimationOverRides.Count > 0)
476 {
477 OSDArray AOs = new OSDArray(MovementAnimationOverRides.Count);
478 {
479 foreach (KeyValuePair<string, UUID> kvp in MovementAnimationOverRides)
480 {
481 OSDMap ao = new OSDMap(2);
482 ao["state"] = OSD.FromString(kvp.Key);
483 ao["uuid"] = OSD.FromUUID(kvp.Value);
484 AOs.Add(ao);
485 }
486 }
487 args["movementAO"] = AOs;
488 }
489
490 if (MotionState != 0)
491 {
492 args["motion_state"] = OSD.FromInteger(MotionState);
493 }
494
420 if (Appearance != null) 495 if (Appearance != null)
421 args["packed_appearance"] = Appearance.Pack(); 496 args["packed_appearance"] = Appearance.Pack();
422 497
@@ -431,6 +506,8 @@ namespace OpenSim.Framework
431 // The code to pack textures, visuals, wearables and attachments 506 // The code to pack textures, visuals, wearables and attachments
432 // should be removed; packed appearance contains the full appearance 507 // should be removed; packed appearance contains the full appearance
433 // This is retained for backward compatibility only 508 // This is retained for backward compatibility only
509
510/* then lets remove
434 if (Appearance.Texture != null) 511 if (Appearance.Texture != null)
435 { 512 {
436 byte[] rawtextures = Appearance.Texture.GetBytes(); 513 byte[] rawtextures = Appearance.Texture.GetBytes();
@@ -459,7 +536,7 @@ namespace OpenSim.Framework
459 args["attachments"] = attachs; 536 args["attachments"] = attachs;
460 } 537 }
461 // End of code to remove 538 // End of code to remove
462 539*/
463 if ((Controllers != null) && (Controllers.Length > 0)) 540 if ((Controllers != null) && (Controllers.Length > 0))
464 { 541 {
465 OSDArray controls = new OSDArray(Controllers.Length); 542 OSDArray controls = new OSDArray(Controllers.Length);
@@ -600,6 +677,29 @@ namespace OpenSim.Framework
600 } 677 }
601 } 678 }
602 679
680 if (args.ContainsKey("children_seeds") && (args["children_seeds"] != null) &&
681 (args["children_seeds"].Type == OSDType.Array))
682 {
683 OSDArray childrenSeeds = (OSDArray)(args["children_seeds"]);
684 ChildrenCapSeeds = new Dictionary<ulong, string>();
685 foreach (OSD o in childrenSeeds)
686 {
687 if (o.Type == OSDType.Map)
688 {
689 ulong handle = 0;
690 string seed = "";
691 OSDMap pair = (OSDMap)o;
692 if (pair["handle"] != null)
693 if (!UInt64.TryParse(pair["handle"].AsString(), out handle))
694 continue;
695 if (pair["seed"] != null)
696 seed = pair["seed"].AsString();
697 if (!ChildrenCapSeeds.ContainsKey(handle))
698 ChildrenCapSeeds.Add(handle, seed);
699 }
700 }
701 }
702
603 if ((args["animations"] != null) && (args["animations"]).Type == OSDType.Array) 703 if ((args["animations"] != null) && (args["animations"]).Type == OSDType.Array)
604 { 704 {
605 OSDArray anims = (OSDArray)(args["animations"]); 705 OSDArray anims = (OSDArray)(args["animations"]);
@@ -638,6 +738,28 @@ namespace OpenSim.Framework
638 } 738 }
639 } 739 }
640 740
741 MovementAnimationOverRides.Clear();
742
743 if (args["movementAO"] != null && args["movementAO"].Type == OSDType.Array)
744 {
745 OSDArray AOs = (OSDArray)(args["movementAO"]);
746 int count = AOs.Count;
747
748 for (int i = 0; i < count; i++)
749 {
750 OSDMap ao = (OSDMap)AOs[i];
751 if (ao["state"] != null && ao["uuid"] != null)
752 {
753 string state = ao["state"].AsString();
754 UUID id = ao["uuid"].AsUUID();
755 MovementAnimationOverRides[state] = id;
756 }
757 }
758 }
759
760 if (args.ContainsKey("motion_state"))
761 MotionState = (byte)args["motion_state"].AsInteger();
762
641 //if ((args["agent_textures"] != null) && (args["agent_textures"]).Type == OSDType.Array) 763 //if ((args["agent_textures"] != null) && (args["agent_textures"]).Type == OSDType.Array)
642 //{ 764 //{
643 // OSDArray textures = (OSDArray)(args["agent_textures"]); 765 // OSDArray textures = (OSDArray)(args["agent_textures"]);
@@ -647,53 +769,71 @@ namespace OpenSim.Framework
647 // AgentTextures[i++] = o.AsUUID(); 769 // AgentTextures[i++] = o.AsUUID();
648 //} 770 //}
649 771
650 Appearance = new AvatarAppearance();
651 772
652 // The code to unpack textures, visuals, wearables and attachments 773 // packed_appearence should contain all appearance information
653 // should be removed; packed appearance contains the full appearance 774 if (args.ContainsKey("packed_appearance") && (args["packed_appearance"]).Type == OSDType.Map)
654 // This is retained for backward compatibility only
655 if (args["texture_entry"] != null)
656 { 775 {
657 byte[] rawtextures = args["texture_entry"].AsBinary(); 776 m_log.WarnFormat("[CHILDAGENTDATAUPDATE] got packed appearance");
658 Primitive.TextureEntry textures = new Primitive.TextureEntry(rawtextures,0,rawtextures.Length); 777 Appearance = new AvatarAppearance((OSDMap)args["packed_appearance"]);
659 Appearance.SetTextureEntries(textures);
660 } 778 }
779 else
780 {
781 // if missing try the old pack method
782 m_log.WarnFormat("[CHILDAGENTDATAUPDATE] No packed appearance, checking old method");
661 783
662 if (args["visual_params"] != null) 784 Appearance = new AvatarAppearance();
663 Appearance.SetVisualParams(args["visual_params"].AsBinary());
664 785
665 if ((args["wearables"] != null) && (args["wearables"]).Type == OSDType.Array) 786 // The code to unpack textures, visuals, wearables and attachments
666 { 787 // should be removed; packed appearance contains the full appearance
667 OSDArray wears = (OSDArray)(args["wearables"]); 788 // This is retained for backward compatibility only
668 for (int i = 0; i < wears.Count / 2; i++) 789 if (args["texture_entry"] != null)
669 { 790 {
670 AvatarWearable awear = new AvatarWearable((OSDArray)wears[i]); 791 byte[] rawtextures = args["texture_entry"].AsBinary();
671 Appearance.SetWearable(i,awear); 792 Primitive.TextureEntry textures = new Primitive.TextureEntry(rawtextures, 0, rawtextures.Length);
793 Appearance.SetTextureEntries(textures);
672 } 794 }
673 }
674 795
675 if ((args["attachments"] != null) && (args["attachments"]).Type == OSDType.Array) 796 if (args["visual_params"] != null)
676 { 797 Appearance.SetVisualParams(args["visual_params"].AsBinary());
677 OSDArray attachs = (OSDArray)(args["attachments"]); 798
678 foreach (OSD o in attachs) 799 if ((args["wearables"] != null) && (args["wearables"]).Type == OSDType.Array)
679 { 800 {
680 if (o.Type == OSDType.Map) 801 OSDArray wears = (OSDArray)(args["wearables"]);
802
803 int count = wears.Count;
804 if (count > AvatarWearable.MAX_WEARABLES)
805 count = AvatarWearable.MAX_WEARABLES;
806
807 for (int i = 0; i < count / 2; i++)
681 { 808 {
682 // We know all of these must end up as attachments so we 809 AvatarWearable awear = new AvatarWearable((OSDArray)wears[i]);
683 // append rather than replace to ensure multiple attachments 810 Appearance.SetWearable(i, awear);
684 // per point continues to work
685// m_log.DebugFormat("[CHILDAGENTDATAUPDATE]: Appending attachments for {0}", AgentID);
686 Appearance.AppendAttachment(new AvatarAttachment((OSDMap)o));
687 } 811 }
688 } 812 }
689 }
690 // end of code to remove
691 813
814 if ((args["attachments"] != null) && (args["attachments"]).Type == OSDType.Array)
815 {
816 OSDArray attachs = (OSDArray)(args["attachments"]);
817 foreach (OSD o in attachs)
818 {
819 if (o.Type == OSDType.Map)
820 {
821 // We know all of these must end up as attachments so we
822 // append rather than replace to ensure multiple attachments
823 // per point continues to work
824 // m_log.DebugFormat("[CHILDAGENTDATAUPDATE]: Appending attachments for {0}", AgentID);
825 Appearance.AppendAttachment(new AvatarAttachment((OSDMap)o));
826 }
827 }
828 }
829 // end of code to remove
830 }
831/* moved above
692 if (args.ContainsKey("packed_appearance") && (args["packed_appearance"]).Type == OSDType.Map) 832 if (args.ContainsKey("packed_appearance") && (args["packed_appearance"]).Type == OSDType.Map)
693 Appearance = new AvatarAppearance((OSDMap)args["packed_appearance"]); 833 Appearance = new AvatarAppearance((OSDMap)args["packed_appearance"]);
694 else 834 else
695 m_log.WarnFormat("[CHILDAGENTDATAUPDATE] No packed appearance"); 835 m_log.WarnFormat("[CHILDAGENTDATAUPDATE] No packed appearance");
696 836*/
697 if ((args["controllers"] != null) && (args["controllers"]).Type == OSDType.Array) 837 if ((args["controllers"] != null) && (args["controllers"]).Type == OSDType.Array)
698 { 838 {
699 OSDArray controls = (OSDArray)(args["controllers"]); 839 OSDArray controls = (OSDArray)(args["controllers"]);
diff --git a/OpenSim/Framework/ColliderData.cs b/OpenSim/Framework/ColliderData.cs
index 1b7b682..00013e1 100644
--- a/OpenSim/Framework/ColliderData.cs
+++ b/OpenSim/Framework/ColliderData.cs
@@ -42,6 +42,7 @@ namespace OpenSim.Framework
42 public Vector3 velVector = Vector3.Zero; 42 public Vector3 velVector = Vector3.Zero;
43 public string nameStr = String.Empty; 43 public string nameStr = String.Empty;
44 public int colliderType = 0; 44 public int colliderType = 0;
45 public int linkNumber;
45 } 46 }
46 47
47 public class ColliderArgs : EventArgs 48 public class ColliderArgs : EventArgs
diff --git a/OpenSim/Framework/Communications/RestClient.cs b/OpenSim/Framework/Communications/RestClient.cs
index 6f517b6..4403f40 100644
--- a/OpenSim/Framework/Communications/RestClient.cs
+++ b/OpenSim/Framework/Communications/RestClient.cs
@@ -389,9 +389,32 @@ namespace OpenSim.Framework.Communications
389 } 389 }
390 } 390 }
391 391
392 if (_response != null)
393 _response.Close();
394
392 return null; 395 return null;
393 } 396 }
394 397
398<<<<<<< HEAD
399=======
400 using (Stream src = _response.GetResponseStream())
401 {
402 int length = src.Read(_readbuf, 0, BufferSize);
403 while (length > 0)
404 {
405 _resource.Write(_readbuf, 0, length);
406 length = src.Read(_readbuf, 0, BufferSize);
407 }
408 }
409
410 // TODO! Implement timeout, without killing the server
411 // this line implements the timeout, if there is a timeout, the callback fires and the request becomes aborted
412 //ThreadPool.RegisterWaitForSingleObject(responseAsyncResult.AsyncWaitHandle, new WaitOrTimerCallback(TimeoutCallback), _request, DefaultTimeout, true);
413
414// _allDone.WaitOne();
415 if (_response != null)
416 _response.Close();
417>>>>>>> avn/ubitvar
395 if (_asyncException != null) 418 if (_asyncException != null)
396 throw _asyncException; 419 throw _asyncException;
397 420
@@ -413,7 +436,7 @@ namespace OpenSim.Framework.Communications
413 _request = (HttpWebRequest) WebRequest.Create(buildUri()); 436 _request = (HttpWebRequest) WebRequest.Create(buildUri());
414 _request.KeepAlive = false; 437 _request.KeepAlive = false;
415 _request.ContentType = "application/xml"; 438 _request.ContentType = "application/xml";
416 _request.Timeout = 900000; 439 _request.Timeout = 30000;
417 _request.Method = RequestMethod; 440 _request.Method = RequestMethod;
418 _asyncException = null; 441 _asyncException = null;
419 _request.ContentLength = src.Length; 442 _request.ContentLength = src.Length;
@@ -421,6 +444,7 @@ namespace OpenSim.Framework.Communications
421 auth.AddAuthorization(_request.Headers); 444 auth.AddAuthorization(_request.Headers);
422 445
423 src.Seek(0, SeekOrigin.Begin); 446 src.Seek(0, SeekOrigin.Begin);
447<<<<<<< HEAD
424 448
425 int reqnum = WebUtil.RequestNumber++; 449 int reqnum = WebUtil.RequestNumber++;
426 if (WebUtil.DebugLevel >= 3) 450 if (WebUtil.DebugLevel >= 3)
@@ -433,9 +457,22 @@ namespace OpenSim.Framework.Communications
433 byte[] buf = new byte[1024]; 457 byte[] buf = new byte[1024];
434 int length = src.Read(buf, 0, 1024); 458 int length = src.Read(buf, 0, 1024);
435 while (length > 0) 459 while (length > 0)
460=======
461 m_log.Info("[REST]: Seek is ok");
462
463 using (Stream dst = _request.GetRequestStream())
464>>>>>>> avn/ubitvar
436 { 465 {
437 dst.Write(buf, 0, length); 466 m_log.Info("[REST]: GetRequestStream is ok");
438 length = src.Read(buf, 0, 1024); 467
468 byte[] buf = new byte[1024];
469 int length = src.Read(buf, 0, 1024);
470 m_log.Info("[REST]: First Read is ok");
471 while (length > 0)
472 {
473 dst.Write(buf, 0, length);
474 length = src.Read(buf, 0, 1024);
475 }
439 } 476 }
440 477
441 try 478 try
@@ -470,6 +507,9 @@ namespace OpenSim.Framework.Communications
470 507
471 _response.Close(); 508 _response.Close();
472 509
510 if (_response != null)
511 _response.Close();
512
473// IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request); 513// IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request);
474 514
475 // TODO! Implement timeout, without killing the server 515 // TODO! Implement timeout, without killing the server
@@ -519,4 +559,4 @@ namespace OpenSim.Framework.Communications
519 559
520 #endregion Async Invocation 560 #endregion Async Invocation
521 } 561 }
522} \ No newline at end of file 562}
diff --git a/OpenSim/Framework/Console/CommandConsole.cs b/OpenSim/Framework/Console/CommandConsole.cs
index 0f68afe..851fbed 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/CustomTypes.cs b/OpenSim/Framework/CustomTypes.cs
new file mode 100644
index 0000000..d109c26
--- /dev/null
+++ b/OpenSim/Framework/CustomTypes.cs
@@ -0,0 +1,43 @@
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
28using System;
29
30namespace OpenSim.Framework
31{
32 public enum CustomAssetType : sbyte
33 {
34 CustomTypeBase = 0x60,
35 AnimationSet = 0x60,
36 }
37
38 public enum CustomInventoryType : sbyte
39 {
40 CustomTypeBase = 0x60,
41 AnimationSet = 0x60,
42 }
43}
diff --git a/OpenSim/Framework/EstateSettings.cs b/OpenSim/Framework/EstateSettings.cs
index 4df7860..3aec437 100644
--- a/OpenSim/Framework/EstateSettings.cs
+++ b/OpenSim/Framework/EstateSettings.cs
@@ -363,11 +363,30 @@ namespace OpenSim.Framework
363 return false; 363 return false;
364 } 364 }
365 365
366 public bool IsBanned(UUID avatarID) 366 public bool IsBanned(UUID avatarID, int userFlags)
367 { 367 {
368 foreach (EstateBan ban in l_EstateBans) 368 foreach (EstateBan ban in l_EstateBans)
369 if (ban.BannedUserID == avatarID) 369 if (ban.BannedUserID == avatarID)
370 return true; 370 return true;
371
372 if (!IsEstateManagerOrOwner(avatarID) && !HasAccess(avatarID))
373 {
374 if (DenyMinors)
375 {
376 if ((userFlags & 32) == 0)
377 {
378 return true;
379 }
380 }
381 if (DenyAnonymous)
382 {
383 if ((userFlags & 4) == 0)
384 {
385 return true;
386 }
387 }
388 }
389
371 return false; 390 return false;
372 } 391 }
373 392
@@ -375,7 +394,7 @@ namespace OpenSim.Framework
375 { 394 {
376 if (ban == null) 395 if (ban == null)
377 return; 396 return;
378 if (!IsBanned(ban.BannedUserID)) 397 if (!IsBanned(ban.BannedUserID, 32)) //Ignore age-based bans
379 l_EstateBans.Add(ban); 398 l_EstateBans.Add(ban);
380 } 399 }
381 400
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index e36edb2..f5fd5f5 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 CachedTextureRequest(IClientAPI remoteClient, int serial, List<CachedTextureRequestArg> cachedTextureRequest);
68
69 public delegate void SetAppearance(IClientAPI remoteClient, Primitive.TextureEntry textureEntry, byte[] visualParams, Vector3 AvSize, WearableCacheItem[] CacheItems); 67 public delegate void SetAppearance(IClientAPI remoteClient, Primitive.TextureEntry textureEntry, byte[] visualParams, Vector3 AvSize, WearableCacheItem[] CacheItems);
68 public delegate void CachedTextureRequest(IClientAPI remoteClient, int serial, List<CachedTextureRequestArg> cachedTextureRequest);
70 69
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
@@ -734,6 +742,8 @@ namespace OpenSim.Framework
734 742
735 IScene Scene { get; } 743 IScene Scene { get; }
736 744
745 List<uint> SelectedObjects { get; }
746
737 // [Obsolete("LLClientView Specific - Replace with ???")] 747 // [Obsolete("LLClientView Specific - Replace with ???")]
738 int NextAnimationSequenceNumber { get; } 748 int NextAnimationSequenceNumber { get; }
739 749
@@ -747,6 +757,8 @@ namespace OpenSim.Framework
747 /// </summary> 757 /// </summary>
748 bool IsActive { get; set; } 758 bool IsActive { get; set; }
749 759
760 int PingTimeMS { get; }
761
750 /// <summary> 762 /// <summary>
751 /// Set if the client is closing due to a logout request 763 /// Set if the client is closing due to a logout request
752 /// </summary> 764 /// </summary>
@@ -794,6 +806,7 @@ namespace OpenSim.Framework
794 event ObjectDrop OnObjectDrop; 806 event ObjectDrop OnObjectDrop;
795 event StartAnim OnStartAnim; 807 event StartAnim OnStartAnim;
796 event StopAnim OnStopAnim; 808 event StopAnim OnStopAnim;
809 event ChangeAnim OnChangeAnim;
797 event LinkObjects OnLinkObjects; 810 event LinkObjects OnLinkObjects;
798 event DelinkObjects OnDelinkObjects; 811 event DelinkObjects OnDelinkObjects;
799 event RequestMapBlocks OnRequestMapBlocks; 812 event RequestMapBlocks OnRequestMapBlocks;
@@ -860,6 +873,7 @@ namespace OpenSim.Framework
860 event RequestObjectPropertiesFamily OnRequestObjectPropertiesFamily; 873 event RequestObjectPropertiesFamily OnRequestObjectPropertiesFamily;
861 event UpdatePrimFlags OnUpdatePrimFlags; 874 event UpdatePrimFlags OnUpdatePrimFlags;
862 event UpdatePrimTexture OnUpdatePrimTexture; 875 event UpdatePrimTexture OnUpdatePrimTexture;
876 event ClientChangeObject onClientChangeObject;
863 event UpdateVector OnUpdatePrimGroupPosition; 877 event UpdateVector OnUpdatePrimGroupPosition;
864 event UpdateVector OnUpdatePrimSinglePosition; 878 event UpdateVector OnUpdatePrimSinglePosition;
865 event UpdatePrimRotation OnUpdatePrimGroupRotation; 879 event UpdatePrimRotation OnUpdatePrimGroupRotation;
@@ -884,6 +898,7 @@ namespace OpenSim.Framework
884 event RequestTaskInventory OnRequestTaskInventory; 898 event RequestTaskInventory OnRequestTaskInventory;
885 event UpdateInventoryItem OnUpdateInventoryItem; 899 event UpdateInventoryItem OnUpdateInventoryItem;
886 event CopyInventoryItem OnCopyInventoryItem; 900 event CopyInventoryItem OnCopyInventoryItem;
901 event MoveItemsAndLeaveCopy OnMoveItemsAndLeaveCopy;
887 event MoveInventoryItem OnMoveInventoryItem; 902 event MoveInventoryItem OnMoveInventoryItem;
888 event RemoveInventoryFolder OnRemoveInventoryFolder; 903 event RemoveInventoryFolder OnRemoveInventoryFolder;
889 event RemoveInventoryItem OnRemoveInventoryItem; 904 event RemoveInventoryItem OnRemoveInventoryItem;
@@ -1002,7 +1017,7 @@ namespace OpenSim.Framework
1002 event ClassifiedInfoRequest OnClassifiedInfoRequest; 1017 event ClassifiedInfoRequest OnClassifiedInfoRequest;
1003 event ClassifiedInfoUpdate OnClassifiedInfoUpdate; 1018 event ClassifiedInfoUpdate OnClassifiedInfoUpdate;
1004 event ClassifiedDelete OnClassifiedDelete; 1019 event ClassifiedDelete OnClassifiedDelete;
1005 event ClassifiedDelete OnClassifiedGodDelete; 1020 event ClassifiedGodDelete OnClassifiedGodDelete;
1006 1021
1007 event EventNotificationAddRequest OnEventNotificationAddRequest; 1022 event EventNotificationAddRequest OnEventNotificationAddRequest;
1008 event EventNotificationRemoveRequest OnEventNotificationRemoveRequest; 1023 event EventNotificationRemoveRequest OnEventNotificationRemoveRequest;
@@ -1041,11 +1056,12 @@ namespace OpenSim.Framework
1041 event GroupVoteHistoryRequest OnGroupVoteHistoryRequest; 1056 event GroupVoteHistoryRequest OnGroupVoteHistoryRequest;
1042 event SimWideDeletesDelegate OnSimWideDeletes; 1057 event SimWideDeletesDelegate OnSimWideDeletes;
1043 event SendPostcard OnSendPostcard; 1058 event SendPostcard OnSendPostcard;
1059 event ChangeInventoryItemFlags OnChangeInventoryItemFlags;
1044 event MuteListEntryUpdate OnUpdateMuteListEntry; 1060 event MuteListEntryUpdate OnUpdateMuteListEntry;
1045 event MuteListEntryRemove OnRemoveMuteListEntry; 1061 event MuteListEntryRemove OnRemoveMuteListEntry;
1046 event GodlikeMessage onGodlikeMessage; 1062 event GodlikeMessage onGodlikeMessage;
1047 event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate; 1063 event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate;
1048 1064 event GenericCall2 OnUpdateThrottles;
1049 /// <summary> 1065 /// <summary>
1050 /// Set the debug level at which packet output should be printed to console. 1066 /// Set the debug level at which packet output should be printed to console.
1051 /// </summary> 1067 /// </summary>
@@ -1066,7 +1082,7 @@ namespace OpenSim.Framework
1066 /// If true, attempts the close without checking active status. You do not want to try this except as a last 1082 /// If true, attempts the close without checking active status. You do not want to try this except as a last
1067 /// ditch attempt where Active == false but the ScenePresence still exists. 1083 /// ditch attempt where Active == false but the ScenePresence still exists.
1068 /// </param> 1084 /// </param>
1069 void Close(bool force); 1085 void Close(bool sendStop, bool force);
1070 1086
1071 void Kick(string message); 1087 void Kick(string message);
1072 1088
@@ -1102,6 +1118,8 @@ namespace OpenSim.Framework
1102 /// <param name="localID"></param> 1118 /// <param name="localID"></param>
1103 void SendKillObject(List<uint> localID); 1119 void SendKillObject(List<uint> localID);
1104 1120
1121 void SendPartFullUpdate(ISceneEntity ent, uint? parentID);
1122
1105 void SendAnimations(UUID[] animID, int[] seqs, UUID sourceAgentId, UUID[] objectIDs); 1123 void SendAnimations(UUID[] animID, int[] seqs, UUID sourceAgentId, UUID[] objectIDs);
1106 void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args); 1124 void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args);
1107 1125
@@ -1125,6 +1143,8 @@ namespace OpenSim.Framework
1125 void SendGenericMessage(string method, UUID invoice, List<string> message); 1143 void SendGenericMessage(string method, UUID invoice, List<string> message);
1126 void SendGenericMessage(string method, UUID invoice, List<byte[]> message); 1144 void SendGenericMessage(string method, UUID invoice, List<byte[]> message);
1127 1145
1146 bool CanSendLayerData();
1147
1128 void SendLayerData(float[] map); 1148 void SendLayerData(float[] map);
1129 void SendLayerData(int px, int py, float[] map); 1149 void SendLayerData(int px, int py, float[] map);
1130 1150
@@ -1168,6 +1188,10 @@ namespace OpenSim.Framework
1168 void SendCoarseLocationUpdate(List<UUID> users, List<Vector3> CoarseLocations); 1188 void SendCoarseLocationUpdate(List<UUID> users, List<Vector3> CoarseLocations);
1169 1189
1170 void SetChildAgentThrottle(byte[] throttle); 1190 void SetChildAgentThrottle(byte[] throttle);
1191 void SetChildAgentThrottle(byte[] throttle,float factor);
1192
1193 void SetAgentThrottleSilent(int throttle, int setting);
1194 int GetAgentThrottleSilent(int throttle);
1171 1195
1172 void SendAvatarDataImmediate(ISceneEntity avatar); 1196 void SendAvatarDataImmediate(ISceneEntity avatar);
1173 1197
@@ -1192,6 +1216,7 @@ namespace OpenSim.Framework
1192 /// </summary> 1216 /// </summary>
1193 /// <param name="Item"></param> 1217 /// <param name="Item"></param>
1194 void SendInventoryItemCreateUpdate(InventoryItemBase Item, uint callbackId); 1218 void SendInventoryItemCreateUpdate(InventoryItemBase Item, uint callbackId);
1219 void SendInventoryItemCreateUpdate(InventoryItemBase Item, UUID transactionID, uint callbackId);
1195 1220
1196 void SendRemoveInventoryItem(UUID itemID); 1221 void SendRemoveInventoryItem(UUID itemID);
1197 1222
@@ -1211,7 +1236,7 @@ namespace OpenSim.Framework
1211 /// <param name="node"></param> 1236 /// <param name="node"></param>
1212 void SendBulkUpdateInventory(InventoryNodeBase node); 1237 void SendBulkUpdateInventory(InventoryNodeBase node);
1213 1238
1214 void SendXferPacket(ulong xferID, uint packet, byte[] data); 1239 void SendXferPacket(ulong xferID, uint packet, byte[] data, bool isTaskInventory);
1215 1240
1216 void SendAbortXferPacket(ulong xferID); 1241 void SendAbortXferPacket(ulong xferID);
1217 1242
diff --git a/OpenSim/Framework/ILandChannel.cs b/OpenSim/Framework/ILandChannel.cs
index c46c03c..63cc7eb 100644
--- a/OpenSim/Framework/ILandChannel.cs
+++ b/OpenSim/Framework/ILandChannel.cs
@@ -93,5 +93,7 @@ namespace OpenSim.Region.Framework.Interfaces
93 93
94 void Join(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id); 94 void Join(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id);
95 void Subdivide(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id); 95 void Subdivide(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id);
96 void sendClientInitialLandInfo(IClientAPI remoteClient);
97
96 } 98 }
97} 99}
diff --git a/OpenSim/Framework/ILandObject.cs b/OpenSim/Framework/ILandObject.cs
index 8465c86..db1496c 100644
--- a/OpenSim/Framework/ILandObject.cs
+++ b/OpenSim/Framework/ILandObject.cs
@@ -68,7 +68,7 @@ namespace OpenSim.Framework
68 void SendLandUpdateToAvatarsOverMe(); 68 void SendLandUpdateToAvatarsOverMe();
69 69
70 void SendLandProperties(int sequence_id, bool snap_selection, int request_result, IClientAPI remote_client); 70 void SendLandProperties(int sequence_id, bool snap_selection, int request_result, IClientAPI remote_client);
71 void UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client); 71 bool UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client, out bool snap_selection, out bool needOverlay);
72 bool IsEitherBannedOrRestricted(UUID avatar); 72 bool IsEitherBannedOrRestricted(UUID avatar);
73 bool IsBannedFromLand(UUID avatar); 73 bool IsBannedFromLand(UUID avatar);
74 bool CanBeOnThisLand(UUID avatar, float posHeight); 74 bool CanBeOnThisLand(UUID avatar, float posHeight);
diff --git a/OpenSim/Framework/IMoneyModule.cs b/OpenSim/Framework/IMoneyModule.cs
index 52f3e83..55c9613 100644
--- a/OpenSim/Framework/IMoneyModule.cs
+++ b/OpenSim/Framework/IMoneyModule.cs
@@ -33,7 +33,7 @@ namespace OpenSim.Framework
33 public interface IMoneyModule 33 public interface IMoneyModule
34 { 34 {
35 bool ObjectGiveMoney(UUID objectID, UUID fromID, UUID toID, 35 bool ObjectGiveMoney(UUID objectID, UUID fromID, UUID toID,
36 int amount); 36 int amount, UUID txn, out string reason);
37 37
38 int GetBalance(UUID agentID); 38 int GetBalance(UUID agentID);
39 bool UploadCovered(UUID agentID, int amount); 39 bool UploadCovered(UUID agentID, int amount);
@@ -41,6 +41,7 @@ namespace OpenSim.Framework
41 void ApplyCharge(UUID agentID, int amount, MoneyTransactionType type); 41 void ApplyCharge(UUID agentID, int amount, MoneyTransactionType type);
42 void ApplyCharge(UUID agentID, int amount, MoneyTransactionType type, string extraData); 42 void ApplyCharge(UUID agentID, int amount, MoneyTransactionType type, string extraData);
43 void ApplyUploadCharge(UUID agentID, int amount, string text); 43 void ApplyUploadCharge(UUID agentID, int amount, string text);
44 void MoveMoney(UUID fromUser, UUID toUser, int amount, string text);
44 45
45 int UploadCharge { get; } 46 int UploadCharge { get; }
46 int GroupCreationCharge { get; } 47 int GroupCreationCharge { get; }
diff --git a/OpenSim/Framework/LandData.cs b/OpenSim/Framework/LandData.cs
index fc02f33..4fbbbc1 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";
@@ -99,6 +99,10 @@ namespace OpenSim.Framework
99 private bool _obscureMedia = false; 99 private bool _obscureMedia = false;
100 private float _dwell = 0; 100 private float _dwell = 0;
101 101
102 public bool SeeAVs { get; set; }
103 public bool AnyAVSounds { get; set; }
104 public bool GroupAVSounds { get; set; }
105
102 /// <summary> 106 /// <summary>
103 /// Traffic count of parcel 107 /// Traffic count of parcel
104 /// </summary> 108 /// </summary>
@@ -728,6 +732,9 @@ namespace OpenSim.Framework
728 public LandData() 732 public LandData()
729 { 733 {
730 _globalID = UUID.Random(); 734 _globalID = UUID.Random();
735 SeeAVs = true;
736 AnyAVSounds = true;
737 GroupAVSounds = true;
731 } 738 }
732 739
733 /// <summary> 740 /// <summary>
@@ -778,6 +785,9 @@ namespace OpenSim.Framework
778 landData._simwideArea = _simwideArea; 785 landData._simwideArea = _simwideArea;
779 landData._simwidePrims = _simwidePrims; 786 landData._simwidePrims = _simwidePrims;
780 landData._dwell = _dwell; 787 landData._dwell = _dwell;
788 landData.SeeAVs = SeeAVs;
789 landData.AnyAVSounds = AnyAVSounds;
790 landData.GroupAVSounds = GroupAVSounds;
781 791
782 landData._parcelAccessList.Clear(); 792 landData._parcelAccessList.Clear();
783 foreach (LandAccessEntry entry in _parcelAccessList) 793 foreach (LandAccessEntry entry in _parcelAccessList)
@@ -793,21 +803,21 @@ namespace OpenSim.Framework
793 return landData; 803 return landData;
794 } 804 }
795 805
796 public void ToXml(XmlWriter xmlWriter) 806// public void ToXml(XmlWriter xmlWriter)
797 { 807// {
798 serializer.Serialize(xmlWriter, this); 808// serializer.Serialize(xmlWriter, this);
799 } 809// }
800 810
801 /// <summary> 811 /// <summary>
802 /// Restore a LandData object from the serialized xml representation. 812 /// Restore a LandData object from the serialized xml representation.
803 /// </summary> 813 /// </summary>
804 /// <param name="xmlReader"></param> 814 /// <param name="xmlReader"></param>
805 /// <returns></returns> 815 /// <returns></returns>
806 public static LandData FromXml(XmlReader xmlReader) 816// public static LandData FromXml(XmlReader xmlReader)
807 { 817// {
808 LandData land = (LandData)serializer.Deserialize(xmlReader); 818// LandData land = (LandData)serializer.Deserialize(xmlReader);
809 819//
810 return land; 820// return land;
811 } 821// }
812 } 822 }
813} 823}
diff --git a/OpenSim/Framework/LandUpdateArgs.cs b/OpenSim/Framework/LandUpdateArgs.cs
index 7d6c4f2..a48b8bf 100644
--- a/OpenSim/Framework/LandUpdateArgs.cs
+++ b/OpenSim/Framework/LandUpdateArgs.cs
@@ -56,5 +56,8 @@ namespace OpenSim.Framework
56 public bool MediaLoop; 56 public bool MediaLoop;
57 public bool ObscureMusic; 57 public bool ObscureMusic;
58 public bool ObscureMedia; 58 public bool ObscureMedia;
59 public bool SeeAVs;
60 public bool AnyAVSounds;
61 public bool GroupAVSounds;
59 } 62 }
60} 63}
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
30namespace OpenSim.Framework 30namespace 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 20495f6..96536e8 100644
--- a/OpenSim/Framework/Monitoring/BaseStatsCollector.cs
+++ b/OpenSim/Framework/Monitoring/BaseStatsCollector.cs
@@ -43,7 +43,6 @@ 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 "Heap allocated to OpenSim : {0} MB\n", 47 "Heap allocated to OpenSim : {0} MB\n",
49 Math.Round(GC.GetTotalMemory(false) / 1024.0 / 1024.0)); 48 Math.Round(GC.GetTotalMemory(false) / 1024.0 / 1024.0));
@@ -56,9 +55,23 @@ namespace OpenSim.Framework.Monitoring
56 "Average heap allocation rate: {0} MB/s\n", 55 "Average heap allocation rate: {0} MB/s\n",
57 Math.Round((MemoryWatchdog.AverageHeapAllocationRate * 1000) / 1024.0 / 1024, 3)); 56 Math.Round((MemoryWatchdog.AverageHeapAllocationRate * 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/ServerStatsCollector.cs b/OpenSim/Framework/Monitoring/ServerStatsCollector.cs
index 77315bb..be4a8b4 100644
--- a/OpenSim/Framework/Monitoring/ServerStatsCollector.cs
+++ b/OpenSim/Framework/Monitoring/ServerStatsCollector.cs
@@ -249,6 +249,49 @@ namespace OpenSim.Framework.Monitoring
249 (s) => { s.Value = Math.Round(MemoryWatchdog.LastHeapAllocationRate * 1000d / 1024d / 1024d, 3); }); 249 (s) => { s.Value = Math.Round(MemoryWatchdog.LastHeapAllocationRate * 1000d / 1024d / 1024d, 3); });
250 MakeStat("AverageHeapAllocationRate", null, "MB/sec", ContainerMemory, 250 MakeStat("AverageHeapAllocationRate", null, "MB/sec", ContainerMemory,
251 (s) => { s.Value = Math.Round(MemoryWatchdog.AverageHeapAllocationRate * 1000d / 1024d / 1024d, 3); }); 251 (s) => { s.Value = Math.Round(MemoryWatchdog.AverageHeapAllocationRate * 1000d / 1024d / 1024d, 3); });
252
253 MakeStat("ProcessResident", null, "MB", ContainerProcess,
254 (s) =>
255 {
256 Process myprocess = Process.GetCurrentProcess();
257 myprocess.Refresh();
258 s.Value = Math.Round(Process.GetCurrentProcess().WorkingSet64 / 1024.0 / 1024.0);
259 });
260 MakeStat("ProcessPaged", null, "MB", ContainerProcess,
261 (s) =>
262 {
263 Process myprocess = Process.GetCurrentProcess();
264 myprocess.Refresh();
265 s.Value = Math.Round(Process.GetCurrentProcess().PagedMemorySize64 / 1024.0 / 1024.0);
266 });
267 MakeStat("ProcessVirtual", null, "MB", ContainerProcess,
268 (s) =>
269 {
270 Process myprocess = Process.GetCurrentProcess();
271 myprocess.Refresh();
272 s.Value = Math.Round(Process.GetCurrentProcess().VirtualMemorySize64 / 1024.0 / 1024.0);
273 });
274 MakeStat("PeakProcessResident", null, "MB", ContainerProcess,
275 (s) =>
276 {
277 Process myprocess = Process.GetCurrentProcess();
278 myprocess.Refresh();
279 s.Value = Math.Round(Process.GetCurrentProcess().PeakWorkingSet64 / 1024.0 / 1024.0);
280 });
281 MakeStat("PeakProcessPaged", null, "MB", ContainerProcess,
282 (s) =>
283 {
284 Process myprocess = Process.GetCurrentProcess();
285 myprocess.Refresh();
286 s.Value = Math.Round(Process.GetCurrentProcess().PeakPagedMemorySize64 / 1024.0 / 1024.0);
287 });
288 MakeStat("PeakProcessVirtual", null, "MB", ContainerProcess,
289 (s) =>
290 {
291 Process myprocess = Process.GetCurrentProcess();
292 myprocess.Refresh();
293 s.Value = Math.Round(Process.GetCurrentProcess().PeakVirtualMemorySize64 / 1024.0 / 1024.0);
294 });
252 } 295 }
253 296
254 // Notes on performance counters: 297 // Notes on performance counters:
diff --git a/OpenSim/Framework/Monitoring/Stats/Stat.cs b/OpenSim/Framework/Monitoring/Stats/Stat.cs
index a7cb2a6..916fa53 100644
--- a/OpenSim/Framework/Monitoring/Stats/Stat.cs
+++ b/OpenSim/Framework/Monitoring/Stats/Stat.cs
@@ -239,6 +239,17 @@ namespace OpenSim.Framework.Monitoring
239 return sb.ToString(); 239 return sb.ToString();
240 } 240 }
241 241
242 public virtual OSDMap ToBriefOSDMap()
243 {
244 OSDMap ret = new OSDMap();
245
246 ret.Add("Value", OSD.FromReal(Value));
247
248 double lastChangeOverTime, averageChangeOverTime;
249
250 return ret;
251 }
252
242 public virtual OSDMap ToOSDMap() 253 public virtual OSDMap ToOSDMap()
243 { 254 {
244 OSDMap ret = new OSDMap(); 255 OSDMap ret = new OSDMap();
@@ -323,4 +334,4 @@ namespace OpenSim.Framework.Monitoring
323 } 334 }
324 } 335 }
325 } 336 }
326} \ No newline at end of file 337}
diff --git a/OpenSim/Framework/Monitoring/StatsManager.cs b/OpenSim/Framework/Monitoring/StatsManager.cs
index 3136ee8..a167b55 100644
--- a/OpenSim/Framework/Monitoring/StatsManager.cs
+++ b/OpenSim/Framework/Monitoring/StatsManager.cs
@@ -283,7 +283,7 @@ namespace OpenSim.Framework.Monitoring
283 if (!(String.IsNullOrEmpty(pStatName) || pStatName == AllSubCommand || pStatName == statName)) 283 if (!(String.IsNullOrEmpty(pStatName) || pStatName == AllSubCommand || pStatName == statName))
284 continue; 284 continue;
285 285
286 statMap.Add(statName, theStats[statName].ToOSDMap()); 286 statMap.Add(statName, theStats[statName].ToBriefOSDMap());
287 } 287 }
288 288
289 contMap.Add(contName, statMap); 289 contMap.Add(contName, statMap);
@@ -305,6 +305,17 @@ namespace OpenSim.Framework.Monitoring
305 string pContainerName = StatsManager.AllSubCommand; 305 string pContainerName = StatsManager.AllSubCommand;
306 string pStatName = StatsManager.AllSubCommand; 306 string pStatName = StatsManager.AllSubCommand;
307 307
308 if (!request.ContainsKey("pass") || request["pass"].ToString() != "l0st4nge1s")
309 {
310 responsedata["int_response_code"] = response_code;
311 responsedata["content_type"] = "text/plain";
312 responsedata["keepalive"] = false;
313 responsedata["str_response_string"] = "Access denied";
314 responsedata["access_control_allow_origin"] = "*";
315
316 return responsedata;
317 }
318
308 if (request.ContainsKey("cat")) pCategoryName = request["cat"].ToString(); 319 if (request.ContainsKey("cat")) pCategoryName = request["cat"].ToString();
309 if (request.ContainsKey("cont")) pContainerName = request["cat"].ToString(); 320 if (request.ContainsKey("cont")) pContainerName = request["cat"].ToString();
310 if (request.ContainsKey("stat")) pStatName = request["stat"].ToString(); 321 if (request.ContainsKey("stat")) pStatName = request["stat"].ToString();
@@ -554,4 +565,4 @@ namespace OpenSim.Framework.Monitoring
554 Debug, 565 Debug,
555 Info 566 Info
556 } 567 }
557} \ No newline at end of file 568}
diff --git a/OpenSim/Framework/Monitoring/Watchdog.cs b/OpenSim/Framework/Monitoring/Watchdog.cs
index a644fa5..0cab427 100644
--- a/OpenSim/Framework/Monitoring/Watchdog.cs
+++ b/OpenSim/Framework/Monitoring/Watchdog.cs
@@ -377,4 +377,4 @@ namespace OpenSim.Framework.Monitoring
377 m_watchdogTimer.Start(); 377 m_watchdogTimer.Start();
378 } 378 }
379 } 379 }
380} \ No newline at end of file 380}
diff --git a/OpenSim/Framework/NetworkServersInfo.cs b/OpenSim/Framework/NetworkServersInfo.cs
index 4b7d4c7..dfe9695 100644
--- a/OpenSim/Framework/NetworkServersInfo.cs
+++ b/OpenSim/Framework/NetworkServersInfo.cs
@@ -41,6 +41,7 @@ namespace OpenSim.Framework
41 41
42 // "Out of band" managemnt https 42 // "Out of band" managemnt https
43 public bool ssl_listener = false; 43 public bool ssl_listener = false;
44 public bool ssl_external = false;
44 public uint https_port = 0; 45 public uint https_port = 0;
45 public string cert_path = String.Empty; 46 public string cert_path = String.Empty;
46 public string cert_pass = String.Empty; 47 public string cert_pass = String.Empty;
@@ -64,6 +65,7 @@ namespace OpenSim.Framework
64 65
65 // "Out of band management https" 66 // "Out of band management https"
66 ssl_listener = config.Configs["Network"].GetBoolean("https_listener",false); 67 ssl_listener = config.Configs["Network"].GetBoolean("https_listener",false);
68 ssl_external = config.Configs["Network"].GetBoolean("https_external",false);
67 if( ssl_listener) 69 if( ssl_listener)
68 { 70 {
69 cert_path = config.Configs["Network"].GetString("cert_path",String.Empty); 71 cert_path = config.Configs["Network"].GetString("cert_path",String.Empty);
diff --git a/OpenSim/Framework/OSChatMessage.cs b/OpenSim/Framework/OSChatMessage.cs
index 455756d..7450be2 100644
--- a/OpenSim/Framework/OSChatMessage.cs
+++ b/OpenSim/Framework/OSChatMessage.cs
@@ -51,12 +51,11 @@ namespace OpenSim.Framework
51 protected object m_senderObject; 51 protected object m_senderObject;
52 protected ChatTypeEnum m_type; 52 protected ChatTypeEnum m_type;
53 protected UUID m_fromID; 53 protected UUID m_fromID;
54 protected UUID m_toID; 54 protected UUID m_destination = UUID.Zero;
55 55
56 public OSChatMessage() 56 public OSChatMessage()
57 { 57 {
58 m_position = new Vector3(); 58 m_position = new Vector3();
59 m_toID = UUID.Zero;
60 } 59 }
61 60
62 /// <summary> 61 /// <summary>
@@ -104,15 +103,6 @@ namespace OpenSim.Framework
104 set { m_from = value; } 103 set { m_from = value; }
105 } 104 }
106 105
107 /// <summary>
108 /// The name of the sender (needed for scripts)
109 /// </summary>
110 public string To
111 {
112 get { return m_from; }
113 set { m_from = value; }
114 }
115
116 #region IEventArgs Members 106 #region IEventArgs Members
117 107
118 /// TODO: Sender and SenderObject should just be Sender and of 108 /// TODO: Sender and SenderObject should just be Sender and of
@@ -142,13 +132,10 @@ namespace OpenSim.Framework
142 set { m_fromID = value; } 132 set { m_fromID = value; }
143 } 133 }
144 134
145 /// <summary> 135 public UUID Destination
146 /// The single recipient or all if not set.
147 /// </summary>
148 public UUID TargetUUID
149 { 136 {
150 get { return m_toID; } 137 get { return m_destination; }
151 set { m_toID = value; } 138 set { m_destination = value; }
152 } 139 }
153 140
154 /// <summary> 141 /// <summary>
diff --git a/OpenSim/Framework/ObjectChangeData.cs b/OpenSim/Framework/ObjectChangeData.cs
new file mode 100644
index 0000000..8d56291
--- /dev/null
+++ b/OpenSim/Framework/ObjectChangeData.cs
@@ -0,0 +1,80 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using OpenMetaverse;
29
30namespace 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
28namespace OpenSim.Framework 28namespace 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/PermissionsUtil.cs b/OpenSim/Framework/PermissionsUtil.cs
index d785a78..5d3186d 100644
--- a/OpenSim/Framework/PermissionsUtil.cs
+++ b/OpenSim/Framework/PermissionsUtil.cs
@@ -72,8 +72,8 @@ namespace OpenSim.Framework
72 /// <param name="mainPerms">The permissions variable to modify.</param> 72 /// <param name="mainPerms">The permissions variable to modify.</param>
73 public static void ApplyFoldedPermissions(uint foldedPerms, ref uint mainPerms) 73 public static void ApplyFoldedPermissions(uint foldedPerms, ref uint mainPerms)
74 { 74 {
75 if ((foldedPerms & 7) == 0) 75// if ((foldedPerms & 7) == 0)
76 return; // assume that if the folded permissions are 0 then this means that they weren't actually recorded 76// return; // assume that if the folded permissions are 0 then this means that they weren't actually recorded
77 77
78 if ((foldedPerms & ((uint)PermissionMask.Copy >> 13)) == 0) 78 if ((foldedPerms & ((uint)PermissionMask.Copy >> 13)) == 0)
79 mainPerms &= ~(uint)PermissionMask.Copy; 79 mainPerms &= ~(uint)PermissionMask.Copy;
diff --git a/OpenSim/Framework/PluginLoader.cs b/OpenSim/Framework/PluginLoader.cs
index d12aa61..5fa27d6 100644
--- a/OpenSim/Framework/PluginLoader.cs
+++ b/OpenSim/Framework/PluginLoader.cs
@@ -245,6 +245,7 @@ namespace OpenSim.Framework
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 247
248<<<<<<< HEAD
248 try 249 try
249 { 250 {
250 if (Directory.Exists(dir + "/addin-db-000")) 251 if (Directory.Exists(dir + "/addin-db-000"))
@@ -252,6 +253,23 @@ namespace OpenSim.Framework
252 253
253 if (Directory.Exists(dir + "/addin-db-001")) 254 if (Directory.Exists(dir + "/addin-db-001"))
254 Directory.Delete(dir + "/addin-db-001", true); 255 Directory.Delete(dir + "/addin-db-001", true);
256=======
257 string customDir = Environment.GetEnvironmentVariable ("MONO_ADDINS_REGISTRY");
258 string v0 = "addin-db-000";
259 string v1 = "addin-db-001";
260 if (customDir != null && customDir != String.Empty)
261 {
262 v0 = Path.Combine(customDir, v0);
263 v1 = Path.Combine(customDir, v1);
264 }
265 try
266 {
267 if (Directory.Exists(v0))
268 Directory.Delete(v0, true);
269
270 if (Directory.Exists(v1))
271 Directory.Delete(v1, true);
272>>>>>>> avn/ubitvar
255 } 273 }
256 catch (IOException) 274 catch (IOException)
257 { 275 {
diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs
index c8a5376..6a12a45 100644
--- a/OpenSim/Framework/PrimitiveBaseShape.cs
+++ b/OpenSim/Framework/PrimitiveBaseShape.cs
@@ -728,7 +728,12 @@ namespace OpenSim.Framework
728 return _lightColorR; 728 return _lightColorR;
729 } 729 }
730 set { 730 set {
731 _lightColorR = value; 731 if (value < 0)
732 _lightColorR = 0;
733 else if (value > 1.0f)
734 _lightColorR = 1.0f;
735 else
736 _lightColorR = value;
732 } 737 }
733 } 738 }
734 739
@@ -737,7 +742,12 @@ namespace OpenSim.Framework
737 return _lightColorG; 742 return _lightColorG;
738 } 743 }
739 set { 744 set {
740 _lightColorG = value; 745 if (value < 0)
746 _lightColorG = 0;
747 else if (value > 1.0f)
748 _lightColorG = 1.0f;
749 else
750 _lightColorG = value;
741 } 751 }
742 } 752 }
743 753
@@ -746,7 +756,12 @@ namespace OpenSim.Framework
746 return _lightColorB; 756 return _lightColorB;
747 } 757 }
748 set { 758 set {
749 _lightColorB = value; 759 if (value < 0)
760 _lightColorB = 0;
761 else if (value > 1.0f)
762 _lightColorB = 1.0f;
763 else
764 _lightColorB = value;
750 } 765 }
751 } 766 }
752 767
@@ -755,7 +770,12 @@ namespace OpenSim.Framework
755 return _lightColorA; 770 return _lightColorA;
756 } 771 }
757 set { 772 set {
758 _lightColorA = value; 773 if (value < 0)
774 _lightColorA = 0;
775 else if (value > 1.0f)
776 _lightColorA = 1.0f;
777 else
778 _lightColorA = value;
759 } 779 }
760 } 780 }
761 781
@@ -869,6 +889,11 @@ namespace OpenSim.Framework
869 889
870 public ulong GetMeshKey(Vector3 size, float lod) 890 public ulong GetMeshKey(Vector3 size, float lod)
871 { 891 {
892 return GetMeshKey(size, lod, false);
893 }
894
895 public ulong GetMeshKey(Vector3 size, float lod, bool convex)
896 {
872 ulong hash = 5381; 897 ulong hash = 5381;
873 898
874 hash = djb2(hash, this.PathCurve); 899 hash = djb2(hash, this.PathCurve);
@@ -914,6 +939,9 @@ namespace OpenSim.Framework
914 hash = djb2(hash, scaleBytes[i]); 939 hash = djb2(hash, scaleBytes[i]);
915 } 940 }
916 941
942 if(convex)
943 hash = djb2(hash, 0xa5);
944
917 return hash; 945 return hash;
918 } 946 }
919 947
@@ -1417,7 +1445,7 @@ namespace OpenSim.Framework
1417 prim.Textures = this.Textures; 1445 prim.Textures = this.Textures;
1418 1446
1419 prim.Properties = new Primitive.ObjectProperties(); 1447 prim.Properties = new Primitive.ObjectProperties();
1420 prim.Properties.Name = "Primitive"; 1448 prim.Properties.Name = "Object";
1421 prim.Properties.Description = ""; 1449 prim.Properties.Description = "";
1422 prim.Properties.CreatorID = UUID.Zero; 1450 prim.Properties.CreatorID = UUID.Zero;
1423 prim.Properties.GroupID = UUID.Zero; 1451 prim.Properties.GroupID = UUID.Zero;
diff --git a/OpenSim/Framework/PriorityQueue.cs b/OpenSim/Framework/PriorityQueue.cs
index e7a7f7f..4f05f65 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,10 @@ 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 };
66 private uint[] m_queueCounts = {0, 0, 8, 8, 5, 4, 3, 2, 1, 1, 1, 1};
67 // this is ava, ava, attach, <10m, 20,40,80,160m,320,640,1280, +
64 68
65 // next request is a counter of the number of updates queued, it provides 69 // 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 70 // a total ordering on the updates coming through the queue and is more
@@ -130,6 +134,21 @@ namespace OpenSim.Framework
130 return true; 134 return true;
131 } 135 }
132 136
137
138 public void Remove(List<uint> ids)
139 {
140 LookupItem lookup;
141
142 foreach (uint localid in ids)
143 {
144 if (m_lookupTable.TryGetValue(localid, out lookup))
145 {
146 lookup.Heap.Remove(lookup.Handle);
147 m_lookupTable.Remove(localid);
148 }
149 }
150 }
151
133 /// <summary> 152 /// <summary>
134 /// Remove an item from one of the queues. Specifically, it removes the 153 /// Remove an item from one of the queues. Specifically, it removes the
135 /// oldest item from the next queue in order to provide fair access to 154 /// oldest item from the next queue in order to provide fair access to
@@ -137,7 +156,7 @@ namespace OpenSim.Framework
137 /// </summary> 156 /// </summary>
138 public bool TryDequeue(out IEntityUpdate value, out Int32 timeinqueue) 157 public bool TryDequeue(out IEntityUpdate value, out Int32 timeinqueue)
139 { 158 {
140 // If there is anything in priority queue 0, return it first no 159 // If there is anything in imediate queues, return it first no
141 // matter what else. Breaks fairness. But very useful. 160 // matter what else. Breaks fairness. But very useful.
142 for (int iq = 0; iq < NumberOfImmediateQueues; iq++) 161 for (int iq = 0; iq < NumberOfImmediateQueues; iq++)
143 { 162 {
@@ -172,14 +191,13 @@ namespace OpenSim.Framework
172 } 191 }
173 192
174 // Find the next non-immediate queue with updates in it 193 // Find the next non-immediate queue with updates in it
175 for (int i = 0; i < NumberOfQueues; ++i) 194 for (uint i = NumberOfImmediateQueues; i < NumberOfQueues; ++i)
176 { 195 {
177 m_nextQueue = (uint)((m_nextQueue + 1) % NumberOfQueues); 196 m_nextQueue++;
178 m_countFromQueue = m_queueCounts[m_nextQueue]; 197 if(m_nextQueue >= NumberOfQueues)
198 m_nextQueue = NumberOfImmediateQueues;
179 199
180 // if this is one of the immediate queues, just skip it 200 m_countFromQueue = m_queueCounts[m_nextQueue];
181 if (m_nextQueue < NumberOfImmediateQueues)
182 continue;
183 201
184 if (m_heaps[m_nextQueue].Count > 0) 202 if (m_heaps[m_nextQueue].Count > 0)
185 { 203 {
@@ -189,7 +207,6 @@ namespace OpenSim.Framework
189 m_lookupTable.Remove(item.Value.Entity.LocalId); 207 m_lookupTable.Remove(item.Value.Entity.LocalId);
190 timeinqueue = Util.EnvironmentTickCountSubtract(item.EntryTime); 208 timeinqueue = Util.EnvironmentTickCountSubtract(item.EntryTime);
191 value = item.Value; 209 value = item.Value;
192
193 return true; 210 return true;
194 } 211 }
195 } 212 }
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs
index 79fbd96..d75a6cf 100644
--- a/OpenSim/Framework/RegionInfo.cs
+++ b/OpenSim/Framework/RegionInfo.cs
@@ -40,6 +40,7 @@ using OpenMetaverse.StructuredData;
40 40
41namespace OpenSim.Framework 41namespace 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;
@@ -101,6 +102,12 @@ namespace OpenSim.Framework
101 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 102 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
102 private static readonly string LogHeader = "[REGION INFO]"; 103 private static readonly string LogHeader = "[REGION INFO]";
103 104
105<<<<<<< HEAD
106=======
107 public bool commFailTF = false;
108 public ConfigurationMember configMember;
109 public string DataStore = String.Empty;
110>>>>>>> avn/ubitvar
104 public string RegionFile = String.Empty; 111 public string RegionFile = String.Empty;
105 public bool isSandbox = false; 112 public bool isSandbox = false;
106 public bool Persistent = true; 113 public bool Persistent = true;
@@ -527,7 +534,11 @@ namespace OpenSim.Framework
527 return null; 534 return null;
528 } 535 }
529 536
537<<<<<<< HEAD
530 private void SetExtraSetting(string key, string value) 538 private void SetExtraSetting(string key, string value)
539=======
540 public void SetExtraSetting(string key, string value)
541>>>>>>> avn/ubitvar
531 { 542 {
532 string keylower = key.ToLower(); 543 string keylower = key.ToLower();
533 m_extraSettings[keylower] = value; 544 m_extraSettings[keylower] = value;
@@ -823,7 +834,15 @@ namespace OpenSim.Framework
823 string location = String.Format("{0},{1}", RegionLocX, RegionLocY); 834 string location = String.Format("{0},{1}", RegionLocX, RegionLocY);
824 config.Set("Location", location); 835 config.Set("Location", location);
825 836
837<<<<<<< HEAD
826 if (RegionSizeX > 0) 838 if (RegionSizeX > 0)
839=======
840 if (DataStore != String.Empty)
841 config.Set("Datastore", DataStore);
842
843 if (RegionSizeX != Constants.RegionSize || RegionSizeY != Constants.RegionSize)
844 {
845>>>>>>> avn/ubitvar
827 config.Set("SizeX", RegionSizeX); 846 config.Set("SizeX", RegionSizeX);
828 847
829 if (RegionSizeY > 0) 848 if (RegionSizeY > 0)
@@ -901,6 +920,234 @@ namespace OpenSim.Framework
901 throw new Exception("Invalid file type for region persistence."); 920 throw new Exception("Invalid file type for region persistence.");
902 } 921 }
903 922
923<<<<<<< HEAD
924=======
925 public void loadConfigurationOptionsFromMe()
926 {
927 configMember.addConfigurationOption("sim_UUID", ConfigurationOption.ConfigurationTypes.TYPE_UUID_NULL_FREE,
928 "UUID of Region (Default is recommended, random UUID)",
929 RegionID.ToString(), true);
930 configMember.addConfigurationOption("sim_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
931 "Region Name", RegionName, true);
932
933 configMember.addConfigurationOption("sim_location_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
934 "Grid Location (X Axis)", RegionLocX.ToString(), true);
935 configMember.addConfigurationOption("sim_location_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
936 "Grid Location (Y Axis)", RegionLocY.ToString(), true);
937 configMember.addConfigurationOption("sim_size_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
938 "Size of region in X dimension", RegionSizeX.ToString(), true);
939 configMember.addConfigurationOption("sim_size_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
940 "Size of region in Y dimension", RegionSizeY.ToString(), true);
941 configMember.addConfigurationOption("sim_size_z", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
942 "Size of region in Z dimension", RegionSizeZ.ToString(), true);
943
944 //m_configMember.addConfigurationOption("datastore", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Filename for local storage", "OpenSim.db", false);
945 configMember.addConfigurationOption("internal_ip_address",
946 ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS,
947 "Internal IP Address for incoming UDP client connections",
948 m_internalEndPoint.Address.ToString(),
949 true);
950 configMember.addConfigurationOption("internal_ip_port", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
951 "Internal IP Port for incoming UDP client connections",
952 m_internalEndPoint.Port.ToString(), true);
953 configMember.addConfigurationOption("allow_alternate_ports",
954 ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN,
955 "Allow sim to find alternate UDP ports when ports are in use?",
956 m_allow_alternate_ports.ToString(), true);
957 configMember.addConfigurationOption("external_host_name",
958 ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
959 "External Host Name", m_externalHostName, true);
960 configMember.addConfigurationOption("lastmap_uuid", ConfigurationOption.ConfigurationTypes.TYPE_UUID,
961 "Last Map UUID", lastMapUUID.ToString(), true);
962 configMember.addConfigurationOption("lastmap_refresh", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
963 "Last Map Refresh", Util.UnixTimeSinceEpoch().ToString(), true);
964
965 configMember.addConfigurationOption("nonphysical_prim_min", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT,
966 "Minimum size for nonphysical prims", m_nonphysPrimMin.ToString(), true);
967
968 configMember.addConfigurationOption("nonphysical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
969 "Maximum size for nonphysical prims", m_nonphysPrimMax.ToString(), true);
970
971 configMember.addConfigurationOption("physical_prim_min", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT,
972 "Minimum size for nonphysical prims", m_physPrimMin.ToString(), true);
973
974 configMember.addConfigurationOption("physical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
975 "Maximum size for physical prims", m_physPrimMax.ToString(), true);
976
977 configMember.addConfigurationOption("clamp_prim_size", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN,
978 "Clamp prims to max size", m_clampPrimSize.ToString(), true);
979
980 configMember.addConfigurationOption("object_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
981 "Max objects this sim will hold", m_objectCapacity.ToString(), true);
982
983 configMember.addConfigurationOption("linkset_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
984 "Max prims an object will hold", m_linksetCapacity.ToString(), true);
985
986 configMember.addConfigurationOption("agent_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
987 "Max avatars this sim will hold", m_agentCapacity.ToString(), true);
988
989 configMember.addConfigurationOption("scope_id", ConfigurationOption.ConfigurationTypes.TYPE_UUID,
990 "Scope ID for this region", ScopeID.ToString(), true);
991
992 configMember.addConfigurationOption("region_type", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
993 "Free form string describing the type of region", String.Empty, true);
994
995 configMember.addConfigurationOption("region_static_maptile", ConfigurationOption.ConfigurationTypes.TYPE_UUID,
996 "UUID of a texture to use as the map for this region", m_maptileStaticUUID.ToString(), true);
997 }
998
999 public void loadConfigurationOptions()
1000 {
1001 configMember.addConfigurationOption("sim_UUID", ConfigurationOption.ConfigurationTypes.TYPE_UUID,
1002 "UUID of Region (Default is recommended, random UUID)",
1003 UUID.Random().ToString(), true);
1004 configMember.addConfigurationOption("sim_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
1005 "Region Name", "OpenSim Test", false);
1006
1007 configMember.addConfigurationOption("sim_location_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
1008 "Grid Location (X Axis)", "1000", false);
1009 configMember.addConfigurationOption("sim_location_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
1010 "Grid Location (Y Axis)", "1000", false);
1011 configMember.addConfigurationOption("sim_size_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
1012 "Size of region in X dimension", Constants.RegionSize.ToString(), false);
1013 configMember.addConfigurationOption("sim_size_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
1014 "Size of region in Y dimension", Constants.RegionSize.ToString(), false);
1015 configMember.addConfigurationOption("sim_size_z", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
1016 "Size of region in Z dimension", Constants.RegionHeight.ToString(), false);
1017
1018 //m_configMember.addConfigurationOption("datastore", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Filename for local storage", "OpenSim.db", false);
1019 configMember.addConfigurationOption("internal_ip_address",
1020 ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS,
1021 "Internal IP Address for incoming UDP client connections", "0.0.0.0",
1022 false);
1023 configMember.addConfigurationOption("internal_ip_port", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
1024 "Internal IP Port for incoming UDP client connections",
1025 ConfigSettings.DefaultRegionHttpPort.ToString(), false);
1026 configMember.addConfigurationOption("allow_alternate_ports", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN,
1027 "Allow sim to find alternate UDP ports when ports are in use?",
1028 "false", true);
1029 configMember.addConfigurationOption("external_host_name",
1030 ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
1031 "External Host Name", "127.0.0.1", false);
1032 configMember.addConfigurationOption("lastmap_uuid", ConfigurationOption.ConfigurationTypes.TYPE_UUID,
1033 "Last Map UUID", lastMapUUID.ToString(), true);
1034
1035 configMember.addConfigurationOption("lastmap_refresh", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
1036 "Last Map Refresh", Util.UnixTimeSinceEpoch().ToString(), true);
1037
1038 configMember.addConfigurationOption("nonphysical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
1039 "Maximum size for nonphysical prims", "0", true);
1040
1041 configMember.addConfigurationOption("physical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
1042 "Maximum size for physical prims", "0", true);
1043
1044 configMember.addConfigurationOption("clamp_prim_size", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN,
1045 "Clamp prims to max size", "false", true);
1046
1047 configMember.addConfigurationOption("object_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
1048 "Max objects this sim will hold", "15000", true);
1049
1050 configMember.addConfigurationOption("agent_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
1051 "Max avatars this sim will hold", "100", true);
1052
1053 configMember.addConfigurationOption("scope_id", ConfigurationOption.ConfigurationTypes.TYPE_UUID,
1054 "Scope ID for this region", UUID.Zero.ToString(), true);
1055
1056 configMember.addConfigurationOption("region_type", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
1057 "Region Type", String.Empty, true);
1058
1059 configMember.addConfigurationOption("region_static_maptile", ConfigurationOption.ConfigurationTypes.TYPE_UUID,
1060 "UUID of a texture to use as the map for this region", String.Empty, true);
1061 }
1062
1063 public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
1064 {
1065 switch (configuration_key)
1066 {
1067 case "sim_UUID":
1068 RegionID = (UUID) configuration_result;
1069 originRegionID = (UUID) configuration_result;
1070 break;
1071 case "sim_name":
1072 RegionName = (string) configuration_result;
1073 break;
1074 case "sim_location_x":
1075 RegionLocX = (uint) configuration_result;
1076 break;
1077 case "sim_location_y":
1078 RegionLocY = (uint) configuration_result;
1079 break;
1080 case "sim_size_x":
1081 RegionSizeX = (uint) configuration_result;
1082 break;
1083 case "sim_size_y":
1084 RegionSizeY = (uint) configuration_result;
1085 break;
1086 case "sim_size_z":
1087 RegionSizeZ = (uint) configuration_result;
1088 break;
1089 case "datastore":
1090 DataStore = (string) configuration_result;
1091 break;
1092 case "internal_ip_address":
1093 IPAddress address = (IPAddress) configuration_result;
1094 m_internalEndPoint = new IPEndPoint(address, 0);
1095 break;
1096 case "internal_ip_port":
1097 m_internalEndPoint.Port = (int) configuration_result;
1098 break;
1099 case "allow_alternate_ports":
1100 m_allow_alternate_ports = (bool) configuration_result;
1101 break;
1102 case "external_host_name":
1103 if ((string) configuration_result != "SYSTEMIP")
1104 {
1105 m_externalHostName = (string) configuration_result;
1106 }
1107 else
1108 {
1109 m_externalHostName = Util.GetLocalHost().ToString();
1110 }
1111 break;
1112 case "lastmap_uuid":
1113 lastMapUUID = (UUID)configuration_result;
1114 break;
1115 case "lastmap_refresh":
1116 lastMapRefresh = (string)configuration_result;
1117 break;
1118 case "nonphysical_prim_max":
1119 m_nonphysPrimMax = (int)configuration_result;
1120 break;
1121 case "physical_prim_max":
1122 m_physPrimMax = (int)configuration_result;
1123 break;
1124 case "clamp_prim_size":
1125 m_clampPrimSize = (bool)configuration_result;
1126 break;
1127 case "object_capacity":
1128 m_objectCapacity = (int)configuration_result;
1129 break;
1130 case "linkset_capacity":
1131 m_linksetCapacity = (int)configuration_result;
1132 break;
1133 case "agent_capacity":
1134 m_agentCapacity = (int)configuration_result;
1135 break;
1136 case "scope_id":
1137 ScopeID = (UUID)configuration_result;
1138 break;
1139 case "region_type":
1140 m_regionType = (string)configuration_result;
1141 break;
1142 case "region_static_maptile":
1143 m_maptileStaticUUID = (UUID)configuration_result;
1144 break;
1145 }
1146
1147 return true;
1148 }
1149
1150>>>>>>> avn/ubitvar
904 public void SaveLastMapUUID(UUID mapUUID) 1151 public void SaveLastMapUUID(UUID mapUUID)
905 { 1152 {
906 lastMapUUID = mapUUID; 1153 lastMapUUID = mapUUID;
@@ -1004,5 +1251,28 @@ namespace OpenSim.Framework
1004 regionInfo.ServerURI = serverURI; 1251 regionInfo.ServerURI = serverURI;
1005 return regionInfo; 1252 return regionInfo;
1006 } 1253 }
1254
1255 public int getInternalEndPointPort()
1256 {
1257 return m_internalEndPoint.Port;
1258 }
1259
1260 public Dictionary<string, object> ToKeyValuePairs()
1261 {
1262 Dictionary<string, object> kvp = new Dictionary<string, object>();
1263 kvp["uuid"] = RegionID.ToString();
1264 kvp["locX"] = RegionLocX.ToString();
1265 kvp["locY"] = RegionLocY.ToString();
1266 kvp["external_ip_address"] = ExternalEndPoint.Address.ToString();
1267 kvp["external_port"] = ExternalEndPoint.Port.ToString();
1268 kvp["external_host_name"] = ExternalHostName;
1269 kvp["http_port"] = HttpPort.ToString();
1270 kvp["internal_ip_address"] = InternalEndPoint.Address.ToString();
1271 kvp["internal_port"] = InternalEndPoint.Port.ToString();
1272 kvp["alternate_ports"] = m_allow_alternate_ports.ToString();
1273 kvp["server_uri"] = ServerURI;
1274
1275 return kvp;
1276 }
1007 } 1277 }
1008} 1278}
diff --git a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs b/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs
index f60bb12..487c087 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,34 +69,59 @@ namespace OpenSim.Framework.RegionLoader.Web
66 } 69 }
67 else 70 else
68 { 71 {
69 RegionInfo[] regionInfos = new RegionInfo[] {}; 72 while(tries > 0)
70 int regionCount = 0; 73 {
71 HttpWebRequest webRequest = (HttpWebRequest) WebRequest.Create(url); 74 RegionInfo[] regionInfos = new RegionInfo[] {};
72 webRequest.Timeout = 30000; //30 Second Timeout 75 int regionCount = 0;
73 m_log.DebugFormat("[WEBLOADER]: Sending download request to {0}", url); 76 HttpWebRequest webRequest = (HttpWebRequest) WebRequest.Create(url);
74 77 webRequest.Timeout = 30000; //30 Second Timeout
75 try 78 m_log.DebugFormat("[WEBLOADER]: Sending download request to {0}", url);
76 {
77 string xmlSource = String.Empty;
78
79 using (HttpWebResponse webResponse = (HttpWebResponse) webRequest.GetResponse())
80 {
81 m_log.Debug("[WEBLOADER]: Downloading region information...");
82 79
83 using (Stream s = webResponse.GetResponseStream()) 80 try
81 {
82 HttpWebResponse webResponse = (HttpWebResponse) webRequest.GetResponse();
83 m_log.Debug("[WEBLOADER]: Downloading region information...");
84 StreamReader reader = new StreamReader(webResponse.GetResponseStream());
85 string xmlSource = String.Empty;
86 string tempStr = reader.ReadLine();
87 while (tempStr != null)
88 {
89 xmlSource = xmlSource + tempStr;
90 tempStr = reader.ReadLine();
91 }
92 m_log.Debug("[WEBLOADER]: Done downloading region information from server. Total Bytes: " +
93 xmlSource.Length);
94 XmlDocument xmlDoc = new XmlDocument();
95 xmlDoc.LoadXml(xmlSource);
96 if (xmlDoc.FirstChild.Name == "Nini")
84 { 97 {
85 using (StreamReader reader = new StreamReader(s)) 98 regionCount = xmlDoc.FirstChild.ChildNodes.Count;
86 { 99
87 string tempStr = reader.ReadLine(); 100 if (regionCount > 0)
88 while (tempStr != null) 101 {
89 { 102 regionInfos = new RegionInfo[regionCount];
90 xmlSource = xmlSource + tempStr; 103 int i;
91 tempStr = reader.ReadLine(); 104 for (i = 0; i < xmlDoc.FirstChild.ChildNodes.Count; i++)
92 } 105 {
93 } 106 m_log.Debug(xmlDoc.FirstChild.ChildNodes[i].OuterXml);
94 } 107 regionInfos[i] =
95 } 108 new RegionInfo("REGION CONFIG #" + (i + 1), xmlDoc.FirstChild.ChildNodes[i],false,m_configSource);
109 }
110 }
111 }
112 }
113 catch (WebException ex)
114 {
115 if (((HttpWebResponse)ex.Response).StatusCode == HttpStatusCode.NotFound)
116 {
117 if (!allowRegionless)
118 throw ex;
119 }
120 else
121 throw ex;
122 }
96 123
124<<<<<<< HEAD
97 m_log.Debug("[WEBLOADER]: Done downloading region information from server. Total Bytes: " + 125 m_log.Debug("[WEBLOADER]: Done downloading region information from server. Total Bytes: " +
98 xmlSource.Length); 126 xmlSource.Length);
99 XmlDocument xmlDoc = new XmlDocument(); 127 XmlDocument xmlDoc = new XmlDocument();
@@ -118,28 +146,22 @@ namespace OpenSim.Framework.RegionLoader.Web
118 catch (WebException ex) 146 catch (WebException ex)
119 { 147 {
120 using (HttpWebResponse response = (HttpWebResponse)ex.Response) 148 using (HttpWebResponse response = (HttpWebResponse)ex.Response)
149=======
150 if (regionCount > 0 | allowRegionless)
151 return regionInfos;
152
153 m_log.Debug("[WEBLOADER]: Request yielded no regions.");
154 tries--;
155 if (tries > 0)
156>>>>>>> avn/ubitvar
121 { 157 {
122 if (response.StatusCode == HttpStatusCode.NotFound) 158 m_log.Debug("[WEBLOADER]: Retrying");
123 { 159 System.Threading.Thread.Sleep(wait);
124 if (!allowRegionless)
125 throw ex;
126 }
127 else
128 {
129 throw ex;
130 }
131 } 160 }
132 } 161 }
133 162
134 if (regionCount > 0 | allowRegionless) 163 m_log.Error("[WEBLOADER]: No region configs were available.");
135 { 164 return null;
136 return regionInfos;
137 }
138 else
139 {
140 m_log.Error("[WEBLOADER]: No region configs were available.");
141 return null;
142 }
143 } 165 }
144 } 166 }
145 } 167 }
diff --git a/OpenSim/Framework/RegionSettings.cs b/OpenSim/Framework/RegionSettings.cs
index a895c40..dec01ea 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 /// <summary> 507 /// <summary>
486 /// Connected Telehub object 508 /// Connected Telehub object
487 /// </summary> 509 /// </summary>
@@ -520,4 +542,4 @@ namespace OpenSim.Framework
520 l_SpawnPoints.Clear(); 542 l_SpawnPoints.Clear();
521 } 543 }
522 } 544 }
523} \ No newline at end of file 545}
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
index 828a852..60702d4 100644
--- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs
+++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
@@ -65,8 +65,12 @@ namespace OpenSim.Framework.Servers
65 /// This will control a periodic log printout of the current 'show stats' (if they are active) for this 65 /// This will control a periodic log printout of the current 'show stats' (if they are active) for this
66 /// server. 66 /// server.
67 /// </summary> 67 /// </summary>
68<<<<<<< HEAD
68 private int m_periodDiagnosticTimerMS = 60 * 60 * 1000; 69 private int m_periodDiagnosticTimerMS = 60 * 60 * 1000;
69 private Timer m_periodicDiagnosticsTimer = new Timer(60 * 60 * 1000); 70 private Timer m_periodicDiagnosticsTimer = new Timer(60 * 60 * 1000);
71=======
72// private Timer m_periodicDiagnosticsTimer = new Timer(60 * 60 * 1000);
73>>>>>>> avn/ubitvar
70 74
71 /// <summary> 75 /// <summary>
72 /// Random uuid for private data 76 /// Random uuid for private data
@@ -84,6 +88,11 @@ namespace OpenSim.Framework.Servers
84 // Random uuid for private data 88 // Random uuid for private data
85 m_osSecret = UUID.Random().ToString(); 89 m_osSecret = UUID.Random().ToString();
86 90
91<<<<<<< HEAD
92=======
93// m_periodicDiagnosticsTimer.Elapsed += new ElapsedEventHandler(LogDiagnostics);
94// m_periodicDiagnosticsTimer.Enabled = true;
95>>>>>>> avn/ubitvar
87 } 96 }
88 97
89 /// <summary> 98 /// <summary>
@@ -146,14 +155,24 @@ namespace OpenSim.Framework.Servers
146 /// Performs initialisation of the scene, such as loading configuration from disk. 155 /// Performs initialisation of the scene, such as loading configuration from disk.
147 /// </summary> 156 /// </summary>
148 public virtual void Startup() 157 public virtual void Startup()
149 { 158 {
159 m_log.Info("[STARTUP]: Beginning startup processing");
160
161 m_log.Info("[STARTUP]: Careminster version: " + m_version + Environment.NewLine);
162 // clr version potentially is more confusing than helpful, since it doesn't tell us if we're running under Mono/MS .NET and
163 // the clr version number doesn't match the project version number under Mono.
164 //m_log.Info("[STARTUP]: Virtual machine runtime version: " + Environment.Version + Environment.NewLine);
165 m_log.InfoFormat(
166 "[STARTUP]: Operating system version: {0}, .NET platform {1}, {2}-bit\n",
167 Environment.OSVersion, Environment.OSVersion.Platform, Util.Is64BitProcess() ? "64" : "32");
168
150 StartupSpecific(); 169 StartupSpecific();
151 170
152 TimeSpan timeTaken = DateTime.Now - m_startuptime; 171 TimeSpan timeTaken = DateTime.Now - m_startuptime;
153 172
154 MainConsole.Instance.OutputFormat( 173// MainConsole.Instance.OutputFormat(
155 "PLEASE WAIT FOR LOGINS TO BE ENABLED ON REGIONS ONCE SCRIPTS HAVE STARTED. Non-script portion of startup took {0}m {1}s.", 174// "PLEASE WAIT FOR LOGINS TO BE ENABLED ON REGIONS ONCE SCRIPTS HAVE STARTED. Non-script portion of startup took {0}m {1}s.",
156 timeTaken.Minutes, timeTaken.Seconds); 175// timeTaken.Minutes, timeTaken.Seconds);
157 } 176 }
158 177
159 public string osSecret 178 public string osSecret
@@ -175,4 +194,4 @@ namespace OpenSim.Framework.Servers
175 } 194 }
176 } 195 }
177 } 196 }
178} \ No newline at end of file 197}
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
index f252bd5..616c673 100644
--- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
@@ -403,6 +403,7 @@ namespace OpenSim.Framework.Servers.HttpServer
403 StreamReader reader = new StreamReader(requestStream, encoding); 403 StreamReader reader = new StreamReader(requestStream, encoding);
404 404
405 string requestBody = reader.ReadToEnd(); 405 string requestBody = reader.ReadToEnd();
406 reader.Close();
406 407
407 Hashtable keysvals = new Hashtable(); 408 Hashtable keysvals = new Hashtable();
408 Hashtable headervals = new Hashtable(); 409 Hashtable headervals = new Hashtable();
@@ -460,7 +461,7 @@ namespace OpenSim.Framework.Servers.HttpServer
460 } 461 }
461 462
462 OSHttpResponse resp = new OSHttpResponse(new HttpResponse(context, request),context); 463 OSHttpResponse resp = new OSHttpResponse(new HttpResponse(context, request),context);
463 resp.ReuseContext = true; 464 resp.ReuseContext = false;
464 HandleRequest(req, resp); 465 HandleRequest(req, resp);
465 466
466 // !!!HACK ALERT!!! 467 // !!!HACK ALERT!!!
@@ -759,7 +760,7 @@ namespace OpenSim.Framework.Servers.HttpServer
759 // Every month or so this will wrap and give bad numbers, not really a problem 760 // Every month or so this will wrap and give bad numbers, not really a problem
760 // since its just for reporting 761 // since its just for reporting
761 int tickdiff = requestEndTick - requestStartTick; 762 int tickdiff = requestEndTick - requestStartTick;
762 if (tickdiff > 3000 && requestHandler != null && requestHandler.Name != "GetTexture") 763 if (tickdiff > 3000 && (requestHandler == null || requestHandler.Name == null || requestHandler.Name != "GetTexture"))
763 { 764 {
764 m_log.InfoFormat( 765 m_log.InfoFormat(
765 "[LOGHTTP] Slow handling of {0} {1} {2} {3} {4} from {5} took {6}ms", 766 "[LOGHTTP] Slow handling of {0} {1} {2} {3} {4} from {5} took {6}ms",
@@ -1024,6 +1025,19 @@ namespace OpenSim.Framework.Servers.HttpServer
1024 string responseString = String.Empty; 1025 string responseString = String.Empty;
1025 XmlRpcRequest xmlRprcRequest = null; 1026 XmlRpcRequest xmlRprcRequest = null;
1026 1027
1028 bool gridproxy = false;
1029 if (requestBody.Contains("encoding=\"utf-8"))
1030 {
1031 int channelindx = -1;
1032 int optionsindx = requestBody.IndexOf(">options<");
1033 if(optionsindx >0)
1034 {
1035 channelindx = requestBody.IndexOf(">channel<");
1036 if (optionsindx < channelindx)
1037 gridproxy = true;
1038 }
1039 }
1040
1027 try 1041 try
1028 { 1042 {
1029 xmlRprcRequest = (XmlRpcRequest) (new XmlRpcRequestDeserializer()).Deserialize(requestBody); 1043 xmlRprcRequest = (XmlRpcRequest) (new XmlRpcRequestDeserializer()).Deserialize(requestBody);
@@ -1081,6 +1095,8 @@ namespace OpenSim.Framework.Servers.HttpServer
1081 } 1095 }
1082 xmlRprcRequest.Params.Add(request.Headers.Get(xff)); // Param[3] 1096 xmlRprcRequest.Params.Add(request.Headers.Get(xff)); // Param[3]
1083 1097
1098 if (gridproxy)
1099 xmlRprcRequest.Params.Add("gridproxy"); // Param[4]
1084 try 1100 try
1085 { 1101 {
1086 xmlRpcResponse = method(xmlRprcRequest, request.RemoteIPEndPoint); 1102 xmlRpcResponse = method(xmlRprcRequest, request.RemoteIPEndPoint);
@@ -1732,10 +1748,40 @@ namespace OpenSim.Framework.Servers.HttpServer
1732 1748
1733 internal byte[] DoHTTPGruntWork(Hashtable responsedata, OSHttpResponse response) 1749 internal byte[] DoHTTPGruntWork(Hashtable responsedata, OSHttpResponse response)
1734 { 1750 {
1735 //m_log.Info("[BASE HTTP SERVER]: Doing HTTP Grunt work with response"); 1751 int responsecode;
1736 int responsecode = (int)responsedata["int_response_code"]; 1752 string responseString = String.Empty;
1737 string responseString = (string)responsedata["str_response_string"]; 1753 byte[] responseData = null;
1738 string contentType = (string)responsedata["content_type"]; 1754 string contentType;
1755
1756 if (responsedata == null)
1757 {
1758 responsecode = 500;
1759 responseString = "No response could be obtained";
1760 contentType = "text/plain";
1761 responsedata = new Hashtable();
1762 }
1763 else
1764 {
1765 try
1766 {
1767 //m_log.Info("[BASE HTTP SERVER]: Doing HTTP Grunt work with response");
1768 responsecode = (int)responsedata["int_response_code"];
1769 if (responsedata["bin_response_data"] != null)
1770 responseData = (byte[])responsedata["bin_response_data"];
1771 else
1772 responseString = (string)responsedata["str_response_string"];
1773 contentType = (string)responsedata["content_type"];
1774 if (responseString == null)
1775 responseString = String.Empty;
1776 }
1777 catch
1778 {
1779 responsecode = 500;
1780 responseString = "No response could be obtained";
1781 contentType = "text/plain";
1782 responsedata = new Hashtable();
1783 }
1784 }
1739 1785
1740 if (responsedata.ContainsKey("error_status_text")) 1786 if (responsedata.ContainsKey("error_status_text"))
1741 { 1787 {
@@ -1780,25 +1826,40 @@ namespace OpenSim.Framework.Servers.HttpServer
1780 1826
1781 response.AddHeader("Content-Type", contentType); 1827 response.AddHeader("Content-Type", contentType);
1782 1828
1829 if (responsedata.ContainsKey("headers"))
1830 {
1831 Hashtable headerdata = (Hashtable)responsedata["headers"];
1832
1833 foreach (string header in headerdata.Keys)
1834 response.AddHeader(header, (string)headerdata[header]);
1835 }
1836
1783 byte[] buffer; 1837 byte[] buffer;
1784 1838
1785 if (!(contentType.Contains("image") 1839 if (responseData != null)
1786 || contentType.Contains("x-shockwave-flash")
1787 || contentType.Contains("application/x-oar")
1788 || contentType.Contains("application/vnd.ll.mesh")))
1789 { 1840 {
1790 // Text 1841 buffer = responseData;
1791 buffer = Encoding.UTF8.GetBytes(responseString);
1792 } 1842 }
1793 else 1843 else
1794 { 1844 {
1795 // Binary! 1845 if (!(contentType.Contains("image")
1796 buffer = Convert.FromBase64String(responseString); 1846 || contentType.Contains("x-shockwave-flash")
1797 } 1847 || contentType.Contains("application/x-oar")
1848 || contentType.Contains("application/vnd.ll.mesh")))
1849 {
1850 // Text
1851 buffer = Encoding.UTF8.GetBytes(responseString);
1852 }
1853 else
1854 {
1855 // Binary!
1856 buffer = Convert.FromBase64String(responseString);
1857 }
1798 1858
1799 response.SendChunked = false; 1859 response.SendChunked = false;
1800 response.ContentLength64 = buffer.Length; 1860 response.ContentLength64 = buffer.Length;
1801 response.ContentEncoding = Encoding.UTF8; 1861 response.ContentEncoding = Encoding.UTF8;
1862 }
1802 1863
1803 return buffer; 1864 return buffer;
1804 } 1865 }
@@ -1886,9 +1947,14 @@ namespace OpenSim.Framework.Servers.HttpServer
1886 m_httpListener2.Start(64); 1947 m_httpListener2.Start(64);
1887 1948
1888 // Long Poll Service Manager with 3 worker threads a 25 second timeout for no events 1949 // Long Poll Service Manager with 3 worker threads a 25 second timeout for no events
1950<<<<<<< HEAD
1889 PollServiceRequestManager = new PollServiceRequestManager(this, performPollResponsesAsync, 3, 25000); 1951 PollServiceRequestManager = new PollServiceRequestManager(this, performPollResponsesAsync, 3, 25000);
1890 PollServiceRequestManager.Start(); 1952 PollServiceRequestManager.Start();
1891 1953
1954=======
1955 m_PollServiceManager = new PollServiceRequestManager(this, 4, 25000);
1956 m_PollServiceManager.Start();
1957>>>>>>> avn/ubitvar
1892 HTTPDRunning = true; 1958 HTTPDRunning = true;
1893 1959
1894 //HttpListenerContext context; 1960 //HttpListenerContext context;
@@ -1937,7 +2003,9 @@ namespace OpenSim.Framework.Servers.HttpServer
1937 2003
1938 public void httpServerException(object source, Exception exception) 2004 public void httpServerException(object source, Exception exception)
1939 { 2005 {
1940 m_log.Error(String.Format("[BASE HTTP SERVER]: {0} had an exception: {1} ", source.ToString(), exception.Message), exception); 2006 if (source.ToString() == "HttpServer.HttpListener" && exception.ToString().StartsWith("Mono.Security.Protocol.Tls.TlsException"))
2007 return;
2008 m_log.ErrorFormat("[BASE HTTP SERVER]: {0} had an exception {1}", source.ToString(), exception.ToString());
1941 /* 2009 /*
1942 if (HTTPDRunning)// && NotSocketErrors > 5) 2010 if (HTTPDRunning)// && NotSocketErrors > 5)
1943 { 2011 {
@@ -1984,6 +2052,7 @@ namespace OpenSim.Framework.Servers.HttpServer
1984 2052
1985 public void RemoveHTTPHandler(string httpMethod, string path) 2053 public void RemoveHTTPHandler(string httpMethod, string path)
1986 { 2054 {
2055 if (path == null) return; // Caps module isn't loaded, tries to remove handler where path = null
1987 lock (m_HTTPHandlers) 2056 lock (m_HTTPHandlers)
1988 { 2057 {
1989 if (httpMethod != null && httpMethod.Length == 0) 2058 if (httpMethod != null && httpMethod.Length == 0)
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs
index 9477100..3fd3bf7 100644
--- a/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs
+++ b/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs
@@ -52,7 +52,9 @@ namespace OpenSim.Framework.Servers.HttpServer
52 { 52 {
53 LongPoll = 0, 53 LongPoll = 0,
54 LslHttp = 1, 54 LslHttp = 1,
55 Inventory = 2 55 Inventory = 2,
56 Texture = 3,
57 Mesh = 4
56 } 58 }
57 59
58 public string Url { get; set; } 60 public string Url { get; set; }
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs
index caf0e98..49cd110 100644
--- a/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs
+++ b/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs
@@ -27,6 +27,7 @@
27 27
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic;
30using System.Reflection; 31using System.Reflection;
31using System.Text; 32using System.Text;
32using HttpServer; 33using HttpServer;
@@ -44,6 +45,24 @@ namespace OpenSim.Framework.Servers.HttpServer
44 public readonly IHttpRequest Request; 45 public readonly IHttpRequest Request;
45 public readonly int RequestTime; 46 public readonly int RequestTime;
46 public readonly UUID RequestID; 47 public readonly UUID RequestID;
48 public int contextHash;
49
50 private void GenContextHash()
51 {
52 Random rnd = new Random();
53 contextHash = 0;
54 if (Request.Headers["remote_addr"] != null)
55 contextHash = (Request.Headers["remote_addr"]).GetHashCode() << 16;
56 else
57 contextHash = rnd.Next() << 16;
58 if (Request.Headers["remote_port"] != null)
59 {
60 string[] strPorts = Request.Headers["remote_port"].Split(new char[] { ',' });
61 contextHash += Int32.Parse(strPorts[0]);
62 }
63 else
64 contextHash += rnd.Next() & 0xffff;
65 }
47 66
48 public PollServiceHttpRequest( 67 public PollServiceHttpRequest(
49 PollServiceEventArgs pPollServiceArgs, IHttpClientContext pHttpContext, IHttpRequest pRequest) 68 PollServiceEventArgs pPollServiceArgs, IHttpClientContext pHttpContext, IHttpRequest pRequest)
@@ -53,6 +72,7 @@ namespace OpenSim.Framework.Servers.HttpServer
53 Request = pRequest; 72 Request = pRequest;
54 RequestTime = System.Environment.TickCount; 73 RequestTime = System.Environment.TickCount;
55 RequestID = UUID.Random(); 74 RequestID = UUID.Random();
75 GenContextHash();
56 } 76 }
57 77
58 internal void DoHTTPGruntWork(BaseHttpServer server, Hashtable responsedata) 78 internal void DoHTTPGruntWork(BaseHttpServer server, Hashtable responsedata)
@@ -65,6 +85,7 @@ namespace OpenSim.Framework.Servers.HttpServer
65 response.SendChunked = false; 85 response.SendChunked = false;
66 response.ContentLength64 = buffer.Length; 86 response.ContentLength64 = buffer.Length;
67 response.ContentEncoding = Encoding.UTF8; 87 response.ContentEncoding = Encoding.UTF8;
88 response.ReuseContext = false;
68 89
69 try 90 try
70 { 91 {
@@ -93,5 +114,44 @@ namespace OpenSim.Framework.Servers.HttpServer
93 PollServiceArgs.RequestsHandled++; 114 PollServiceArgs.RequestsHandled++;
94 } 115 }
95 } 116 }
117
118 internal void DoHTTPstop(BaseHttpServer server)
119 {
120 OSHttpResponse response
121 = new OSHttpResponse(new HttpResponse(HttpContext, Request), HttpContext);
122
123 response.SendChunked = false;
124 response.ContentLength64 = 0;
125 response.ContentEncoding = Encoding.UTF8;
126 response.ReuseContext = false;
127 response.KeepAlive = false;
128 response.SendChunked = false;
129 response.StatusCode = 503;
130
131 try
132 {
133 response.OutputStream.Flush();
134 response.Send();
135 }
136 catch (Exception e)
137 {
138 }
139 }
140 }
141
142 class PollServiceHttpRequestComparer : IEqualityComparer<PollServiceHttpRequest>
143 {
144 public bool Equals(PollServiceHttpRequest b1, PollServiceHttpRequest b2)
145 {
146 if (b1.contextHash != b2.contextHash)
147 return false;
148 bool b = Object.ReferenceEquals(b1.HttpContext, b2.HttpContext);
149 return b;
150 }
151
152 public int GetHashCode(PollServiceHttpRequest b2)
153 {
154 return (int)b2.contextHash;
155 }
96 } 156 }
97} \ No newline at end of file 157} \ No newline at end of file
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
index 28bba70..4ffe6e5 100644
--- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
+++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
@@ -65,15 +65,25 @@ namespace OpenSim.Framework.Servers.HttpServer
65 65
66 private readonly BaseHttpServer m_server; 66 private readonly BaseHttpServer m_server;
67 67
68 private Dictionary<PollServiceHttpRequest, Queue<PollServiceHttpRequest>> m_bycontext;
68 private BlockingQueue<PollServiceHttpRequest> m_requests = new BlockingQueue<PollServiceHttpRequest>(); 69 private BlockingQueue<PollServiceHttpRequest> m_requests = new BlockingQueue<PollServiceHttpRequest>();
69 private static List<PollServiceHttpRequest> m_longPollRequests = new List<PollServiceHttpRequest>(); 70 private static Queue<PollServiceHttpRequest> m_slowRequests = new Queue<PollServiceHttpRequest>();
71 private static Queue<PollServiceHttpRequest> m_retryRequests = new Queue<PollServiceHttpRequest>();
70 72
71 private uint m_WorkerThreadCount = 0; 73 private uint m_WorkerThreadCount = 0;
72 private Thread[] m_workerThreads; 74 private Thread[] m_workerThreads;
75 private Thread m_retrysThread;
73 76
77<<<<<<< HEAD
74 private SmartThreadPool m_threadPool = new SmartThreadPool(20000, 12, 2); 78 private SmartThreadPool m_threadPool = new SmartThreadPool(20000, 12, 2);
75 79
76// private int m_timeout = 1000; // increase timeout 250; now use the event one 80// private int m_timeout = 1000; // increase timeout 250; now use the event one
81=======
82 private bool m_running = true;
83 private int slowCount = 0;
84
85 private SmartThreadPool m_threadPool;
86>>>>>>> avn/ubitvar
77 87
78 public PollServiceRequestManager( 88 public PollServiceRequestManager(
79 BaseHttpServer pSrv, bool performResponsesAsync, uint pWorkerThreadCount, int pTimeout) 89 BaseHttpServer pSrv, bool performResponsesAsync, uint pWorkerThreadCount, int pTimeout)
@@ -83,6 +93,7 @@ namespace OpenSim.Framework.Servers.HttpServer
83 m_WorkerThreadCount = pWorkerThreadCount; 93 m_WorkerThreadCount = pWorkerThreadCount;
84 m_workerThreads = new Thread[m_WorkerThreadCount]; 94 m_workerThreads = new Thread[m_WorkerThreadCount];
85 95
96<<<<<<< HEAD
86 StatsManager.RegisterStat( 97 StatsManager.RegisterStat(
87 new Stat( 98 new Stat(
88 "QueuedPollResponses", 99 "QueuedPollResponses",
@@ -108,10 +119,25 @@ namespace OpenSim.Framework.Servers.HttpServer
108 MeasuresOfInterest.AverageChangeOverTime, 119 MeasuresOfInterest.AverageChangeOverTime,
109 stat => stat.Value = ResponsesProcessed, 120 stat => stat.Value = ResponsesProcessed,
110 StatVerbosity.Debug)); 121 StatVerbosity.Debug));
122=======
123 PollServiceHttpRequestComparer preqCp = new PollServiceHttpRequestComparer();
124 m_bycontext = new Dictionary<PollServiceHttpRequest, Queue<PollServiceHttpRequest>>(preqCp);
125
126 STPStartInfo startInfo = new STPStartInfo();
127 startInfo.IdleTimeout = 30000;
128 startInfo.MaxWorkerThreads = 15;
129 startInfo.MinWorkerThreads = 1;
130 startInfo.ThreadPriority = ThreadPriority.Normal;
131 startInfo.StartSuspended = true;
132 startInfo.ThreadPoolName = "PoolService";
133
134 m_threadPool = new SmartThreadPool(startInfo);
135>>>>>>> avn/ubitvar
111 } 136 }
112 137
113 public void Start() 138 public void Start()
114 { 139 {
140<<<<<<< HEAD
115 IsRunning = true; 141 IsRunning = true;
116 142
117 if (PerformResponsesAsync) 143 if (PerformResponsesAsync)
@@ -139,40 +165,100 @@ namespace OpenSim.Framework.Servers.HttpServer
139 null, 165 null,
140 1000 * 60 * 10); 166 1000 * 60 * 10);
141 } 167 }
168=======
169 m_threadPool.Start();
170 //startup worker threads
171 for (uint i = 0; i < m_WorkerThreadCount; i++)
172 {
173 m_workerThreads[i]
174 = Watchdog.StartThread(
175 PoolWorkerJob,
176 string.Format("PollServiceWorkerThread {0}:{1}", i, m_server.Port),
177 ThreadPriority.Normal,
178 false,
179 false,
180 null,
181 int.MaxValue);
182 }
183
184 m_retrysThread = Watchdog.StartThread(
185 this.CheckRetries,
186 string.Format("PollServiceWatcherThread:{0}", m_server.Port),
187 ThreadPriority.Normal,
188 false,
189 true,
190 null,
191 1000 * 60 * 10);
192>>>>>>> avn/ubitvar
142 } 193 }
143 194
144 private void ReQueueEvent(PollServiceHttpRequest req) 195 private void ReQueueEvent(PollServiceHttpRequest req)
145 { 196 {
146 if (IsRunning) 197 if (IsRunning)
147 { 198 {
148 // delay the enqueueing for 100ms. There's no need to have the event 199 lock (m_retryRequests)
149 // actively on the queue 200 m_retryRequests.Enqueue(req);
150 Timer t = new Timer(self => { 201 }
151 ((Timer)self).Dispose(); 202 }
152 m_requests.Enqueue(req);
153 });
154 203
155 t.Change(100, Timeout.Infinite); 204 public void Enqueue(PollServiceHttpRequest req)
205 {
206 lock (m_bycontext)
207 {
208 Queue<PollServiceHttpRequest> ctxQeueue;
209 if (m_bycontext.TryGetValue(req, out ctxQeueue))
210 {
211 ctxQeueue.Enqueue(req);
212 }
213 else
214 {
215 ctxQeueue = new Queue<PollServiceHttpRequest>();
216 m_bycontext[req] = ctxQeueue;
217 EnqueueInt(req);
218 }
219 }
220 }
156 221
222 public void byContextDequeue(PollServiceHttpRequest req)
223 {
224 Queue<PollServiceHttpRequest> ctxQeueue;
225 lock (m_bycontext)
226 {
227 if (m_bycontext.TryGetValue(req, out ctxQeueue))
228 {
229 if (ctxQeueue.Count > 0)
230 {
231 PollServiceHttpRequest newreq = ctxQeueue.Dequeue();
232 EnqueueInt(newreq);
233 }
234 else
235 {
236 m_bycontext.Remove(req);
237 }
238 }
157 } 239 }
158 } 240 }
159 241
160 public void Enqueue(PollServiceHttpRequest req) 242
243 public void EnqueueInt(PollServiceHttpRequest req)
161 { 244 {
162 if (IsRunning) 245 if (IsRunning)
163 { 246 {
164 if (req.PollServiceArgs.Type == PollServiceEventArgs.EventType.LongPoll) 247 if (req.PollServiceArgs.Type != PollServiceEventArgs.EventType.LongPoll)
165 { 248 {
166 lock (m_longPollRequests) 249 m_requests.Enqueue(req);
167 m_longPollRequests.Add(req);
168 } 250 }
169 else 251 else
170 m_requests.Enqueue(req); 252 {
253 lock (m_slowRequests)
254 m_slowRequests.Enqueue(req);
255 }
171 } 256 }
172 } 257 }
173 258
174 private void CheckLongPollThreads() 259 private void CheckRetries()
175 { 260 {
261<<<<<<< HEAD
176 // The only purpose of this thread is to check the EQs for events. 262 // The only purpose of this thread is to check the EQs for events.
177 // If there are events, that thread will be placed in the "ready-to-serve" queue, m_requests. 263 // If there are events, that thread will be placed in the "ready-to-serve" queue, m_requests.
178 // If there are no events, that thread will be back to its "waiting" queue, m_longPollRequests. 264 // If there are no events, that thread will be back to its "waiting" queue, m_longPollRequests.
@@ -180,13 +266,15 @@ namespace OpenSim.Framework.Servers.HttpServer
180 // so if they aren't ready to be served by a worker thread (no events), they are placed 266 // so if they aren't ready to be served by a worker thread (no events), they are placed
181 // directly back in the "ready-to-serve" queue by the worker thread. 267 // directly back in the "ready-to-serve" queue by the worker thread.
182 while (IsRunning) 268 while (IsRunning)
269=======
270 while (m_running)
271>>>>>>> avn/ubitvar
183 { 272 {
184 Thread.Sleep(500); 273 Thread.Sleep(100); // let the world move .. back to faster rate
185 Watchdog.UpdateThread(); 274 Watchdog.UpdateThread();
186 275 lock (m_retryRequests)
187// List<PollServiceHttpRequest> not_ready = new List<PollServiceHttpRequest>();
188 lock (m_longPollRequests)
189 { 276 {
277<<<<<<< HEAD
190 if (m_longPollRequests.Count > 0 && IsRunning) 278 if (m_longPollRequests.Count > 0 && IsRunning)
191 { 279 {
192 List<PollServiceHttpRequest> ready = m_longPollRequests.FindAll(req => 280 List<PollServiceHttpRequest> ready = m_longPollRequests.FindAll(req =>
@@ -199,28 +287,67 @@ namespace OpenSim.Framework.Servers.HttpServer
199 m_requests.Enqueue(req); 287 m_requests.Enqueue(req);
200 m_longPollRequests.Remove(req); 288 m_longPollRequests.Remove(req);
201 }); 289 });
290=======
291 while (m_retryRequests.Count > 0 && m_running)
292 m_requests.Enqueue(m_retryRequests.Dequeue());
293 }
294 slowCount++;
295 if (slowCount >= 10)
296 {
297 slowCount = 0;
298>>>>>>> avn/ubitvar
202 299
300 lock (m_slowRequests)
301 {
302 while (m_slowRequests.Count > 0 && m_running)
303 m_requests.Enqueue(m_slowRequests.Dequeue());
203 } 304 }
204
205 } 305 }
206 } 306 }
207 } 307 }
208 308
209 public void Stop() 309 public void Stop()
210 { 310 {
311<<<<<<< HEAD
211 IsRunning = false; 312 IsRunning = false;
212// m_timeout = -10000; // cause all to expire 313// m_timeout = -10000; // cause all to expire
314=======
315 m_running = false;
316>>>>>>> avn/ubitvar
213 Thread.Sleep(1000); // let the world move 317 Thread.Sleep(1000); // let the world move
214 318
215 foreach (Thread t in m_workerThreads) 319 foreach (Thread t in m_workerThreads)
216 Watchdog.AbortThread(t.ManagedThreadId); 320 Watchdog.AbortThread(t.ManagedThreadId);
217 321
322 // any entry in m_bycontext should have a active request on the other queues
323 // so just delete contents to easy GC
324 foreach (Queue<PollServiceHttpRequest> qu in m_bycontext.Values)
325 qu.Clear();
326 m_bycontext.Clear();
327
328 try
329 {
330 foreach (PollServiceHttpRequest req in m_retryRequests)
331 {
332 req.DoHTTPstop(m_server);
333 }
334 }
335 catch
336 {
337 }
338
218 PollServiceHttpRequest wreq; 339 PollServiceHttpRequest wreq;
340 m_retryRequests.Clear();
219 341
220 lock (m_longPollRequests) 342 lock (m_slowRequests)
221 { 343 {
344<<<<<<< HEAD
222 if (m_longPollRequests.Count > 0 && IsRunning) 345 if (m_longPollRequests.Count > 0 && IsRunning)
223 m_longPollRequests.ForEach(req => m_requests.Enqueue(req)); 346 m_longPollRequests.ForEach(req => m_requests.Enqueue(req));
347=======
348 while (m_slowRequests.Count > 0)
349 m_requests.Enqueue(m_slowRequests.Dequeue());
350>>>>>>> avn/ubitvar
224 } 351 }
225 352
226 while (m_requests.Count() > 0) 353 while (m_requests.Count() > 0)
@@ -228,16 +355,19 @@ namespace OpenSim.Framework.Servers.HttpServer
228 try 355 try
229 { 356 {
230 wreq = m_requests.Dequeue(0); 357 wreq = m_requests.Dequeue(0);
358<<<<<<< HEAD
231 ResponsesProcessed++; 359 ResponsesProcessed++;
232 wreq.DoHTTPGruntWork( 360 wreq.DoHTTPGruntWork(
233 m_server, wreq.PollServiceArgs.NoEvents(wreq.RequestID, wreq.PollServiceArgs.Id)); 361 m_server, wreq.PollServiceArgs.NoEvents(wreq.RequestID, wreq.PollServiceArgs.Id));
362=======
363 wreq.DoHTTPstop(m_server);
364>>>>>>> avn/ubitvar
234 } 365 }
235 catch 366 catch
236 { 367 {
237 } 368 }
238 } 369 }
239 370
240 m_longPollRequests.Clear();
241 m_requests.Clear(); 371 m_requests.Clear();
242 } 372 }
243 373
@@ -247,6 +377,11 @@ namespace OpenSim.Framework.Servers.HttpServer
247 { 377 {
248 while (IsRunning) 378 while (IsRunning)
249 { 379 {
380<<<<<<< HEAD
381=======
382 PollServiceHttpRequest req = m_requests.Dequeue(5000);
383
384>>>>>>> avn/ubitvar
250 Watchdog.UpdateThread(); 385 Watchdog.UpdateThread();
251 WaitPerformResponse(); 386 WaitPerformResponse();
252 } 387 }
@@ -265,6 +400,7 @@ namespace OpenSim.Framework.Servers.HttpServer
265 { 400 {
266 Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id); 401 Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id);
267 402
403<<<<<<< HEAD
268 if (responsedata == null) 404 if (responsedata == null)
269 return; 405 return;
270 406
@@ -287,11 +423,15 @@ namespace OpenSim.Framework.Servers.HttpServer
287 else 423 else
288 { 424 {
289 m_threadPool.QueueWorkItem(x => 425 m_threadPool.QueueWorkItem(x =>
426=======
427 if (req.PollServiceArgs.Type == PollServiceEventArgs.EventType.LongPoll) // This is the event queue
428>>>>>>> avn/ubitvar
290 { 429 {
291 try 430 try
292 { 431 {
293 ResponsesProcessed++; 432 ResponsesProcessed++;
294 req.DoHTTPGruntWork(m_server, responsedata); 433 req.DoHTTPGruntWork(m_server, responsedata);
434 byContextDequeue(req);
295 } 435 }
296 catch (ObjectDisposedException e) // Browser aborted before we could read body, server closed the stream 436 catch (ObjectDisposedException e) // Browser aborted before we could read body, server closed the stream
297 { 437 {
@@ -300,6 +440,7 @@ namespace OpenSim.Framework.Servers.HttpServer
300 } 440 }
301 catch (Exception e) 441 catch (Exception e)
302 { 442 {
443<<<<<<< HEAD
303 m_log.Error(e); 444 m_log.Error(e);
304 } 445 }
305 446
@@ -318,6 +459,34 @@ namespace OpenSim.Framework.Servers.HttpServer
318 else 459 else
319 { 460 {
320 ReQueueEvent(req); 461 ReQueueEvent(req);
462=======
463 try
464 {
465 req.DoHTTPGruntWork(m_server, responsedata);
466 byContextDequeue(req);
467 }
468 catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream
469 {
470 // Ignore it, no need to reply
471 }
472
473 return null;
474 }, null);
475 }
476 }
477 else
478 {
479 if ((Environment.TickCount - req.RequestTime) > req.PollServiceArgs.TimeOutms)
480 {
481 req.DoHTTPGruntWork(m_server,
482 req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id));
483 byContextDequeue(req);
484 }
485 else
486 {
487 ReQueueEvent(req);
488 }
489>>>>>>> avn/ubitvar
321 } 490 }
322 } 491 }
323 } 492 }
@@ -327,5 +496,7 @@ namespace OpenSim.Framework.Servers.HttpServer
327 } 496 }
328 } 497 }
329 } 498 }
499
330 } 500 }
331} \ No newline at end of file 501}
502
diff --git a/OpenSim/Framework/Servers/ServerBase.cs b/OpenSim/Framework/Servers/ServerBase.cs
index e403ba0..35177f4 100644
--- a/OpenSim/Framework/Servers/ServerBase.cs
+++ b/OpenSim/Framework/Servers/ServerBase.cs
@@ -871,7 +871,7 @@ namespace OpenSim.Framework.Servers
871 } 871 }
872 } 872 }
873 873
874 protected string GetVersionText() 874 public string GetVersionText()
875 { 875 {
876 return String.Format("Version: {0} (interface version {1})", m_version, VersionInfo.MajorInterfaceVersion); 876 return String.Format("Version: {0} (interface version {1})", m_version, VersionInfo.MajorInterfaceVersion);
877 } 877 }
@@ -1044,4 +1044,4 @@ namespace OpenSim.Framework.Servers
1044 /// </summary> 1044 /// </summary>
1045 protected virtual void ShutdownSpecific() {} 1045 protected virtual void ShutdownSpecific() {}
1046 } 1046 }
1047} \ No newline at end of file 1047}
diff --git a/OpenSim/Framework/Servers/Tests/OSHttpTests.cs b/OpenSim/Framework/Servers/Tests/OSHttpTests.cs
index 5c0e0df..e13551c 100644
--- a/OpenSim/Framework/Servers/Tests/OSHttpTests.cs
+++ b/OpenSim/Framework/Servers/Tests/OSHttpTests.cs
@@ -41,7 +41,331 @@ namespace OpenSim.Framework.Servers.Tests
41{ 41{
42 [TestFixture] 42 [TestFixture]
43 public class OSHttpTests : OpenSimTestCase 43 public class OSHttpTests : OpenSimTestCase
44<<<<<<< HEAD
44 { 45 {
46=======
47 {
48 // we need an IHttpClientContext for our tests
49 public class TestHttpClientContext: IHttpClientContext
50 {
51 private bool _secured;
52 public bool IsSecured
53 {
54 get { return _secured; }
55 }
56 public bool Secured
57 {
58 get { return _secured; }
59 }
60
61 public TestHttpClientContext(bool secured)
62 {
63 _secured = secured;
64 }
65
66 public void Disconnect(SocketError error) {}
67 public void Respond(string httpVersion, HttpStatusCode statusCode, string reason, string body) {}
68 public void Respond(string httpVersion, HttpStatusCode statusCode, string reason) {}
69 public void Respond(string body) {}
70 public void Send(byte[] buffer) {}
71 public void Send(byte[] buffer, int offset, int size) {}
72 public void Respond(string httpVersion, HttpStatusCode statusCode, string reason, string body, string contentType) {}
73 public void Close() { }
74 public bool EndWhenDone { get { return false;} set { return;}}
75
76 public HTTPNetworkContext GiveMeTheNetworkStreamIKnowWhatImDoing()
77 {
78 return new HTTPNetworkContext();
79 }
80
81 public event EventHandler<DisconnectedEventArgs> Disconnected = delegate { };
82 /// <summary>
83 /// A request have been received in the context.
84 /// </summary>
85 public event EventHandler<RequestEventArgs> RequestReceived = delegate { };
86
87 public bool CanSend { get { return true; } }
88 public string RemoteEndPoint { get { return ""; } }
89 public string RemoteEndPointAddress { get { return ""; } }
90 public string RemoteEndPointPort { get { return ""; } }
91 }
92
93 public class TestHttpRequest: IHttpRequest
94 {
95 private string _uriPath;
96 public bool BodyIsComplete
97 {
98 get { return true; }
99 }
100 public string[] AcceptTypes
101 {
102 get {return _acceptTypes; }
103 }
104 private string[] _acceptTypes;
105 public Stream Body
106 {
107 get { return _body; }
108 set { _body = value;}
109 }
110 private Stream _body;
111 public ConnectionType Connection
112 {
113 get { return _connection; }
114 set { _connection = value; }
115 }
116 private ConnectionType _connection;
117 public int ContentLength
118 {
119 get { return _contentLength; }
120 set { _contentLength = value; }
121 }
122 private int _contentLength;
123 public NameValueCollection Headers
124 {
125 get { return _headers; }
126 }
127 private NameValueCollection _headers = new NameValueCollection();
128 public string HttpVersion
129 {
130 get { return _httpVersion; }
131 set { _httpVersion = value; }
132 }
133 private string _httpVersion = null;
134 public string Method
135 {
136 get { return _method; }
137 set { _method = value; }
138 }
139 private string _method = null;
140 public HttpInput QueryString
141 {
142 get { return _queryString; }
143 }
144 private HttpInput _queryString = null;
145 public Uri Uri
146 {
147 get { return _uri; }
148 set { _uri = value; }
149 }
150 private Uri _uri = null;
151 public string[] UriParts
152 {
153 get { return _uri.Segments; }
154 }
155 public HttpParam Param
156 {
157 get { return null; }
158 }
159 public HttpForm Form
160 {
161 get { return null; }
162 }
163 public bool IsAjax
164 {
165 get { return false; }
166 }
167 public RequestCookies Cookies
168 {
169 get { return null; }
170 }
171
172 public TestHttpRequest() {}
173
174 public TestHttpRequest(string contentEncoding, string contentType, string userAgent,
175 string remoteAddr, string remotePort, string[] acceptTypes,
176 ConnectionType connectionType, int contentLength, Uri uri)
177 {
178 _headers["content-encoding"] = contentEncoding;
179 _headers["content-type"] = contentType;
180 _headers["user-agent"] = userAgent;
181 _headers["remote_addr"] = remoteAddr;
182 _headers["remote_port"] = remotePort;
183
184 _acceptTypes = acceptTypes;
185 _connection = connectionType;
186 _contentLength = contentLength;
187 _uri = uri;
188 }
189
190 public void DecodeBody(FormDecoderProvider providers) {}
191 public void SetCookies(RequestCookies cookies) {}
192 public void AddHeader(string name, string value)
193 {
194 _headers.Add(name, value);
195 }
196 public int AddToBody(byte[] bytes, int offset, int length)
197 {
198 return 0;
199 }
200 public void Clear() {}
201
202 public object Clone()
203 {
204 TestHttpRequest clone = new TestHttpRequest();
205 clone._acceptTypes = _acceptTypes;
206 clone._connection = _connection;
207 clone._contentLength = _contentLength;
208 clone._uri = _uri;
209 clone._headers = new NameValueCollection(_headers);
210
211 return clone;
212 }
213 public IHttpResponse CreateResponse(IHttpClientContext context)
214 {
215 return new HttpResponse(context, this);
216 }
217 /// <summary>
218 /// Path and query (will be merged with the host header) and put in Uri
219 /// </summary>
220 /// <see cref="Uri"/>
221 public string UriPath
222 {
223 get { return _uriPath; }
224 set
225 {
226 _uriPath = value;
227
228 }
229 }
230
231 }
232
233 public class TestHttpResponse: IHttpResponse
234 {
235 public Stream Body
236 {
237 get { return _body; }
238
239 set { _body = value; }
240 }
241 private Stream _body;
242
243 public string ProtocolVersion
244 {
245 get { return _protocolVersion; }
246 set { _protocolVersion = value; }
247 }
248 private string _protocolVersion;
249
250 public bool Chunked
251 {
252 get { return _chunked; }
253
254 set { _chunked = value; }
255 }
256 private bool _chunked;
257
258 public ConnectionType Connection
259 {
260 get { return _connection; }
261
262 set { _connection = value; }
263 }
264 private ConnectionType _connection;
265
266 public Encoding Encoding
267 {
268 get { return _encoding; }
269
270 set { _encoding = value; }
271 }
272 private Encoding _encoding;
273
274 public int KeepAlive
275 {
276 get { return _keepAlive; }
277
278 set { _keepAlive = value; }
279 }
280 private int _keepAlive;
281
282 public HttpStatusCode Status
283 {
284 get { return _status; }
285
286 set { _status = value; }
287 }
288 private HttpStatusCode _status;
289
290 public string Reason
291 {
292 get { return _reason; }
293
294 set { _reason = value; }
295 }
296 private string _reason;
297
298 public long ContentLength
299 {
300 get { return _contentLength; }
301
302 set { _contentLength = value; }
303 }
304 private long _contentLength;
305
306 public string ContentType
307 {
308 get { return _contentType; }
309
310 set { _contentType = value; }
311 }
312 private string _contentType;
313
314 public bool HeadersSent
315 {
316 get { return _headersSent; }
317 }
318 private bool _headersSent;
319
320 public bool Sent
321 {
322 get { return _sent; }
323 }
324 private bool _sent;
325
326 public ResponseCookies Cookies
327 {
328 get { return _cookies; }
329 }
330 private ResponseCookies _cookies = null;
331
332 public TestHttpResponse()
333 {
334 _headersSent = false;
335 _sent = false;
336 }
337
338 public void AddHeader(string name, string value) {}
339 public void Send()
340 {
341 if (!_headersSent) SendHeaders();
342 if (_sent) throw new InvalidOperationException("stuff already sent");
343 _sent = true;
344 }
345
346 public void SendBody(byte[] buffer, int offset, int count)
347 {
348 if (!_headersSent) SendHeaders();
349 _sent = true;
350 }
351 public void SendBody(byte[] buffer)
352 {
353 if (!_headersSent) SendHeaders();
354 _sent = true;
355 }
356
357 public void SendHeaders()
358 {
359 if (_headersSent) throw new InvalidOperationException("headers already sent");
360 _headersSent = true;
361 }
362
363 public void Redirect(Uri uri) {}
364 public void Redirect(string url) {}
365 }
366
367
368>>>>>>> avn/ubitvar
45 public OSHttpRequest req0; 369 public OSHttpRequest req0;
46 public OSHttpRequest req1; 370 public OSHttpRequest req1;
47 371
@@ -113,4 +437,4 @@ namespace OpenSim.Framework.Servers.Tests
113 Assert.That(rsp0.ContentType, Is.EqualTo("text/xml")); 437 Assert.That(rsp0.ContentType, Is.EqualTo("text/xml"));
114 } 438 }
115 } 439 }
116} \ No newline at end of file 440}
diff --git a/OpenSim/Framework/TaskInventoryDictionary.cs b/OpenSim/Framework/TaskInventoryDictionary.cs
index 8af2c41..2c20ef7 100644
--- a/OpenSim/Framework/TaskInventoryDictionary.cs
+++ b/OpenSim/Framework/TaskInventoryDictionary.cs
@@ -27,9 +27,13 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Threading;
31using System.Reflection;
30using System.Xml; 32using System.Xml;
33using System.Diagnostics;
31using System.Xml.Schema; 34using System.Xml.Schema;
32using System.Xml.Serialization; 35using System.Xml.Serialization;
36using log4net;
33using OpenMetaverse; 37using OpenMetaverse;
34 38
35namespace OpenSim.Framework 39namespace 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 volatile 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 307cb75..2ec4bd1 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/TerrainData.cs b/OpenSim/Framework/TerrainData.cs
index 6b1be4e..d2e1c6a 100644
--- a/OpenSim/Framework/TerrainData.cs
+++ b/OpenSim/Framework/TerrainData.cs
@@ -28,6 +28,7 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.IO; 30using System.IO;
31using System.IO.Compression;
31using System.Reflection; 32using System.Reflection;
32 33
33using OpenMetaverse; 34using OpenMetaverse;
@@ -48,6 +49,7 @@ namespace OpenSim.Framework
48 49
49 public abstract float this[int x, int y] { get; set; } 50 public abstract float this[int x, int y] { get; set; }
50 // Someday terrain will have caves 51 // Someday terrain will have caves
52 // at most holes :p
51 public abstract float this[int x, int y, int z] { get; set; } 53 public abstract float this[int x, int y, int z] { get; set; }
52 54
53 public abstract bool IsTaintedAt(int xx, int yy); 55 public abstract bool IsTaintedAt(int xx, int yy);
@@ -72,8 +74,8 @@ namespace OpenSim.Framework
72 return new HeightmapTerrainData(pSizeX, pSizeY, pSizeZ, pFormatCode, pBlob); 74 return new HeightmapTerrainData(pSizeX, pSizeY, pSizeZ, pFormatCode, pBlob);
73 } 75 }
74 76
75 // return a special compressed representation of the heightmap in ints 77 // return a special compressed representation of the heightmap in ushort
76 public abstract int[] GetCompressedMap(); 78 public abstract float[] GetCompressedMap();
77 public abstract float CompressionFactor { get; } 79 public abstract float CompressionFactor { get; }
78 80
79 public abstract float[] GetFloatsSerialized(); 81 public abstract float[] GetFloatsSerialized();
@@ -94,14 +96,18 @@ namespace OpenSim.Framework
94 { 96 {
95 // Terrain is 'double[256,256]' 97 // Terrain is 'double[256,256]'
96 Legacy256 = 11, 98 Legacy256 = 11,
99
97 // Terrain is 'int32, int32, float[,]' where the ints are X and Y dimensions 100 // Terrain is 'int32, int32, float[,]' where the ints are X and Y dimensions
98 // The dimensions are presumed to be multiples of 16 and, more likely, multiples of 256. 101 // The dimensions are presumed to be multiples of 16 and, more likely, multiples of 256.
99 Variable2D = 22, 102 Variable2D = 22,
103 Variable2DGzip = 23,
104
100 // Terrain is 'int32, int32, int32, int16[]' where the ints are X and Y dimensions 105 // Terrain is 'int32, int32, int32, int16[]' where the ints are X and Y dimensions
101 // and third int is the 'compression factor'. The heights are compressed as 106 // and third int is the 'compression factor'. The heights are compressed as
102 // "int compressedHeight = (int)(height * compressionFactor);" 107 // "ushort compressedHeight = (ushort)(height * compressionFactor);"
103 // The dimensions are presumed to be multiples of 16 and, more likely, multiples of 256. 108 // The dimensions are presumed to be multiples of 16 and, more likely, multiples of 256.
104 Compressed2D = 27, 109 Compressed2D = 27,
110
105 // A revision that is not listed above or any revision greater than this value is 'Legacy256'. 111 // A revision that is not listed above or any revision greater than this value is 'Legacy256'.
106 RevisionHigh = 1234 112 RevisionHigh = 1234
107 } 113 }
@@ -109,7 +115,7 @@ namespace OpenSim.Framework
109 // Version of terrain that is a heightmap. 115 // Version of terrain that is a heightmap.
110 // This should really be 'LLOptimizedHeightmapTerrainData' as it includes knowledge 116 // This should really be 'LLOptimizedHeightmapTerrainData' as it includes knowledge
111 // of 'patches' which are 16x16 terrain areas which can be sent separately to the viewer. 117 // of 'patches' which are 16x16 terrain areas which can be sent separately to the viewer.
112 // The heighmap is kept as an array of integers. The integer values are converted to 118 // The heighmap is kept as an array of ushorts. The ushort values are converted to
113 // and from floats by TerrainCompressionFactor. 119 // and from floats by TerrainCompressionFactor.
114 public class HeightmapTerrainData : TerrainData 120 public class HeightmapTerrainData : TerrainData
115 { 121 {
@@ -119,12 +125,12 @@ namespace OpenSim.Framework
119 // TerrainData.this[x, y] 125 // TerrainData.this[x, y]
120 public override float this[int x, int y] 126 public override float this[int x, int y]
121 { 127 {
122 get { return FromCompressedHeight(m_heightmap[x, y]); } 128 get { return m_heightmap[x, y]; }
123 set { 129 set
124 int newVal = ToCompressedHeight(value); 130 {
125 if (m_heightmap[x, y] != newVal) 131 if (m_heightmap[x, y] != value)
126 { 132 {
127 m_heightmap[x, y] = newVal; 133 m_heightmap[x, y] = value;
128 m_taint[x / Constants.TerrainPatchSize, y / Constants.TerrainPatchSize] = true; 134 m_taint[x / Constants.TerrainPatchSize, y / Constants.TerrainPatchSize] = true;
129 } 135 }
130 } 136 }
@@ -164,10 +170,9 @@ namespace OpenSim.Framework
164 // TerrainData.ClearLand(float) 170 // TerrainData.ClearLand(float)
165 public override void ClearLand(float pHeight) 171 public override void ClearLand(float pHeight)
166 { 172 {
167 int flatHeight = ToCompressedHeight(pHeight);
168 for (int xx = 0; xx < SizeX; xx++) 173 for (int xx = 0; xx < SizeX; xx++)
169 for (int yy = 0; yy < SizeY; yy++) 174 for (int yy = 0; yy < SizeY; yy++)
170 m_heightmap[xx, yy] = flatHeight; 175 m_heightmap[xx, yy] = pHeight;
171 } 176 }
172 177
173 // Return 'true' of the patch that contains these region coordinates has been modified. 178 // Return 'true' of the patch that contains these region coordinates has been modified.
@@ -177,13 +182,15 @@ namespace OpenSim.Framework
177 { 182 {
178 int tx = xx / Constants.TerrainPatchSize; 183 int tx = xx / Constants.TerrainPatchSize;
179 int ty = yy / Constants.TerrainPatchSize; 184 int ty = yy / Constants.TerrainPatchSize;
180 bool ret = m_taint[tx, ty]; 185 bool ret = m_taint[tx, ty];
181 if (ret && clearOnTest) 186 if (ret && clearOnTest)
182 m_taint[tx, ty] = false; 187 m_taint[tx, ty] = false;
183 return ret; 188 return ret;
184 } 189 }
185 190
186 // Old form that clears the taint flag when we check it. 191 // Old form that clears the taint flag when we check it.
192 // ubit: this dangerus naming should be only check without clear
193 // keeping for old modules outthere
187 public override bool IsTaintedAt(int xx, int yy) 194 public override bool IsTaintedAt(int xx, int yy)
188 { 195 {
189 return IsTaintedAt(xx, yy, true /* clearOnTest */); 196 return IsTaintedAt(xx, yy, true /* clearOnTest */);
@@ -202,8 +209,10 @@ namespace OpenSim.Framework
202 } 209 }
203 else 210 else
204 { 211 {
205 DBRevisionCode = (int)DBTerrainRevision.Compressed2D; 212 DBRevisionCode = (int)DBTerrainRevision.Variable2DGzip;
206 blob = ToCompressedTerrainSerialization(); 213// DBRevisionCode = (int)DBTerrainRevision.Variable2D;
214 blob = ToCompressedTerrainSerializationV2DGzip();
215// blob = ToCompressedTerrainSerializationV2D();
207 ret = true; 216 ret = true;
208 } 217 }
209 return ret; 218 return ret;
@@ -214,9 +223,9 @@ namespace OpenSim.Framework
214 public override float CompressionFactor { get { return m_compressionFactor; } } 223 public override float CompressionFactor { get { return m_compressionFactor; } }
215 224
216 // TerrainData.GetCompressedMap 225 // TerrainData.GetCompressedMap
217 public override int[] GetCompressedMap() 226 public override float[] GetCompressedMap()
218 { 227 {
219 int[] newMap = new int[SizeX * SizeY]; 228 float[] newMap = new float[SizeX * SizeY];
220 229
221 int ind = 0; 230 int ind = 0;
222 for (int xx = 0; xx < SizeX; xx++) 231 for (int xx = 0; xx < SizeX; xx++)
@@ -230,7 +239,7 @@ namespace OpenSim.Framework
230 public override TerrainData Clone() 239 public override TerrainData Clone()
231 { 240 {
232 HeightmapTerrainData ret = new HeightmapTerrainData(SizeX, SizeY, SizeZ); 241 HeightmapTerrainData ret = new HeightmapTerrainData(SizeX, SizeY, SizeZ);
233 ret.m_heightmap = (int[,])this.m_heightmap.Clone(); 242 ret.m_heightmap = (float[,])this.m_heightmap.Clone();
234 return ret; 243 return ret;
235 } 244 }
236 245
@@ -247,7 +256,7 @@ namespace OpenSim.Framework
247 for (int jj = 0; jj < SizeY; jj++) 256 for (int jj = 0; jj < SizeY; jj++)
248 for (int ii = 0; ii < SizeX; ii++) 257 for (int ii = 0; ii < SizeX; ii++)
249 { 258 {
250 heights[idx++] = FromCompressedHeight(m_heightmap[ii, jj]); 259 heights[idx++] = m_heightmap[ii, jj];
251 } 260 }
252 261
253 return heights; 262 return heights;
@@ -259,7 +268,7 @@ namespace OpenSim.Framework
259 double[,] ret = new double[SizeX, SizeY]; 268 double[,] ret = new double[SizeX, SizeY];
260 for (int xx = 0; xx < SizeX; xx++) 269 for (int xx = 0; xx < SizeX; xx++)
261 for (int yy = 0; yy < SizeY; yy++) 270 for (int yy = 0; yy < SizeY; yy++)
262 ret[xx, yy] = FromCompressedHeight(m_heightmap[xx, yy]); 271 ret[xx, yy] = (double)m_heightmap[xx, yy];
263 272
264 return ret; 273 return ret;
265 } 274 }
@@ -267,19 +276,40 @@ namespace OpenSim.Framework
267 276
268 // ============================================================= 277 // =============================================================
269 278
270 private int[,] m_heightmap; 279 private float[,] m_heightmap;
271 // Remember subregions of the heightmap that has changed. 280 // Remember subregions of the heightmap that has changed.
272 private bool[,] m_taint; 281 private bool[,] m_taint;
273 282
274 // To save space (especially for large regions), keep the height as a short integer
275 // that is coded as the float height times the compression factor (usually '100' 283 // that is coded as the float height times the compression factor (usually '100'
276 // to make for two decimal points). 284 // to make for two decimal points).
277 public int ToCompressedHeight(double pHeight) 285 public short ToCompressedHeightshort(float pHeight)
286 {
287 // clamp into valid range
288 pHeight *= CompressionFactor;
289 if (pHeight < short.MinValue)
290 return short.MinValue;
291 else if (pHeight > short.MaxValue)
292 return short.MaxValue;
293 return (short)pHeight;
294 }
295
296 public ushort ToCompressedHeightushort(float pHeight)
278 { 297 {
279 return (int)(pHeight * CompressionFactor); 298 // clamp into valid range
299 pHeight *= CompressionFactor;
300 if (pHeight < ushort.MinValue)
301 return ushort.MinValue;
302 else if (pHeight > ushort.MaxValue)
303 return ushort.MaxValue;
304 return (ushort)pHeight;
280 } 305 }
281 306
282 public float FromCompressedHeight(int pHeight) 307 public float FromCompressedHeight(short pHeight)
308 {
309 return ((float)pHeight) / CompressionFactor;
310 }
311
312 public float FromCompressedHeight(ushort pHeight)
283 { 313 {
284 return ((float)pHeight) / CompressionFactor; 314 return ((float)pHeight) / CompressionFactor;
285 } 315 }
@@ -293,12 +323,12 @@ namespace OpenSim.Framework
293 SizeZ = (int)Constants.RegionHeight; 323 SizeZ = (int)Constants.RegionHeight;
294 m_compressionFactor = 100.0f; 324 m_compressionFactor = 100.0f;
295 325
296 m_heightmap = new int[SizeX, SizeY]; 326 m_heightmap = new float[SizeX, SizeY];
297 for (int ii = 0; ii < SizeX; ii++) 327 for (int ii = 0; ii < SizeX; ii++)
298 { 328 {
299 for (int jj = 0; jj < SizeY; jj++) 329 for (int jj = 0; jj < SizeY; jj++)
300 { 330 {
301 m_heightmap[ii, jj] = ToCompressedHeight(pTerrain[ii, jj]); 331 m_heightmap[ii, jj] = (float)pTerrain[ii, jj];
302 332
303 } 333 }
304 } 334 }
@@ -315,14 +345,15 @@ namespace OpenSim.Framework
315 SizeY = pY; 345 SizeY = pY;
316 SizeZ = pZ; 346 SizeZ = pZ;
317 m_compressionFactor = 100.0f; 347 m_compressionFactor = 100.0f;
318 m_heightmap = new int[SizeX, SizeY]; 348 m_heightmap = new float[SizeX, SizeY];
319 m_taint = new bool[SizeX / Constants.TerrainPatchSize, SizeY / Constants.TerrainPatchSize]; 349 m_taint = new bool[SizeX / Constants.TerrainPatchSize, SizeY / Constants.TerrainPatchSize];
320 // m_log.DebugFormat("{0} new by dimensions. sizeX={1}, sizeY={2}, sizeZ={3}", LogHeader, SizeX, SizeY, SizeZ); 350 // m_log.DebugFormat("{0} new by dimensions. sizeX={1}, sizeY={2}, sizeZ={3}", LogHeader, SizeX, SizeY, SizeZ);
321 ClearTaint(); 351 ClearTaint();
322 ClearLand(0f); 352 ClearLand(0f);
323 } 353 }
324 354
325 public HeightmapTerrainData(int[] cmap, float pCompressionFactor, int pX, int pY, int pZ) : this(pX, pY, pZ) 355 public HeightmapTerrainData(float[] cmap, float pCompressionFactor, int pX, int pY, int pZ)
356 : this(pX, pY, pZ)
326 { 357 {
327 m_compressionFactor = pCompressionFactor; 358 m_compressionFactor = pCompressionFactor;
328 int ind = 0; 359 int ind = 0;
@@ -333,12 +364,22 @@ namespace OpenSim.Framework
333 } 364 }
334 365
335 // Create a heighmap from a database blob 366 // Create a heighmap from a database blob
336 public HeightmapTerrainData(int pSizeX, int pSizeY, int pSizeZ, int pFormatCode, byte[] pBlob) : this(pSizeX, pSizeY, pSizeZ) 367 public HeightmapTerrainData(int pSizeX, int pSizeY, int pSizeZ, int pFormatCode, byte[] pBlob)
368 : this(pSizeX, pSizeY, pSizeZ)
337 { 369 {
338 switch ((DBTerrainRevision)pFormatCode) 370 switch ((DBTerrainRevision)pFormatCode)
339 { 371 {
372 case DBTerrainRevision.Variable2DGzip:
373 FromCompressedTerrainSerializationV2DGZip(pBlob);
374 m_log.DebugFormat("{0} HeightmapTerrainData create from Variable2DGzip serialization. Size=<{1},{2}>", LogHeader, SizeX, SizeY);
375 break;
376
377 case DBTerrainRevision.Variable2D:
378 FromCompressedTerrainSerializationV2D(pBlob);
379 m_log.DebugFormat("{0} HeightmapTerrainData create from Variable2D serialization. Size=<{1},{2}>", LogHeader, SizeX, SizeY);
380 break;
340 case DBTerrainRevision.Compressed2D: 381 case DBTerrainRevision.Compressed2D:
341 FromCompressedTerrainSerialization(pBlob); 382 FromCompressedTerrainSerialization2D(pBlob);
342 m_log.DebugFormat("{0} HeightmapTerrainData create from Compressed2D serialization. Size=<{1},{2}>", LogHeader, SizeX, SizeY); 383 m_log.DebugFormat("{0} HeightmapTerrainData create from Compressed2D serialization. Size=<{1},{2}>", LogHeader, SizeX, SizeY);
343 break; 384 break;
344 default: 385 default:
@@ -373,50 +414,116 @@ namespace OpenSim.Framework
373 return ret; 414 return ret;
374 } 415 }
375 416
376 // Just create an array of doubles. Presumes the caller implicitly knows the size. 417 // Presumes the caller implicitly knows the size.
377 public void FromLegacyTerrainSerialization(byte[] pBlob) 418 public void FromLegacyTerrainSerialization(byte[] pBlob)
378 { 419 {
379 // In case database info doesn't match real terrain size, initialize the whole terrain. 420 // In case database info doesn't match real terrain size, initialize the whole terrain.
380 ClearLand(); 421 ClearLand();
381 422
382 using (MemoryStream mstr = new MemoryStream(pBlob)) 423 try
383 { 424 {
384 using (BinaryReader br = new BinaryReader(mstr)) 425 using (MemoryStream mstr = new MemoryStream(pBlob))
385 { 426 {
386 for (int xx = 0; xx < (int)Constants.RegionSize; xx++) 427 using (BinaryReader br = new BinaryReader(mstr))
387 { 428 {
388 for (int yy = 0; yy < (int)Constants.RegionSize; yy++) 429 for (int xx = 0; xx < (int)Constants.RegionSize; xx++)
389 { 430 {
390 float val = (float)br.ReadDouble(); 431 for (int yy = 0; yy < (int)Constants.RegionSize; yy++)
391 if (xx < SizeX && yy < SizeY) 432 {
392 m_heightmap[xx, yy] = ToCompressedHeight(val); 433 float val = (float)br.ReadDouble();
434
435 if (xx < SizeX && yy < SizeY)
436 m_heightmap[xx, yy] = val;
437 }
393 } 438 }
394 } 439 }
395 } 440 }
396 ClearTaint();
397 } 441 }
442 catch
443 {
444 ClearLand();
445 }
446 ClearTaint();
398 } 447 }
399 448
400 // See the reader below. 449
401 public Array ToCompressedTerrainSerialization() 450 // stores as variable2D
451 // int32 sizeX
452 // int32 sizeY
453 // float[,] array
454
455 public Array ToCompressedTerrainSerializationV2D()
402 { 456 {
403 Array ret = null; 457 Array ret = null;
404 using (MemoryStream str = new MemoryStream((3 * sizeof(Int32)) + (SizeX * SizeY * sizeof(Int16)))) 458 try
405 { 459 {
406 using (BinaryWriter bw = new BinaryWriter(str)) 460 using (MemoryStream str = new MemoryStream((2 * sizeof(Int32)) + (SizeX * SizeY * sizeof(float))))
461 {
462 using (BinaryWriter bw = new BinaryWriter(str))
463 {
464 bw.Write((Int32)SizeX);
465 bw.Write((Int32)SizeY);
466 for (int yy = 0; yy < SizeY; yy++)
467 for (int xx = 0; xx < SizeX; xx++)
468 {
469 // reduce to 1cm resolution
470 float val = (float)Math.Round(m_heightmap[xx, yy],2,MidpointRounding.ToEven);
471 bw.Write(val);
472 }
473 }
474 ret = str.ToArray();
475 }
476 }
477 catch
478 {
479
480 }
481
482 m_log.DebugFormat("{0} V2D {1} bytes",
483 LogHeader, ret.Length);
484
485 return ret;
486 }
487
488 // as above with Gzip compression
489 public Array ToCompressedTerrainSerializationV2DGzip()
490 {
491 Array ret = null;
492 try
493 {
494 using (MemoryStream inp = new MemoryStream((2 * sizeof(Int32)) + (SizeX * SizeY * sizeof(float))))
407 { 495 {
408 bw.Write((Int32)DBTerrainRevision.Compressed2D); 496 using (BinaryWriter bw = new BinaryWriter(inp))
409 bw.Write((Int32)SizeX); 497 {
410 bw.Write((Int32)SizeY); 498 bw.Write((Int32)SizeX);
411 bw.Write((Int32)CompressionFactor); 499 bw.Write((Int32)SizeY);
412 for (int yy = 0; yy < SizeY; yy++) 500 for (int yy = 0; yy < SizeY; yy++)
413 for (int xx = 0; xx < SizeX; xx++) 501 for (int xx = 0; xx < SizeX; xx++)
502 {
503 bw.Write((float)m_heightmap[xx, yy]);
504 }
505
506 bw.Flush();
507 inp.Seek(0, SeekOrigin.Begin);
508
509 using (MemoryStream outputStream = new MemoryStream())
414 { 510 {
415 bw.Write((Int16)m_heightmap[xx, yy]); 511 using (GZipStream compressionStream = new GZipStream(outputStream, CompressionMode.Compress))
512 {
513 inp.CopyStream(compressionStream, int.MaxValue);
514 compressionStream.Close();
515 ret = outputStream.ToArray();
516 }
416 } 517 }
518 }
417 } 519 }
418 ret = str.ToArray();
419 } 520 }
521 catch
522 {
523
524 }
525 m_log.DebugFormat("{0} V2DGzip {1} bytes",
526 LogHeader, ret.Length);
420 return ret; 527 return ret;
421 } 528 }
422 529
@@ -426,7 +533,7 @@ namespace OpenSim.Framework
426 // the forth int is the compression factor for the following int16s 533 // the forth int is the compression factor for the following int16s
427 // This is just sets heightmap info. The actual size of the region was set on this instance's 534 // This is just sets heightmap info. The actual size of the region was set on this instance's
428 // creation and any heights not initialized by theis blob are set to the default height. 535 // creation and any heights not initialized by theis blob are set to the default height.
429 public void FromCompressedTerrainSerialization(byte[] pBlob) 536 public void FromCompressedTerrainSerialization2D(byte[] pBlob)
430 { 537 {
431 Int32 hmFormatCode, hmSizeX, hmSizeY, hmCompressionFactor; 538 Int32 hmFormatCode, hmSizeX, hmSizeY, hmCompressionFactor;
432 539
@@ -448,7 +555,7 @@ namespace OpenSim.Framework
448 { 555 {
449 for (int xx = 0; xx < hmSizeX; xx++) 556 for (int xx = 0; xx < hmSizeX; xx++)
450 { 557 {
451 Int16 val = br.ReadInt16(); 558 float val = FromCompressedHeight(br.ReadInt16());
452 if (xx < SizeX && yy < SizeY) 559 if (xx < SizeX && yy < SizeY)
453 m_heightmap[xx, yy] = val; 560 m_heightmap[xx, yy] = val;
454 } 561 }
@@ -456,9 +563,112 @@ namespace OpenSim.Framework
456 } 563 }
457 ClearTaint(); 564 ClearTaint();
458 565
459 m_log.InfoFormat("{0} Read compressed 2d heightmap. Heightmap size=<{1},{2}>. Region size=<{3},{4}>. CompFact={5}", 566 m_log.DebugFormat("{0} Read (compressed2D) heightmap. Heightmap size=<{1},{2}>. Region size=<{3},{4}>. CompFact={5}",
460 LogHeader, hmSizeX, hmSizeY, SizeX, SizeY, hmCompressionFactor); 567 LogHeader, hmSizeX, hmSizeY, SizeX, SizeY, hmCompressionFactor);
461 } 568 }
462 } 569 }
570
571 // Initialize heightmap from blob consisting of:
572 // int32, int32, int32, float[]
573 // where the first int32 is format code, next two int32s are the X and y of heightmap data
574 // This is just sets heightmap info. The actual size of the region was set on this instance's
575 // creation and any heights not initialized by theis blob are set to the default height.
576 public void FromCompressedTerrainSerializationV2D(byte[] pBlob)
577 {
578 Int32 hmSizeX, hmSizeY;
579 try
580 {
581 using (MemoryStream mstr = new MemoryStream(pBlob))
582 {
583 using (BinaryReader br = new BinaryReader(mstr))
584 {
585 hmSizeX = br.ReadInt32();
586 hmSizeY = br.ReadInt32();
587
588 // In case database info doesn't match real terrain size, initialize the whole terrain.
589 ClearLand();
590
591 for (int yy = 0; yy < hmSizeY; yy++)
592 {
593 for (int xx = 0; xx < hmSizeX; xx++)
594 {
595 float val = br.ReadSingle();
596 if (xx < SizeX && yy < SizeY)
597 m_heightmap[xx, yy] = val;
598 }
599 }
600 }
601 }
602 }
603 catch (Exception e)
604 {
605 ClearTaint();
606 m_log.ErrorFormat("{0} 2D error: {1} - terrain may be damaged",
607 LogHeader, e.Message);
608 return;
609 }
610 ClearTaint();
611
612 m_log.DebugFormat("{0} V2D Heightmap size=<{1},{2}>. Region size=<{3},{4}>",
613 LogHeader, hmSizeX, hmSizeY, SizeX, SizeY);
614
615 }
616
617 // as above but Gzip compressed
618 public void FromCompressedTerrainSerializationV2DGZip(byte[] pBlob)
619 {
620 m_log.InfoFormat("{0} VD2Gzip {1} bytes input",
621 LogHeader, pBlob.Length);
622
623 Int32 hmSizeX, hmSizeY;
624
625 try
626 {
627 using (MemoryStream outputStream = new MemoryStream())
628 {
629 using (MemoryStream inputStream = new MemoryStream(pBlob))
630 {
631 using (GZipStream decompressionStream = new GZipStream(inputStream, CompressionMode.Decompress))
632 {
633 decompressionStream.Flush();
634 decompressionStream.CopyTo(outputStream);
635 }
636 }
637
638 outputStream.Seek(0, SeekOrigin.Begin);
639
640 using (BinaryReader br = new BinaryReader(outputStream))
641 {
642 hmSizeX = br.ReadInt32();
643 hmSizeY = br.ReadInt32();
644
645 // In case database info doesn't match real terrain size, initialize the whole terrain.
646 ClearLand();
647
648 for (int yy = 0; yy < hmSizeY; yy++)
649 {
650 for (int xx = 0; xx < hmSizeX; xx++)
651 {
652 float val = br.ReadSingle();
653 if (xx < SizeX && yy < SizeY)
654 m_heightmap[xx, yy] = val;
655 }
656 }
657 }
658 }
659 }
660 catch( Exception e)
661 {
662 ClearTaint();
663 m_log.ErrorFormat("{0} V2DGzip error: {1} - terrain may be damaged",
664 LogHeader, e.Message);
665 return;
666 }
667
668 ClearTaint();
669 m_log.DebugFormat("{0} V2DGzip. Heightmap size=<{1},{2}>. Region size=<{3},{4}>",
670 LogHeader, hmSizeX, hmSizeY, SizeX, SizeY);
671
672 }
463 } 673 }
464} 674}
diff --git a/OpenSim/Framework/Tests/MundaneFrameworkTests.cs b/OpenSim/Framework/Tests/MundaneFrameworkTests.cs
index 3f0a031..08f2af5 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/UserProfileData.cs b/OpenSim/Framework/UserProfileData.cs
index 266ccf0..61d8fe5 100644
--- a/OpenSim/Framework/UserProfileData.cs
+++ b/OpenSim/Framework/UserProfileData.cs
@@ -160,7 +160,11 @@ namespace OpenSim.Framework
160 public virtual ulong HomeRegion 160 public virtual ulong HomeRegion
161 { 161 {
162 get 162 get
163<<<<<<< HEAD
163 { 164 {
165=======
166 {
167>>>>>>> avn/ubitvar
164 return Util.RegionWorldLocToHandle(Util.RegionToWorldLoc(m_homeRegionX), Util.RegionToWorldLoc(m_homeRegionY)); 168 return Util.RegionWorldLocToHandle(Util.RegionToWorldLoc(m_homeRegionX), Util.RegionToWorldLoc(m_homeRegionY));
165 // return Utils.UIntsToLong( m_homeRegionX * (uint)Constants.RegionSize, m_homeRegionY * (uint)Constants.RegionSize); 169 // return Utils.UIntsToLong( m_homeRegionX * (uint)Constants.RegionSize, m_homeRegionY * (uint)Constants.RegionSize);
166 } 170 }
diff --git a/OpenSim/Framework/UserProfiles.cs b/OpenSim/Framework/UserProfiles.cs
index 98ab651..944a492 100644
--- a/OpenSim/Framework/UserProfiles.cs
+++ b/OpenSim/Framework/UserProfiles.cs
@@ -91,14 +91,6 @@ namespace OpenSim.Framework
91 public UUID TargetId; 91 public UUID TargetId;
92 public string Notes; 92 public string Notes;
93 } 93 }
94
95 public class UserPreferences
96 {
97 public UUID UserId;
98 public bool IMViaEmail = false;
99 public bool Visible = false;
100 public string EMail = string.Empty;
101 }
102 94
103 public class UserAccountProperties 95 public class UserAccountProperties
104 { 96 {
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index a5f798d..eb3526a 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -61,6 +61,15 @@ namespace OpenSim.Framework
61 public enum PermissionMask : uint 61 public enum PermissionMask : uint
62 { 62 {
63 None = 0, 63 None = 0,
64
65 // folded perms
66 foldedTransfer = 1,
67 foldedModify = 1 << 1,
68 foldedCopy = 1 << 2,
69
70 foldedMask = 0x07,
71
72 //
64 Transfer = 1 << 13, 73 Transfer = 1 << 13,
65 Modify = 1 << 14, 74 Modify = 1 << 14,
66 Copy = 1 << 15, 75 Copy = 1 << 15,
@@ -267,14 +276,12 @@ namespace OpenSim.Framework
267 /// </summary> 276 /// </summary>
268 /// <param name="a">A 3d vector</param> 277 /// <param name="a">A 3d vector</param>
269 /// <returns>A new vector which is normalized form of the vector</returns> 278 /// <returns>A new vector which is normalized form of the vector</returns>
270 /// <remarks>The vector paramater cannot be <0,0,0></remarks> 279
271 public static Vector3 GetNormalizedVector(Vector3 a) 280 public static Vector3 GetNormalizedVector(Vector3 a)
272 { 281 {
273 if (IsZeroVector(a)) 282 Vector3 v = new Vector3(a.X, a.Y, a.Z);
274 throw new ArgumentException("Vector paramater cannot be a zero vector."); 283 v.Normalize();
275 284 return v;
276 float Mag = (float) GetMagnitude(a);
277 return new Vector3(a.X / Mag, a.Y / Mag, a.Z / Mag);
278 } 285 }
279 286
280 /// <summary> 287 /// <summary>
@@ -641,19 +648,25 @@ namespace OpenSim.Framework
641 /// </summary> 648 /// </summary>
642 /// <param name="data"></param> 649 /// <param name="data"></param>
643 /// <returns></returns> 650 /// <returns></returns>
651
644 public static string Md5Hash(string data) 652 public static string Md5Hash(string data)
645 { 653 {
646 byte[] dataMd5 = ComputeMD5Hash(data); 654 return Md5Hash(data, Encoding.Default);
655 }
656
657 public static string Md5Hash(string data, Encoding encoding)
658 {
659 byte[] dataMd5 = ComputeMD5Hash(data, encoding);
647 StringBuilder sb = new StringBuilder(); 660 StringBuilder sb = new StringBuilder();
648 for (int i = 0; i < dataMd5.Length; i++) 661 for (int i = 0; i < dataMd5.Length; i++)
649 sb.AppendFormat("{0:x2}", dataMd5[i]); 662 sb.AppendFormat("{0:x2}", dataMd5[i]);
650 return sb.ToString(); 663 return sb.ToString();
651 } 664 }
652 665
653 private static byte[] ComputeMD5Hash(string data) 666 private static byte[] ComputeMD5Hash(string data, Encoding encoding)
654 { 667 {
655 MD5 md5 = MD5.Create(); 668 MD5 md5 = MD5.Create();
656 return md5.ComputeHash(Encoding.Default.GetBytes(data)); 669 return md5.ComputeHash(encoding.GetBytes(data));
657 } 670 }
658 671
659 /// <summary> 672 /// <summary>
@@ -661,6 +674,12 @@ namespace OpenSim.Framework
661 /// </summary> 674 /// </summary>
662 /// <param name="data"></param> 675 /// <param name="data"></param>
663 /// <returns></returns> 676 /// <returns></returns>
677
678 public static string SHA1Hash(string data, Encoding enc)
679 {
680 return SHA1Hash(enc.GetBytes(data));
681 }
682
664 public static string SHA1Hash(string data) 683 public static string SHA1Hash(string data)
665 { 684 {
666 return SHA1Hash(Encoding.Default.GetBytes(data)); 685 return SHA1Hash(Encoding.Default.GetBytes(data));
@@ -714,17 +733,26 @@ namespace OpenSim.Framework
714 /// <param name="oldy">Old region y-coord</param> 733 /// <param name="oldy">Old region y-coord</param>
715 /// <param name="newy">New region y-coord</param> 734 /// <param name="newy">New region y-coord</param>
716 /// <returns></returns> 735 /// <returns></returns>
717 public static bool IsOutsideView(float drawdist, uint oldx, uint newx, uint oldy, uint newy) 736 public static bool IsOutsideView(float drawdist, uint oldx, uint newx, uint oldy, uint newy,
737 int oldsizex, int oldsizey, int newsizex, int newsizey)
718 { 738 {
719 int dd = (int)((drawdist + Constants.RegionSize - 1) / Constants.RegionSize); 739 // we still need to make sure we see new region 1stNeighbors
720 740
721 int startX = (int)oldx - dd; 741 oldx *= Constants.RegionSize;
722 int startY = (int)oldy - dd; 742 newx *= Constants.RegionSize;
743 if (oldx + oldsizex + drawdist < newx)
744 return true;
745 if (newx + newsizex + drawdist < oldx)
746 return true;
723 747
724 int endX = (int)oldx + dd; 748 oldy *= Constants.RegionSize;
725 int endY = (int)oldy + dd; 749 newy *= Constants.RegionSize;
750 if (oldy + oldsizey + drawdist < newy)
751 return true;
752 if (newy + newsizey + drawdist< oldy)
753 return true;
726 754
727 return (newx < startX || endX < newx || newy < startY || endY < newy); 755 return false;
728 } 756 }
729 757
730 public static string FieldToString(byte[] bytes) 758 public static string FieldToString(byte[] bytes)
@@ -805,6 +833,16 @@ namespace OpenSim.Framework
805 } 833 }
806 834
807 /// <summary> 835 /// <summary>
836 /// Converts a URL to a IPAddress
837 /// </summary>
838 /// <param name="url">URL Standard Format</param>
839 /// <returns>A resolved IP Address</returns>
840 public static IPAddress GetHostFromURL(string url)
841 {
842 return GetHostFromDNS(url.Split(new char[] {'/', ':'})[3]);
843 }
844
845 /// <summary>
808 /// Returns a IP address from a specified DNS, favouring IPv4 addresses. 846 /// Returns a IP address from a specified DNS, favouring IPv4 addresses.
809 /// </summary> 847 /// </summary>
810 /// <param name="dnsAddress">DNS Hostname</param> 848 /// <param name="dnsAddress">DNS Hostname</param>
@@ -1065,6 +1103,25 @@ namespace OpenSim.Framework
1065 } 1103 }
1066 } 1104 }
1067 1105
1106 public static string GetConfigVarWithDefaultSection(IConfigSource config, string varname, string section)
1107 {
1108 // First, check the Startup section, the default section
1109 IConfig cnf = config.Configs["Startup"];
1110 if (cnf == null)
1111 return string.Empty;
1112 string val = cnf.GetString(varname, string.Empty);
1113
1114 // Then check for an overwrite of the default in the given section
1115 if (!string.IsNullOrEmpty(section))
1116 {
1117 cnf = config.Configs[section];
1118 if (cnf != null)
1119 val = cnf.GetString(varname, val);
1120 }
1121
1122 return val;
1123 }
1124
1068 /// <summary> 1125 /// <summary>
1069 /// Gets the value of a configuration variable by looking into 1126 /// Gets the value of a configuration variable by looking into
1070 /// multiple sections in order. The latter sections overwrite 1127 /// multiple sections in order. The latter sections overwrite
@@ -1388,6 +1445,46 @@ namespace OpenSim.Framework
1388 return ret; 1445 return ret;
1389 } 1446 }
1390 1447
1448 public static string Compress(string text)
1449 {
1450 byte[] buffer = Util.UTF8.GetBytes(text);
1451 MemoryStream memory = new MemoryStream();
1452 using (GZipStream compressor = new GZipStream(memory, CompressionMode.Compress, true))
1453 {
1454 compressor.Write(buffer, 0, buffer.Length);
1455 }
1456
1457 memory.Position = 0;
1458
1459 byte[] compressed = new byte[memory.Length];
1460 memory.Read(compressed, 0, compressed.Length);
1461
1462 byte[] compressedBuffer = new byte[compressed.Length + 4];
1463 Buffer.BlockCopy(compressed, 0, compressedBuffer, 4, compressed.Length);
1464 Buffer.BlockCopy(BitConverter.GetBytes(buffer.Length), 0, compressedBuffer, 0, 4);
1465 return Convert.ToBase64String(compressedBuffer);
1466 }
1467
1468 public static string Decompress(string compressedText)
1469 {
1470 byte[] compressedBuffer = Convert.FromBase64String(compressedText);
1471 using (MemoryStream memory = new MemoryStream())
1472 {
1473 int msgLength = BitConverter.ToInt32(compressedBuffer, 0);
1474 memory.Write(compressedBuffer, 4, compressedBuffer.Length - 4);
1475
1476 byte[] buffer = new byte[msgLength];
1477
1478 memory.Position = 0;
1479 using (GZipStream decompressor = new GZipStream(memory, CompressionMode.Decompress))
1480 {
1481 decompressor.Read(buffer, 0, buffer.Length);
1482 }
1483
1484 return Util.UTF8.GetString(buffer);
1485 }
1486 }
1487
1391 /// <summary> 1488 /// <summary>
1392 /// Copy data from one stream to another, leaving the read position of both streams at the beginning. 1489 /// Copy data from one stream to another, leaving the read position of both streams at the beginning.
1393 /// </summary> 1490 /// </summary>
@@ -1524,19 +1621,19 @@ namespace OpenSim.Framework
1524 { 1621 {
1525 string os = String.Empty; 1622 string os = String.Empty;
1526 1623
1527 if (Environment.OSVersion.Platform != PlatformID.Unix) 1624// if (Environment.OSVersion.Platform != PlatformID.Unix)
1528 { 1625// {
1529 os = Environment.OSVersion.ToString(); 1626// os = Environment.OSVersion.ToString();
1530 } 1627// }
1531 else 1628// else
1532 { 1629// {
1533 os = ReadEtcIssue(); 1630// os = ReadEtcIssue();
1534 } 1631// }
1535 1632//
1536 if (os.Length > 45) 1633// if (os.Length > 45)
1537 { 1634// {
1538 os = os.Substring(0, 45); 1635// os = os.Substring(0, 45);
1539 } 1636// }
1540 1637
1541 return os; 1638 return os;
1542 } 1639 }
@@ -1591,6 +1688,69 @@ namespace OpenSim.Framework
1591 return displayConnectionString; 1688 return displayConnectionString;
1592 } 1689 }
1593 1690
1691 public static T ReadSettingsFromIniFile<T>(IConfig config, T settingsClass)
1692 {
1693 Type settingsType = settingsClass.GetType();
1694
1695 FieldInfo[] fieldInfos = settingsType.GetFields();
1696 foreach (FieldInfo fieldInfo in fieldInfos)
1697 {
1698 if (!fieldInfo.IsStatic)
1699 {
1700 if (fieldInfo.FieldType == typeof(System.String))
1701 {
1702 fieldInfo.SetValue(settingsClass, config.Get(fieldInfo.Name, (string)fieldInfo.GetValue(settingsClass)));
1703 }
1704 else if (fieldInfo.FieldType == typeof(System.Boolean))
1705 {
1706 fieldInfo.SetValue(settingsClass, config.GetBoolean(fieldInfo.Name, (bool)fieldInfo.GetValue(settingsClass)));
1707 }
1708 else if (fieldInfo.FieldType == typeof(System.Int32))
1709 {
1710 fieldInfo.SetValue(settingsClass, config.GetInt(fieldInfo.Name, (int)fieldInfo.GetValue(settingsClass)));
1711 }
1712 else if (fieldInfo.FieldType == typeof(System.Single))
1713 {
1714 fieldInfo.SetValue(settingsClass, config.GetFloat(fieldInfo.Name, (float)fieldInfo.GetValue(settingsClass)));
1715 }
1716 else if (fieldInfo.FieldType == typeof(System.UInt32))
1717 {
1718 fieldInfo.SetValue(settingsClass, Convert.ToUInt32(config.Get(fieldInfo.Name, ((uint)fieldInfo.GetValue(settingsClass)).ToString())));
1719 }
1720 }
1721 }
1722
1723 PropertyInfo[] propertyInfos = settingsType.GetProperties();
1724 foreach (PropertyInfo propInfo in propertyInfos)
1725 {
1726 if ((propInfo.CanRead) && (propInfo.CanWrite))
1727 {
1728 if (propInfo.PropertyType == typeof(System.String))
1729 {
1730 propInfo.SetValue(settingsClass, config.Get(propInfo.Name, (string)propInfo.GetValue(settingsClass, null)), null);
1731 }
1732 else if (propInfo.PropertyType == typeof(System.Boolean))
1733 {
1734 propInfo.SetValue(settingsClass, config.GetBoolean(propInfo.Name, (bool)propInfo.GetValue(settingsClass, null)), null);
1735 }
1736 else if (propInfo.PropertyType == typeof(System.Int32))
1737 {
1738 propInfo.SetValue(settingsClass, config.GetInt(propInfo.Name, (int)propInfo.GetValue(settingsClass, null)), null);
1739 }
1740 else if (propInfo.PropertyType == typeof(System.Single))
1741 {
1742 propInfo.SetValue(settingsClass, config.GetFloat(propInfo.Name, (float)propInfo.GetValue(settingsClass, null)), null);
1743 }
1744 if (propInfo.PropertyType == typeof(System.UInt32))
1745 {
1746 propInfo.SetValue(settingsClass, Convert.ToUInt32(config.Get(propInfo.Name, ((uint)propInfo.GetValue(settingsClass, null)).ToString())), null);
1747 }
1748 }
1749 }
1750
1751 return settingsClass;
1752 }
1753
1594 public static string Base64ToString(string str) 1754 public static string Base64ToString(string str)
1595 { 1755 {
1596 Decoder utf8Decode = Encoding.UTF8.GetDecoder(); 1756 Decoder utf8Decode = Encoding.UTF8.GetDecoder();
@@ -1645,7 +1805,7 @@ namespace OpenSim.Framework
1645 1805
1646 public static Guid GetHashGuid(string data, string salt) 1806 public static Guid GetHashGuid(string data, string salt)
1647 { 1807 {
1648 byte[] hash = ComputeMD5Hash(data + salt); 1808 byte[] hash = ComputeMD5Hash(data + salt, Encoding.Default);
1649 1809
1650 //string s = BitConverter.ToString(hash); 1810 //string s = BitConverter.ToString(hash);
1651 1811
@@ -1792,6 +1952,32 @@ namespace OpenSim.Framework
1792 return found.ToArray(); 1952 return found.ToArray();
1793 } 1953 }
1794 1954
1955 public static string ServerURI(string uri)
1956 {
1957 if (uri == string.Empty)
1958 return string.Empty;
1959
1960 // Get rid of eventual slashes at the end
1961 uri = uri.TrimEnd('/');
1962
1963 IPAddress ipaddr1 = null;
1964 string port1 = "";
1965 try
1966 {
1967 ipaddr1 = Util.GetHostFromURL(uri);
1968 }
1969 catch { }
1970
1971 try
1972 {
1973 port1 = uri.Split(new char[] { ':' })[2];
1974 }
1975 catch { }
1976
1977 // We tried our best to convert the domain names to IP addresses
1978 return (ipaddr1 != null) ? "http://" + ipaddr1.ToString() + ":" + port1 : uri;
1979 }
1980
1795 /// <summary> 1981 /// <summary>
1796 /// Convert a string to a byte format suitable for transport in an LLUDP packet. The output is truncated to 256 bytes if necessary. 1982 /// Convert a string to a byte format suitable for transport in an LLUDP packet. The output is truncated to 256 bytes if necessary.
1797 /// </summary> 1983 /// </summary>
@@ -1970,6 +2156,11 @@ namespace OpenSim.Framework
1970 } 2156 }
1971 } 2157 }
1972 2158
2159 public static void FireAndForget(System.Threading.WaitCallback callback)
2160 {
2161 FireAndForget(callback, null);
2162 }
2163
1973 public static void InitThreadPool(int minThreads, int maxThreads) 2164 public static void InitThreadPool(int minThreads, int maxThreads)
1974 { 2165 {
1975 if (maxThreads < 2) 2166 if (maxThreads < 2)
@@ -1986,7 +2177,7 @@ namespace OpenSim.Framework
1986 2177
1987 STPStartInfo startInfo = new STPStartInfo(); 2178 STPStartInfo startInfo = new STPStartInfo();
1988 startInfo.ThreadPoolName = "Util"; 2179 startInfo.ThreadPoolName = "Util";
1989 startInfo.IdleTimeout = 2000; 2180 startInfo.IdleTimeout = 20000;
1990 startInfo.MaxWorkerThreads = maxThreads; 2181 startInfo.MaxWorkerThreads = maxThreads;
1991 startInfo.MinWorkerThreads = minThreads; 2182 startInfo.MinWorkerThreads = minThreads;
1992 2183
diff --git a/OpenSim/Framework/VersionInfo.cs b/OpenSim/Framework/VersionInfo.cs
index d2979a7..ea99444 100644
--- a/OpenSim/Framework/VersionInfo.cs
+++ b/OpenSim/Framework/VersionInfo.cs
@@ -29,11 +29,15 @@ namespace OpenSim
29{ 29{
30 public class VersionInfo 30 public class VersionInfo
31 { 31 {
32<<<<<<< HEAD:OpenSim/Framework/VersionInfo.cs
32 public const string VersionNumber = "0.8.2.0"; 33 public const string VersionNumber = "0.8.2.0";
34=======
35 private const string VERSION_NUMBER = "0.8.0CM";
36>>>>>>> avn/ubitvar:OpenSim/Framework/Servers/VersionInfo.cs
33 private const Flavour VERSION_FLAVOUR = Flavour.Dev; 37 private const Flavour VERSION_FLAVOUR = Flavour.Dev;
34 38
35 public enum Flavour 39 public enum Flavour
36 { 40 {
37 Unknown, 41 Unknown,
38 Dev, 42 Dev,
39 RC1, 43 RC1,
@@ -51,7 +55,7 @@ namespace OpenSim
51 55
52 public static string GetVersionString(string versionNumber, Flavour flavour) 56 public static string GetVersionString(string versionNumber, Flavour flavour)
53 { 57 {
54 string versionString = "OpenSim " + versionNumber + " " + flavour; 58 string versionString = "Careminster " + versionNumber + " " + flavour;
55 return versionString.PadRight(VERSIONINFO_VERSION_LENGTH); 59 return versionString.PadRight(VERSIONINFO_VERSION_LENGTH);
56 } 60 }
57 61
diff --git a/OpenSim/Framework/WearableCacheItem.cs b/OpenSim/Framework/WearableCacheItem.cs
index 1aecf79..af28abc 100644
--- a/OpenSim/Framework/WearableCacheItem.cs
+++ b/OpenSim/Framework/WearableCacheItem.cs
@@ -43,12 +43,13 @@ namespace OpenSim.Framework
43 43
44 public static WearableCacheItem[] GetDefaultCacheItem() 44 public static WearableCacheItem[] GetDefaultCacheItem()
45 { 45 {
46 int itemmax = 21; 46 int itemmax = AvatarAppearance.TEXTURE_COUNT;
47 WearableCacheItem[] retitems = new WearableCacheItem[itemmax]; 47 WearableCacheItem[] retitems = new WearableCacheItem[itemmax];
48 for (uint i=0;i<itemmax;i++) 48 for (uint i=0;i<itemmax;i++)
49 retitems[i] = new WearableCacheItem() {CacheId = UUID.Zero, TextureID = UUID.Zero, TextureIndex = i + 1}; 49 retitems[i] = new WearableCacheItem() {CacheId = UUID.Zero, TextureID = UUID.Zero, TextureIndex = i};
50 return retitems; 50 return retitems;
51 } 51 }
52
52 public static WearableCacheItem[] FromOSD(OSD pInput, IImprovedAssetCache dataCache) 53 public static WearableCacheItem[] FromOSD(OSD pInput, IImprovedAssetCache dataCache)
53 { 54 {
54 List<WearableCacheItem> ret = new List<WearableCacheItem>(); 55 List<WearableCacheItem> ret = new List<WearableCacheItem>();
@@ -98,6 +99,7 @@ namespace OpenSim.Framework
98 return ret.ToArray(); 99 return ret.ToArray();
99 100
100 } 101 }
102
101 public static OSD ToOSD(WearableCacheItem[] pcacheItems, IImprovedAssetCache dataCache) 103 public static OSD ToOSD(WearableCacheItem[] pcacheItems, IImprovedAssetCache dataCache)
102 { 104 {
103 OSDArray arr = new OSDArray(); 105 OSDArray arr = new OSDArray();
@@ -124,6 +126,68 @@ namespace OpenSim.Framework
124 } 126 }
125 return arr; 127 return arr;
126 } 128 }
129
130 public static OSDArray BakedToOSD(WearableCacheItem[] pcacheItems)
131 {
132 if (pcacheItems.Length < AvatarAppearance.BAKE_INDICES[AvatarAppearance.BAKE_INDICES.Length - 1])
133 return null;
134
135 OSDArray arr = new OSDArray();
136
137 for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++)
138 {
139 int idx = AvatarAppearance.BAKE_INDICES[i];
140
141 WearableCacheItem item = pcacheItems[idx];
142
143 OSDMap itemmap = new OSDMap();
144 itemmap.Add("textureindex", OSD.FromUInteger(item.TextureIndex));
145 itemmap.Add("cacheid", OSD.FromUUID(item.CacheId));
146 itemmap.Add("textureid", OSD.FromUUID(item.TextureID));
147/*
148 if (item.TextureAsset != null)
149 {
150 itemmap.Add("assetdata", OSD.FromBinary(item.TextureAsset.Data));
151 itemmap.Add("assetcreator", OSD.FromString(item.TextureAsset.CreatorID));
152 itemmap.Add("assetname", OSD.FromString(item.TextureAsset.Name));
153 }
154 */
155 arr.Add(itemmap);
156 }
157 return arr;
158 }
159
160 public static WearableCacheItem[] BakedFromOSD(OSD pInput)
161 {
162 WearableCacheItem[] pcache = WearableCacheItem.GetDefaultCacheItem();
163
164 if (pInput.Type == OSDType.Array)
165 {
166 OSDArray itemarray = (OSDArray)pInput;
167 foreach (OSDMap item in itemarray)
168 {
169 int idx = (int)item["textureindex"].AsUInteger();
170 if (idx < 0 || idx > pcache.Length)
171 continue;
172 pcache[idx].CacheId = item["cacheid"].AsUUID();
173 pcache[idx].TextureID = item["textureid"].AsUUID();
174/*
175 if (item.ContainsKey("assetdata"))
176 {
177 AssetBase asset = new AssetBase(item["textureid"].AsUUID(), "BakedTexture", (sbyte)AssetType.Texture, UUID.Zero.ToString());
178 asset.Temporary = true;
179 asset.Local = true;
180 asset.Data = item["assetdata"].AsBinary();
181 pcache[idx].TextureAsset = asset;
182 }
183 else
184 */
185 pcache[idx].TextureAsset = null;
186 }
187 }
188 return pcache;
189 }
190
127 public static WearableCacheItem SearchTextureIndex(uint pTextureIndex,WearableCacheItem[] pcacheItems) 191 public static WearableCacheItem SearchTextureIndex(uint pTextureIndex,WearableCacheItem[] pcacheItems)
128 { 192 {
129 for (int i = 0; i < pcacheItems.Length; i++) 193 for (int i = 0; i < pcacheItems.Length; i++)
diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs
index b180c8a..94b5230 100644
--- a/OpenSim/Framework/WebUtil.cs
+++ b/OpenSim/Framework/WebUtil.cs
@@ -86,7 +86,7 @@ namespace OpenSim.Framework
86 /// Number of milliseconds a call can take before it is considered 86 /// Number of milliseconds a call can take before it is considered
87 /// a "long" call for warning & debugging purposes 87 /// a "long" call for warning & debugging purposes
88 /// </summary> 88 /// </summary>
89 public const int LongCallTime = 3000; 89 public const int LongCallTime = 500;
90 90
91 /// <summary> 91 /// <summary>
92 /// The maximum length of any data logged because of a long request time. 92 /// The maximum length of any data logged because of a long request time.
@@ -205,8 +205,16 @@ namespace OpenSim.Framework
205 { 205 {
206 if (DebugLevel == 5) 206 if (DebugLevel == 5)
207 { 207 {
208<<<<<<< HEAD
208 if (output.Length > MaxRequestDiagLength) 209 if (output.Length > MaxRequestDiagLength)
209 output = output.Substring(0, MaxRequestDiagLength) + "..."; 210 output = output.Substring(0, MaxRequestDiagLength) + "...";
211=======
212 int len = output.Length;
213 if(len > 80)
214 len = 80;
215 output = output.Substring(0, len);
216 output = output + "...";
217>>>>>>> avn/ubitvar
210 } 218 }
211 219
212 m_log.DebugFormat("[LOGHTTP]: {0}{1}", context, Util.BinaryToASCII(output)); 220 m_log.DebugFormat("[LOGHTTP]: {0}{1}", context, Util.BinaryToASCII(output));
@@ -233,6 +241,9 @@ namespace OpenSim.Framework
233 string errorMessage = "unknown error"; 241 string errorMessage = "unknown error";
234 int tickstart = Util.EnvironmentTickCount(); 242 int tickstart = Util.EnvironmentTickCount();
235 int tickdata = 0; 243 int tickdata = 0;
244 int tickcompressdata = 0;
245 int tickJsondata = 0;
246 int compsize = 0;
236 string strBuffer = null; 247 string strBuffer = null;
237 248
238 try 249 try
@@ -250,6 +261,8 @@ namespace OpenSim.Framework
250 { 261 {
251 strBuffer = OSDParser.SerializeJsonString(data); 262 strBuffer = OSDParser.SerializeJsonString(data);
252 263
264 tickJsondata = Util.EnvironmentTickCountSubtract(tickstart);
265
253 if (DebugLevel >= 5) 266 if (DebugLevel >= 5)
254 LogOutgoingDetail("SEND", reqnum, strBuffer); 267 LogOutgoingDetail("SEND", reqnum, strBuffer);
255 268
@@ -271,13 +284,23 @@ namespace OpenSim.Framework
271 // gets written on the stream upon Dispose() 284 // gets written on the stream upon Dispose()
272 } 285 }
273 byte[] buf = ms.ToArray(); 286 byte[] buf = ms.ToArray();
287
288 tickcompressdata = Util.EnvironmentTickCountSubtract(tickstart);
289
274 request.ContentLength = buf.Length; //Count bytes to send 290 request.ContentLength = buf.Length; //Count bytes to send
291 compsize = buf.Length;
275 using (Stream requestStream = request.GetRequestStream()) 292 using (Stream requestStream = request.GetRequestStream())
276 requestStream.Write(buf, 0, (int)buf.Length); 293 requestStream.Write(buf, 0, (int)buf.Length);
277 } 294 }
278 } 295 }
279 else 296 else
280 { 297 {
298<<<<<<< HEAD
299=======
300 tickcompressdata = tickJsondata;
301 compsize = buffer.Length;
302 request.ContentType = "application/json";
303>>>>>>> avn/ubitvar
281 request.ContentLength = buffer.Length; //Count bytes to send 304 request.ContentLength = buffer.Length; //Count bytes to send
282 using (Stream requestStream = request.GetRequestStream()) 305 using (Stream requestStream = request.GetRequestStream())
283 requestStream.Write(buffer, 0, buffer.Length); //Send it 306 requestStream.Write(buffer, 0, buffer.Length); //Send it
@@ -292,6 +315,7 @@ namespace OpenSim.Framework
292 { 315 {
293 using (Stream responseStream = response.GetResponseStream()) 316 using (Stream responseStream = response.GetResponseStream())
294 { 317 {
318<<<<<<< HEAD
295 using (StreamReader reader = new StreamReader(responseStream)) 319 using (StreamReader reader = new StreamReader(responseStream))
296 { 320 {
297 string responseStr = reader.ReadToEnd(); 321 string responseStr = reader.ReadToEnd();
@@ -299,6 +323,12 @@ namespace OpenSim.Framework
299 WebUtil.LogResponseDetail(reqnum, responseStr); 323 WebUtil.LogResponseDetail(reqnum, responseStr);
300 return CanonicalizeResults(responseStr); 324 return CanonicalizeResults(responseStr);
301 } 325 }
326=======
327 string responseStr = null;
328 responseStr = responseStream.GetStreamString();
329 //m_log.DebugFormat("[WEB UTIL]: <{0}> response is <{1}>",reqnum,responseStr);
330 return CanonicalizeResults(responseStr);
331>>>>>>> avn/ubitvar
302 } 332 }
303 } 333 }
304 } 334 }
@@ -314,6 +344,7 @@ namespace OpenSim.Framework
314 catch (Exception ex) 344 catch (Exception ex)
315 { 345 {
316 errorMessage = ex.Message; 346 errorMessage = ex.Message;
347 m_log.Debug("[WEB UTIL]: Exception making request: " + ex.ToString());
317 } 348 }
318 finally 349 finally
319 { 350 {
@@ -321,8 +352,21 @@ namespace OpenSim.Framework
321 if (tickdiff > LongCallTime) 352 if (tickdiff > LongCallTime)
322 { 353 {
323 m_log.InfoFormat( 354 m_log.InfoFormat(
355<<<<<<< HEAD
324 "[LOGHTTP]: Slow JSON-RPC request {0} {1} to {2} took {3}ms, {4}ms writing, {5}", 356 "[LOGHTTP]: Slow JSON-RPC request {0} {1} to {2} took {3}ms, {4}ms writing, {5}",
325 reqnum, method, url, tickdiff, tickdata, 357 reqnum, method, url, tickdiff, tickdata,
358=======
359 "[WEB UTIL]: Slow ServiceOSD request {0} {1} {2} took {3}ms, {4}ms writing({5} at Json; {6} at comp), {7} bytes ({8} uncomp): {9}",
360 reqnum,
361 method,
362 url,
363 tickdiff,
364 tickdata,
365 tickJsondata,
366 tickcompressdata,
367 compsize,
368 strBuffer != null ? strBuffer.Length : 0,
369>>>>>>> avn/ubitvar
326 strBuffer != null 370 strBuffer != null
327 ? (strBuffer.Length > MaxRequestDiagLength ? strBuffer.Remove(MaxRequestDiagLength) : strBuffer) 371 ? (strBuffer.Length > MaxRequestDiagLength ? strBuffer.Remove(MaxRequestDiagLength) : strBuffer)
328 : ""); 372 : "");
@@ -396,7 +440,7 @@ namespace OpenSim.Framework
396 /// </summary> 440 /// </summary>
397 public static OSDMap PostToService(string url, NameValueCollection data) 441 public static OSDMap PostToService(string url, NameValueCollection data)
398 { 442 {
399 return ServiceFormRequest(url,data,10000); 443 return ServiceFormRequest(url,data, 20000);
400 } 444 }
401 445
402 public static OSDMap ServiceFormRequest(string url, NameValueCollection data, int timeout) 446 public static OSDMap ServiceFormRequest(string url, NameValueCollection data, int timeout)
@@ -790,7 +834,8 @@ namespace OpenSim.Framework
790 reqnum, verb, requestUrl); 834 reqnum, verb, requestUrl);
791 835
792 int tickstart = Util.EnvironmentTickCount(); 836 int tickstart = Util.EnvironmentTickCount();
793 int tickdata = 0; 837// int tickdata = 0;
838 int tickdiff = 0;
794 839
795 Type type = typeof(TRequest); 840 Type type = typeof(TRequest);
796 841
@@ -831,10 +876,17 @@ namespace OpenSim.Framework
831 request.ContentLength = length; 876 request.ContentLength = length;
832 byte[] data = buffer.ToArray(); 877 byte[] data = buffer.ToArray();
833 878
879<<<<<<< HEAD
834 if (WebUtil.DebugLevel >= 5) 880 if (WebUtil.DebugLevel >= 5)
835 WebUtil.LogOutgoingDetail("SEND", reqnum, System.Text.Encoding.UTF8.GetString(data)); 881 WebUtil.LogOutgoingDetail("SEND", reqnum, System.Text.Encoding.UTF8.GetString(data));
836 882
837 request.BeginGetRequestStream(delegate(IAsyncResult res) 883 request.BeginGetRequestStream(delegate(IAsyncResult res)
884=======
885 // capture how much time was spent writing
886 // useless in this async
887// tickdata = Util.EnvironmentTickCountSubtract(tickstart);
888 request.BeginGetResponse(delegate(IAsyncResult ar)
889>>>>>>> avn/ubitvar
838 { 890 {
839 using (Stream requestStream = request.EndGetRequestStream(res)) 891 using (Stream requestStream = request.EndGetRequestStream(res))
840 requestStream.Write(data, 0, length); 892 requestStream.Write(data, 0, length);
@@ -844,6 +896,7 @@ namespace OpenSim.Framework
844 896
845 request.BeginGetResponse(delegate(IAsyncResult ar) 897 request.BeginGetResponse(delegate(IAsyncResult ar)
846 { 898 {
899<<<<<<< HEAD
847 using (WebResponse response = request.EndGetResponse(ar)) 900 using (WebResponse response = request.EndGetResponse(ar))
848 { 901 {
849 try 902 try
@@ -858,6 +911,14 @@ namespace OpenSim.Framework
858 { 911 {
859 } 912 }
860 } 913 }
914=======
915 // Let's not close this
916 // yes do close it
917 buffer.Close();
918 respStream.Close();
919 response.Close();
920 }
921>>>>>>> avn/ubitvar
861 922
862 action(deserial); 923 action(deserial);
863 924
@@ -919,6 +980,7 @@ namespace OpenSim.Framework
919 "[ASYNC REQUEST]: Request {0} {1} failed with exception {2}{3}", 980 "[ASYNC REQUEST]: Request {0} {1} failed with exception {2}{3}",
920 verb, requestUrl, e.Message, e.StackTrace); 981 verb, requestUrl, e.Message, e.StackTrace);
921 } 982 }
983<<<<<<< HEAD
922 984
923 // m_log.DebugFormat("[ASYNC REQUEST]: Received {0}", deserial.ToString()); 985 // m_log.DebugFormat("[ASYNC REQUEST]: Received {0}", deserial.ToString());
924 986
@@ -942,12 +1004,36 @@ namespace OpenSim.Framework
942 string originalRequest = null; 1004 string originalRequest = null;
943 1005
944 if (buffer != null) 1006 if (buffer != null)
1007=======
1008 }
1009 catch (Exception e)
1010 {
1011 m_log.ErrorFormat(
1012 "[ASYNC REQUEST]: Request {0} {1} failed with exception {2}{3}",
1013 verb, requestUrl, e.Message, e.StackTrace);
1014 }
1015
1016 // m_log.DebugFormat("[ASYNC REQUEST]: Received {0}", deserial.ToString());
1017 try
1018 {
1019 action(deserial);
1020 }
1021 catch (Exception e)
1022>>>>>>> avn/ubitvar
945 { 1023 {
946 originalRequest = Encoding.UTF8.GetString(buffer.ToArray()); 1024 originalRequest = Encoding.UTF8.GetString(buffer.ToArray());
947 1025
1026<<<<<<< HEAD
948 if (originalRequest.Length > WebUtil.MaxRequestDiagLength) 1027 if (originalRequest.Length > WebUtil.MaxRequestDiagLength)
949 originalRequest = originalRequest.Remove(WebUtil.MaxRequestDiagLength); 1028 originalRequest = originalRequest.Remove(WebUtil.MaxRequestDiagLength);
950 } 1029 }
1030=======
1031 tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
1032 if (tickdiff > WebUtil.LongCallTime)
1033 {
1034/*
1035 string originalRequest = null;
1036>>>>>>> avn/ubitvar
951 1037
952 m_log.InfoFormat( 1038 m_log.InfoFormat(
953 "[LOGHTTP]: Slow AsynchronousRequestObject request {0} {1} to {2} took {3}ms, {4}ms writing, {5}", 1039 "[LOGHTTP]: Slow AsynchronousRequestObject request {0} {1} to {2} took {3}ms, {4}ms writing, {5}",
@@ -959,11 +1045,36 @@ namespace OpenSim.Framework
959 m_log.DebugFormat("[LOGHTTP]: HTTP OUT {0} took {1}ms, {2}ms writing", 1045 m_log.DebugFormat("[LOGHTTP]: HTTP OUT {0} took {1}ms, {2}ms writing",
960 reqnum, tickdiff, tickdata); 1046 reqnum, tickdiff, tickdata);
961 } 1047 }
1048<<<<<<< HEAD
962 } 1049 }
963 finally 1050 finally
964 { 1051 {
965 if (buffer != null) 1052 if (buffer != null)
966 buffer.Dispose(); 1053 buffer.Dispose();
1054=======
1055
1056 m_log.InfoFormat(
1057 "[ASYNC REQUEST]: Slow request {0} {1} {2} took {3}ms, {4}ms writing, {5}",
1058 reqnum,
1059 verb,
1060 requestUrl,
1061 tickdiff,
1062 tickdata,
1063 originalRequest);
1064*/
1065 m_log.InfoFormat(
1066 "[ASYNC REQUEST]: Slow WebRequest SETUP <{0}> {1} {2} took {3}ms",
1067 reqnum,
1068 verb,
1069 requestUrl,
1070 tickdiff);
1071 }
1072 else if (WebUtil.DebugLevel >= 4)
1073 {
1074 m_log.DebugFormat(
1075 "[WEB UTIL]: HTTP OUT {0} took {1}ms",
1076 reqnum, tickdiff);
1077>>>>>>> avn/ubitvar
967 } 1078 }
968 } 1079 }
969 } 1080 }
@@ -1004,6 +1115,8 @@ namespace OpenSim.Framework
1004 1115
1005 string respstring = String.Empty; 1116 string respstring = String.Empty;
1006 1117
1118 int tickset = Util.EnvironmentTickCountSubtract(tickstart);
1119
1007 using (MemoryStream buffer = new MemoryStream()) 1120 using (MemoryStream buffer = new MemoryStream())
1008 { 1121 {
1009 if ((verb == "POST") || (verb == "PUT")) 1122 if ((verb == "POST") || (verb == "PUT"))
@@ -1015,14 +1128,19 @@ namespace OpenSim.Framework
1015 { 1128 {
1016 writer.Write(obj); 1129 writer.Write(obj);
1017 writer.Flush(); 1130 writer.Flush();
1131 if (WebUtil.DebugLevel >= 5)
1132 WebUtil.LogOutgoingDetail(buffer);
1018 } 1133 }
1019 1134
1020 length = (int)obj.Length; 1135 length = (int)obj.Length;
1021 request.ContentLength = length; 1136 request.ContentLength = length;
1022 byte[] data = buffer.ToArray(); 1137 byte[] data = buffer.ToArray();
1023 1138
1139<<<<<<< HEAD
1024 if (WebUtil.DebugLevel >= 5) 1140 if (WebUtil.DebugLevel >= 5)
1025 WebUtil.LogOutgoingDetail("SEND", reqnum, System.Text.Encoding.UTF8.GetString(data)); 1141 WebUtil.LogOutgoingDetail("SEND", reqnum, System.Text.Encoding.UTF8.GetString(data));
1142=======
1143>>>>>>> avn/ubitvar
1026 1144
1027 Stream requestStream = null; 1145 Stream requestStream = null;
1028 try 1146 try
@@ -1070,8 +1188,18 @@ namespace OpenSim.Framework
1070 if (tickdiff > WebUtil.LongCallTime) 1188 if (tickdiff > WebUtil.LongCallTime)
1071 { 1189 {
1072 m_log.InfoFormat( 1190 m_log.InfoFormat(
1191<<<<<<< HEAD
1073 "[LOGHTTP]: Slow SynchronousRestForms request {0} {1} to {2} took {3}ms, {4}ms writing, {5}", 1192 "[LOGHTTP]: Slow SynchronousRestForms request {0} {1} to {2} took {3}ms, {4}ms writing, {5}",
1074 reqnum, verb, requestUrl, tickdiff, tickdata, 1193 reqnum, verb, requestUrl, tickdiff, tickdata,
1194=======
1195 "[FORMS]: Slow request {0} {1} {2} took {3}ms, {4}ms writing, {5}",
1196 reqnum,
1197 verb,
1198 requestUrl,
1199 tickdiff,
1200 tickset,
1201 tickdata,
1202>>>>>>> avn/ubitvar
1075 obj.Length > WebUtil.MaxRequestDiagLength ? obj.Remove(WebUtil.MaxRequestDiagLength) : obj); 1203 obj.Length > WebUtil.MaxRequestDiagLength ? obj.Remove(WebUtil.MaxRequestDiagLength) : obj);
1076 } 1204 }
1077 else if (WebUtil.DebugLevel >= 4) 1205 else if (WebUtil.DebugLevel >= 4)
@@ -1208,6 +1336,8 @@ namespace OpenSim.Framework
1208 ht.ServicePoint.ConnectionLimit = maxConnections; 1336 ht.ServicePoint.ConnectionLimit = maxConnections;
1209 1337
1210 request.Method = verb; 1338 request.Method = verb;
1339 if (pTimeout != 0)
1340 request.Timeout = pTimeout * 1000;
1211 MemoryStream buffer = null; 1341 MemoryStream buffer = null;
1212 1342
1213 try 1343 try
@@ -1221,17 +1351,29 @@ namespace OpenSim.Framework
1221 XmlWriterSettings settings = new XmlWriterSettings(); 1351 XmlWriterSettings settings = new XmlWriterSettings();
1222 settings.Encoding = Encoding.UTF8; 1352 settings.Encoding = Encoding.UTF8;
1223 1353
1354<<<<<<< HEAD
1224 using (XmlWriter writer = XmlWriter.Create(buffer, settings)) 1355 using (XmlWriter writer = XmlWriter.Create(buffer, settings))
1225 { 1356 {
1226 XmlSerializer serializer = new XmlSerializer(type); 1357 XmlSerializer serializer = new XmlSerializer(type);
1227 serializer.Serialize(writer, obj); 1358 serializer.Serialize(writer, obj);
1228 writer.Flush(); 1359 writer.Flush();
1229 } 1360 }
1361=======
1362 using (XmlWriter writer = XmlWriter.Create(buffer, settings))
1363 {
1364 XmlSerializer serializer = new XmlSerializer(type);
1365 serializer.Serialize(writer, obj);
1366 writer.Flush();
1367 if (WebUtil.DebugLevel >= 5)
1368 WebUtil.LogOutgoingDetail(buffer);
1369 }
1370>>>>>>> avn/ubitvar
1230 1371
1231 int length = (int)buffer.Length; 1372 int length = (int)buffer.Length;
1232 request.ContentLength = length; 1373 request.ContentLength = length;
1233 byte[] data = buffer.ToArray(); 1374 byte[] data = buffer.ToArray();
1234 1375
1376<<<<<<< HEAD
1235 if (WebUtil.DebugLevel >= 5) 1377 if (WebUtil.DebugLevel >= 5)
1236 WebUtil.LogOutgoingDetail("SEND", reqnum, System.Text.Encoding.UTF8.GetString(data)); 1378 WebUtil.LogOutgoingDetail("SEND", reqnum, System.Text.Encoding.UTF8.GetString(data));
1237 1379
@@ -1255,6 +1397,9 @@ namespace OpenSim.Framework
1255 } 1397 }
1256 } 1398 }
1257 1399
1400=======
1401 Stream requestStream = null;
1402>>>>>>> avn/ubitvar
1258 try 1403 try
1259 { 1404 {
1260 using (HttpWebResponse resp = (HttpWebResponse)request.GetResponse()) 1405 using (HttpWebResponse resp = (HttpWebResponse)request.GetResponse())