aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack
diff options
context:
space:
mode:
authorubit2013-04-28 19:46:57 +0200
committerubit2013-04-28 19:46:57 +0200
commit7000b52aebcceb30163cf040a9d1b08e9bfd8412 (patch)
treee89cfcfec895c13fb6c7919580819700fa8815a3 /OpenSim/Region/ClientStack
parentMerge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork (diff)
parentMake sharing errors not spew and let the cache retry the files (diff)
downloadopensim-SC-7000b52aebcceb30163cf040a9d1b08e9bfd8412.zip
opensim-SC-7000b52aebcceb30163cf040a9d1b08e9bfd8412.tar.gz
opensim-SC-7000b52aebcceb30163cf040a9d1b08e9bfd8412.tar.bz2
opensim-SC-7000b52aebcceb30163cf040a9d1b08e9bfd8412.tar.xz
Merge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork
Diffstat (limited to 'OpenSim/Region/ClientStack')
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs5
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs4
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs27
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs21
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs81
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs20
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs108
7 files changed, 137 insertions, 129 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
index b06788b..248eab6 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
@@ -343,6 +343,9 @@ namespace OpenSim.Region.ClientStack.Linden
343 m_log.DebugFormat( 343 m_log.DebugFormat(
344 "[CAPS]: Received SEED caps request in {0} for agent {1}", m_regionName, m_HostCapsObj.AgentID); 344 "[CAPS]: Received SEED caps request in {0} for agent {1}", m_regionName, m_HostCapsObj.AgentID);
345 345
346 if (!m_HostCapsObj.WaitForActivation())
347 return string.Empty;
348
346 if (!m_Scene.CheckClient(m_HostCapsObj.AgentID, httpRequest.RemoteIPEndPoint)) 349 if (!m_Scene.CheckClient(m_HostCapsObj.AgentID, httpRequest.RemoteIPEndPoint))
347 { 350 {
348 m_log.WarnFormat( 351 m_log.WarnFormat(
@@ -1317,7 +1320,7 @@ namespace OpenSim.Region.ClientStack.Linden
1317 object_data["PhysicsShapeType"] = obj.PhysicsShapeType; 1320 object_data["PhysicsShapeType"] = obj.PhysicsShapeType;
1318 object_data["Density"] = obj.Density; 1321 object_data["Density"] = obj.Density;
1319 object_data["Friction"] = obj.Friction; 1322 object_data["Friction"] = obj.Friction;
1320 object_data["Restitution"] = obj.Bounciness; 1323 object_data["Restitution"] = obj.Restitution;
1321 object_data["GravityMultiplier"] = obj.GravityModifier; 1324 object_data["GravityMultiplier"] = obj.GravityModifier;
1322 1325
1323 resp[uuid.ToString()] = object_data; 1326 resp[uuid.ToString()] = object_data;
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs
index 986a665..f6e501d 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs
@@ -467,8 +467,8 @@ namespace OpenSim.Region.ClientStack.Linden
467 responsedata["content_type"] = "text/plain"; 467 responsedata["content_type"] = "text/plain";
468 responsedata["keepalive"] = false; 468 responsedata["keepalive"] = false;
469 responsedata["reusecontext"] = false; 469 responsedata["reusecontext"] = false;
470 responsedata["str_response_string"] = "Upstream error: "; 470 responsedata["str_response_string"] = "<llsd></llsd>";
471 responsedata["error_status_text"] = "Upstream error:"; 471 responsedata["error_status_text"] = "<llsd></llsd>";
472 responsedata["http_protocol_version"] = "HTTP/1.0"; 472 responsedata["http_protocol_version"] = "HTTP/1.0";
473 return responsedata; 473 return responsedata;
474 } 474 }
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs
index 191bccf..6ef8815 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs
@@ -59,6 +59,8 @@ namespace OpenSim.Region.ClientStack.Linden
59// private static readonly ILog m_log = 59// private static readonly ILog m_log =
60// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 60// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
61 61
62 public event SimulatorFeaturesRequestDelegate OnSimulatorFeaturesRequest;
63
62 private Scene m_scene; 64 private Scene m_scene;
63 65
64 /// <summary> 66 /// <summary>
@@ -94,6 +96,8 @@ namespace OpenSim.Region.ClientStack.Linden
94 { 96 {
95 m_scene = s; 97 m_scene = s;
96 m_scene.EventManager.OnRegisterCaps += RegisterCaps; 98 m_scene.EventManager.OnRegisterCaps += RegisterCaps;
99
100 m_scene.RegisterModuleInterface<ISimulatorFeaturesModule>(this);
97 } 101 }
98 102
99 public void RemoveRegion(Scene s) 103 public void RemoveRegion(Scene s)
@@ -156,7 +160,7 @@ namespace OpenSim.Region.ClientStack.Linden
156 IRequestHandler reqHandler 160 IRequestHandler reqHandler
157 = new RestHTTPHandler( 161 = new RestHTTPHandler(
158 "GET", "/CAPS/" + UUID.Random(), 162 "GET", "/CAPS/" + UUID.Random(),
159 HandleSimulatorFeaturesRequest, "SimulatorFeatures", agentID.ToString()); 163 x => { return HandleSimulatorFeaturesRequest(x, agentID); }, "SimulatorFeatures", agentID.ToString());
160 164
161 caps.RegisterHandler("SimulatorFeatures", reqHandler); 165 caps.RegisterHandler("SimulatorFeatures", reqHandler);
162 } 166 }
@@ -185,18 +189,33 @@ namespace OpenSim.Region.ClientStack.Linden
185 return new OSDMap(m_features); 189 return new OSDMap(m_features);
186 } 190 }
187 191
188 private Hashtable HandleSimulatorFeaturesRequest(Hashtable mDhttpMethod) 192 private OSDMap DeepCopy()
193 {
194 // This isn't the cheapest way of doing this but the rate
195 // of occurrence is low (on sim entry only) and it's a sure
196 // way to get a true deep copy.
197 OSD copy = OSDParser.DeserializeLLSDXml(OSDParser.SerializeLLSDXmlString(m_features));
198
199 return (OSDMap)copy;
200 }
201
202 private Hashtable HandleSimulatorFeaturesRequest(Hashtable mDhttpMethod, UUID agentID)
189 { 203 {
190// m_log.DebugFormat("[SIMULATOR FEATURES MODULE]: SimulatorFeatures request"); 204// m_log.DebugFormat("[SIMULATOR FEATURES MODULE]: SimulatorFeatures request");
191 205
206 OSDMap copy = DeepCopy();
207
208 SimulatorFeaturesRequestDelegate handlerOnSimulatorFeaturesRequest = OnSimulatorFeaturesRequest;
209 if (handlerOnSimulatorFeaturesRequest != null)
210 handlerOnSimulatorFeaturesRequest(agentID, ref copy);
211
192 //Send back data 212 //Send back data
193 Hashtable responsedata = new Hashtable(); 213 Hashtable responsedata = new Hashtable();
194 responsedata["int_response_code"] = 200; 214 responsedata["int_response_code"] = 200;
195 responsedata["content_type"] = "text/plain"; 215 responsedata["content_type"] = "text/plain";
196 responsedata["keepalive"] = false; 216 responsedata["keepalive"] = false;
197 217
198 lock (m_features) 218 responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(copy);
199 responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(m_features);
200 219
201 return responsedata; 220 return responsedata;
202 } 221 }
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs
index 6bed95f..eca576d 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs
@@ -190,8 +190,15 @@ namespace OpenSim.Region.ClientStack.Linden
190 { 190 {
191 if (textureEntry.FaceTextures.Length > cacheItems[i].TextureIndex) 191 if (textureEntry.FaceTextures.Length > cacheItems[i].TextureIndex)
192 { 192 {
193 cacheItems[i].TextureID = 193 Primitive.TextureEntryFace face = textureEntry.FaceTextures[cacheItems[i].TextureIndex];
194 textureEntry.FaceTextures[cacheItems[i].TextureIndex].TextureID; 194 if (face == null)
195 {
196 textureEntry.CreateFace(cacheItems[i].TextureIndex);
197 textureEntry.FaceTextures[cacheItems[i].TextureIndex].TextureID =
198 AppearanceManager.DEFAULT_AVATAR_TEXTURE;
199 continue;
200 }
201 cacheItems[i].TextureID =face.TextureID;
195 if (m_scene.AssetService != null) 202 if (m_scene.AssetService != null)
196 cacheItems[i].TextureAsset = 203 cacheItems[i].TextureAsset =
197 m_scene.AssetService.GetCached(cacheItems[i].TextureID.ToString()); 204 m_scene.AssetService.GetCached(cacheItems[i].TextureID.ToString());
@@ -213,8 +220,16 @@ namespace OpenSim.Region.ClientStack.Linden
213 { 220 {
214 if (textureEntry.FaceTextures.Length > cacheItems[i].TextureIndex) 221 if (textureEntry.FaceTextures.Length > cacheItems[i].TextureIndex)
215 { 222 {
223 Primitive.TextureEntryFace face = textureEntry.FaceTextures[cacheItems[i].TextureIndex];
224 if (face == null)
225 {
226 textureEntry.CreateFace(cacheItems[i].TextureIndex);
227 textureEntry.FaceTextures[cacheItems[i].TextureIndex].TextureID =
228 AppearanceManager.DEFAULT_AVATAR_TEXTURE;
229 continue;
230 }
216 cacheItems[i].TextureID = 231 cacheItems[i].TextureID =
217 textureEntry.FaceTextures[cacheItems[i].TextureIndex].TextureID; 232 face.TextureID;
218 } 233 }
219 else 234 else
220 { 235 {
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs
index 04cd474..707cc93 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs
@@ -39,10 +39,13 @@ using OpenSim.Framework.Servers;
39using OpenSim.Framework.Servers.HttpServer; 39using OpenSim.Framework.Servers.HttpServer;
40using OpenSim.Region.Framework.Interfaces; 40using OpenSim.Region.Framework.Interfaces;
41using OpenSim.Region.Framework.Scenes; 41using OpenSim.Region.Framework.Scenes;
42using OpenSim.Framework.Capabilities;
42using OpenSim.Services.Interfaces; 43using OpenSim.Services.Interfaces;
43using Caps = OpenSim.Framework.Capabilities.Caps; 44using Caps = OpenSim.Framework.Capabilities.Caps;
44using OpenSim.Capabilities.Handlers; 45using OpenSim.Capabilities.Handlers;
45using OpenSim.Framework.Monitoring; 46using OpenSim.Framework.Monitoring;
47using OpenMetaverse;
48using OpenMetaverse.StructuredData;
46 49
47namespace OpenSim.Region.ClientStack.Linden 50namespace OpenSim.Region.ClientStack.Linden
48{ 51{
@@ -52,11 +55,13 @@ namespace OpenSim.Region.ClientStack.Linden
52 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "WebFetchInvDescModule")] 55 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "WebFetchInvDescModule")]
53 public class WebFetchInvDescModule : INonSharedRegionModule 56 public class WebFetchInvDescModule : INonSharedRegionModule
54 { 57 {
55 struct aPollRequest 58 class aPollRequest
56 { 59 {
57 public PollServiceInventoryEventArgs thepoll; 60 public PollServiceInventoryEventArgs thepoll;
58 public UUID reqID; 61 public UUID reqID;
59 public Hashtable request; 62 public Hashtable request;
63 public ScenePresence presence;
64 public List<UUID> folders;
60 } 65 }
61 66
62 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 67 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -71,8 +76,8 @@ namespace OpenSim.Region.ClientStack.Linden
71 private Dictionary<UUID, string> m_capsDict = new Dictionary<UUID, string>(); 76 private Dictionary<UUID, string> m_capsDict = new Dictionary<UUID, string>();
72 private static Thread[] m_workerThreads = null; 77 private static Thread[] m_workerThreads = null;
73 78
74 private static OpenMetaverse.BlockingQueue<aPollRequest> m_queue = 79 private static DoubleQueue<aPollRequest> m_queue =
75 new OpenMetaverse.BlockingQueue<aPollRequest>(); 80 new DoubleQueue<aPollRequest>();
76 81
77 #region ISharedRegionModule Members 82 #region ISharedRegionModule Members
78 83
@@ -143,12 +148,18 @@ namespace OpenSim.Region.ClientStack.Linden
143 148
144 private class PollServiceInventoryEventArgs : PollServiceEventArgs 149 private class PollServiceInventoryEventArgs : PollServiceEventArgs
145 { 150 {
151 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
152
146 private Dictionary<UUID, Hashtable> responses = 153 private Dictionary<UUID, Hashtable> responses =
147 new Dictionary<UUID, Hashtable>(); 154 new Dictionary<UUID, Hashtable>();
148 155
149 public PollServiceInventoryEventArgs(UUID pId) : 156 private Scene m_scene;
157
158 public PollServiceInventoryEventArgs(Scene scene, UUID pId) :
150 base(null, null, null, null, pId, int.MaxValue) 159 base(null, null, null, null, pId, int.MaxValue)
151 { 160 {
161 m_scene = scene;
162
152 HasEvents = (x, y) => { lock (responses) return responses.ContainsKey(x); }; 163 HasEvents = (x, y) => { lock (responses) return responses.ContainsKey(x); };
153 GetEvents = (x, y) => 164 GetEvents = (x, y) =>
154 { 165 {
@@ -167,12 +178,68 @@ namespace OpenSim.Region.ClientStack.Linden
167 178
168 Request = (x, y) => 179 Request = (x, y) =>
169 { 180 {
181 ScenePresence sp = m_scene.GetScenePresence(Id);
182 if (sp == null)
183 {
184 m_log.ErrorFormat("[INVENTORY]: Unable to find ScenePresence for {0}", Id);
185 return;
186 }
187
170 aPollRequest reqinfo = new aPollRequest(); 188 aPollRequest reqinfo = new aPollRequest();
171 reqinfo.thepoll = this; 189 reqinfo.thepoll = this;
172 reqinfo.reqID = x; 190 reqinfo.reqID = x;
173 reqinfo.request = y; 191 reqinfo.request = y;
192 reqinfo.presence = sp;
193 reqinfo.folders = new List<UUID>();
194
195 // Decode the request here
196 string request = y["body"].ToString();
197
198 request = request.Replace("<string>00000000-0000-0000-0000-000000000000</string>", "<uuid>00000000-0000-0000-0000-000000000000</uuid>");
199
200 request = request.Replace("<key>fetch_folders</key><integer>0</integer>", "<key>fetch_folders</key><boolean>0</boolean>");
201 request = request.Replace("<key>fetch_folders</key><integer>1</integer>", "<key>fetch_folders</key><boolean>1</boolean>");
202
203 Hashtable hash = new Hashtable();
204 try
205 {
206 hash = (Hashtable)LLSD.LLSDDeserialize(Utils.StringToBytes(request));
207 }
208 catch (LLSD.LLSDParseException e)
209 {
210 m_log.ErrorFormat("[INVENTORY]: Fetch error: {0}{1}" + e.Message, e.StackTrace);
211 m_log.Error("Request: " + request);
212 return;
213 }
214 catch (System.Xml.XmlException)
215 {
216 m_log.ErrorFormat("[INVENTORY]: XML Format error");
217 }
218
219 ArrayList foldersrequested = (ArrayList)hash["folders"];
220
221 bool highPriority = false;
222
223 for (int i = 0; i < foldersrequested.Count; i++)
224 {
225 Hashtable inventoryhash = (Hashtable)foldersrequested[i];
226 string folder = inventoryhash["folder_id"].ToString();
227 UUID folderID;
228 if (UUID.TryParse(folder, out folderID))
229 {
230 if (!reqinfo.folders.Contains(folderID))
231 {
232 if (sp.COF != UUID.Zero && sp.COF == folderID)
233 highPriority = true;
234 reqinfo.folders.Add(folderID);
235 }
236 }
237 }
174 238
175 m_queue.Enqueue(reqinfo); 239 if (highPriority)
240 m_queue.EnqueueHigh(reqinfo);
241 else
242 m_queue.EnqueueLow(reqinfo);
176 }; 243 };
177 244
178 NoEvents = (x, y) => 245 NoEvents = (x, y) =>
@@ -208,7 +275,7 @@ namespace OpenSim.Region.ClientStack.Linden
208 response["reusecontext"] = false; 275 response["reusecontext"] = false;
209 276
210 response["str_response_string"] = m_webFetchHandler.FetchInventoryDescendentsRequest( 277 response["str_response_string"] = m_webFetchHandler.FetchInventoryDescendentsRequest(
211 requestinfo.request["body"].ToString(), String.Empty, String.Empty, null, null); 278 requestinfo.request["body"].ToString(), String.Empty, String.Empty, null, null);
212 279
213 lock (responses) 280 lock (responses)
214 responses[requestID] = response; 281 responses[requestID] = response;
@@ -220,7 +287,7 @@ namespace OpenSim.Region.ClientStack.Linden
220 string capUrl = "/CAPS/" + UUID.Random() + "/"; 287 string capUrl = "/CAPS/" + UUID.Random() + "/";
221 288
222 // Register this as a poll service 289 // Register this as a poll service
223 PollServiceInventoryEventArgs args = new PollServiceInventoryEventArgs(agentID); 290 PollServiceInventoryEventArgs args = new PollServiceInventoryEventArgs(m_scene, agentID);
224 291
225 args.Type = PollServiceEventArgs.EventType.Inventory; 292 args.Type = PollServiceEventArgs.EventType.Inventory;
226 MainServer.Instance.AddPollServiceHTTPHandler(capUrl, args); 293 MainServer.Instance.AddPollServiceHTTPHandler(capUrl, args);
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index fd82db7..0388828 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -2654,7 +2654,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2654 byte physshapetype = part.PhysicsShapeType; 2654 byte physshapetype = part.PhysicsShapeType;
2655 float density = part.Density; 2655 float density = part.Density;
2656 float friction = part.Friction; 2656 float friction = part.Friction;
2657 float bounce = part.Bounciness; 2657 float bounce = part.Restitution;
2658 float gravmod = part.GravityModifier; 2658 float gravmod = part.GravityModifier;
2659 2659
2660 eq.partPhysicsProperties(localid, physshapetype, density, friction, bounce, gravmod,AgentId); 2660 eq.partPhysicsProperties(localid, physshapetype, density, friction, bounce, gravmod,AgentId);
@@ -3893,6 +3893,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3893 part.Shape.LightEntry = false; 3893 part.Shape.LightEntry = false;
3894 } 3894 }
3895 } 3895 }
3896
3897 if (part.Shape != null && (part.Shape.SculptType == (byte)SculptType.Mesh))
3898 {
3899 // Ensure that mesh has at least 8 valid faces
3900 part.Shape.ProfileBegin = 12500;
3901 part.Shape.ProfileEnd = 0;
3902 part.Shape.ProfileHollow = 27500;
3903 }
3896 } 3904 }
3897 3905
3898 ++updatesThisCall; 3906 ++updatesThisCall;
@@ -4952,6 +4960,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4952 position = part.OffsetPosition + presence.OffsetPosition * part.RotationOffset; 4960 position = part.OffsetPosition + presence.OffsetPosition * part.RotationOffset;
4953 rotation = part.RotationOffset * presence.Rotation; 4961 rotation = part.RotationOffset * presence.Rotation;
4954 } 4962 }
4963 angularVelocity = Vector3.Zero;
4964 }
4965 else
4966 {
4967 angularVelocity = presence.AngularVelocity;
4968 rotation = presence.Rotation;
4955 } 4969 }
4956 4970
4957 attachPoint = 0; 4971 attachPoint = 0;
@@ -4963,9 +4977,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4963 // in that direction, even though we don't model this on the server. Implementing this in the future 4977 // in that direction, even though we don't model this on the server. Implementing this in the future
4964 // may improve movement smoothness. 4978 // may improve movement smoothness.
4965// acceleration = new Vector3(1, 0, 0); 4979// acceleration = new Vector3(1, 0, 0);
4966 4980
4967 angularVelocity = Vector3.Zero;
4968
4969 if (sendTexture) 4981 if (sendTexture)
4970 textureEntry = presence.Appearance.Texture.GetBytes(); 4982 textureEntry = presence.Appearance.Texture.GetBytes();
4971 else 4983 else
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
index da1ccb3..df76396 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
@@ -1903,112 +1903,4 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1903 } 1903 }
1904 } 1904 }
1905 } 1905 }
1906
1907 internal class DoubleQueue<T> where T:class
1908 {
1909 private Queue<T> m_lowQueue = new Queue<T>();
1910 private Queue<T> m_highQueue = new Queue<T>();
1911
1912 private object m_syncRoot = new object();
1913 private Semaphore m_s = new Semaphore(0, 1);
1914
1915 public DoubleQueue()
1916 {
1917 }
1918
1919 public virtual int Count
1920 {
1921 get { return m_highQueue.Count + m_lowQueue.Count; }
1922 }
1923
1924 public virtual void Enqueue(T data)
1925 {
1926 Enqueue(m_lowQueue, data);
1927 }
1928
1929 public virtual void EnqueueLow(T data)
1930 {
1931 Enqueue(m_lowQueue, data);
1932 }
1933
1934 public virtual void EnqueueHigh(T data)
1935 {
1936 Enqueue(m_highQueue, data);
1937 }
1938
1939 private void Enqueue(Queue<T> q, T data)
1940 {
1941 lock (m_syncRoot)
1942 {
1943 m_lowQueue.Enqueue(data);
1944 m_s.WaitOne(0);
1945 m_s.Release();
1946 }
1947 }
1948
1949 public virtual T Dequeue()
1950 {
1951 return Dequeue(Timeout.Infinite);
1952 }
1953
1954 public virtual T Dequeue(int tmo)
1955 {
1956 return Dequeue(TimeSpan.FromMilliseconds(tmo));
1957 }
1958
1959 public virtual T Dequeue(TimeSpan wait)
1960 {
1961 T res = null;
1962
1963 if (!Dequeue(wait, ref res))
1964 return null;
1965
1966 return res;
1967 }
1968
1969 public bool Dequeue(int timeout, ref T res)
1970 {
1971 return Dequeue(TimeSpan.FromMilliseconds(timeout), ref res);
1972 }
1973
1974 public bool Dequeue(TimeSpan wait, ref T res)
1975 {
1976 if (!m_s.WaitOne(wait))
1977 return false;
1978
1979 lock (m_syncRoot)
1980 {
1981 if (m_highQueue.Count > 0)
1982 res = m_highQueue.Dequeue();
1983 else
1984 res = m_lowQueue.Dequeue();
1985
1986 if (m_highQueue.Count == 0 && m_lowQueue.Count == 0)
1987 return true;
1988
1989 try
1990 {
1991 m_s.Release();
1992 }
1993 catch
1994 {
1995 }
1996
1997 return true;
1998 }
1999 }
2000
2001 public virtual void Clear()
2002 {
2003
2004 lock (m_syncRoot)
2005 {
2006 // Make sure sem count is 0
2007 m_s.WaitOne(0);
2008
2009 m_lowQueue.Clear();
2010 m_highQueue.Clear();
2011 }
2012 }
2013 }
2014} 1906}