From 6a02ac634b99468a0df62cdf43254020488fcb7b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 17 Jul 2016 11:39:38 +0100 Subject: identify contexts by ID now avaiable ( pipeline serialization) --- .../Framework/Servers/HttpServer/PollServiceHttpRequest.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs index 0e4a941..9083e12 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs @@ -47,8 +47,10 @@ namespace OpenSim.Framework.Servers.HttpServer public readonly UUID RequestID; public int contextHash; +/* private void GenContextHash() { + Random rnd = new Random(); contextHash = 0; if (Request.Headers["remote_addr"] != null) @@ -62,8 +64,9 @@ namespace OpenSim.Framework.Servers.HttpServer } else contextHash += rnd.Next() & 0xffff; - } + } +*/ public PollServiceHttpRequest( PollServiceEventArgs pPollServiceArgs, IHttpClientContext pHttpContext, IHttpRequest pRequest) { @@ -72,7 +75,8 @@ namespace OpenSim.Framework.Servers.HttpServer Request = pRequest; RequestTime = System.Environment.TickCount; RequestID = UUID.Random(); - GenContextHash(); +// GenContextHash(); + contextHash = HttpContext.contextID; } internal void DoHTTPGruntWork(BaseHttpServer server, Hashtable responsedata) @@ -132,8 +136,9 @@ namespace OpenSim.Framework.Servers.HttpServer { if (b1.contextHash != b2.contextHash) return false; - bool b = Object.ReferenceEquals(b1.HttpContext, b2.HttpContext); - return b; +// bool b = Object.ReferenceEquals(b1.HttpContext, b2.HttpContext); +// return b; + return true; } public int GetHashCode(PollServiceHttpRequest b2) -- cgit v1.1 From 442b27222828381a27c7c5eddc967a0de4c82d0a Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 17 Jul 2016 13:20:56 +0100 Subject: add a Drop method to PollService Event handlers, Drop requests on connections known to be lost or delay event check if they are sending a response --- OpenSim/Framework/Console/RemoteConsole.cs | 11 ++- .../Servers/HttpServer/PollServiceEventArgs.cs | 5 +- .../HttpServer/PollServiceRequestManager.cs | 95 ++++++++++++++-------- 3 files changed, 77 insertions(+), 34 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Console/RemoteConsole.cs b/OpenSim/Framework/Console/RemoteConsole.cs index 8ad7b0d..4b88923 100644 --- a/OpenSim/Framework/Console/RemoteConsole.cs +++ b/OpenSim/Framework/Console/RemoteConsole.cs @@ -234,7 +234,7 @@ namespace OpenSim.Framework.Console string uri = "/ReadResponses/" + sessionID.ToString() + "/"; m_Server.AddPollServiceHTTPHandler( - uri, new PollServiceEventArgs(null, uri, HasEvents, GetEvents, NoEvents, sessionID,25000)); // 25 secs timeout + uri, new PollServiceEventArgs(null, uri, HasEvents, GetEvents, NoEvents, Drop, sessionID, 25000)); // 25 secs timeout XmlDocument xmldoc = new XmlDocument(); XmlNode xmlnode = xmldoc.CreateNode(XmlNodeType.XmlDeclaration, @@ -425,6 +425,15 @@ namespace OpenSim.Framework.Console return false; } + private void Drop(UUID RequestID, UUID sessionID) + { + lock (m_Connections) + { + if (m_Connections.ContainsKey(sessionID)) + m_Connections.Remove(sessionID); + } + } + private Hashtable GetEvents(UUID RequestID, UUID sessionID) { ConsoleConnection c = null; diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs index 3fd3bf7..a9860cc 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs @@ -37,6 +37,7 @@ namespace OpenSim.Framework.Servers.HttpServer public delegate Hashtable GetEventsMethod(UUID requestID, UUID pId); public delegate Hashtable NoEventsMethod(UUID requestID, UUID pId); + public delegate void DropMethod(UUID requestID, UUID pId); public class PollServiceEventArgs : EventArgs { @@ -44,6 +45,7 @@ namespace OpenSim.Framework.Servers.HttpServer public GetEventsMethod GetEvents; public NoEventsMethod NoEvents; public RequestMethod Request; + public DropMethod Drop; public UUID Id; public int TimeOutms; public EventType Type; @@ -73,13 +75,14 @@ namespace OpenSim.Framework.Servers.HttpServer RequestMethod pRequest, string pUrl, HasEventsMethod pHasEvents, GetEventsMethod pGetEvents, NoEventsMethod pNoEvents, - UUID pId, int pTimeOutms) + DropMethod pDrop, UUID pId, int pTimeOutms) { Request = pRequest; Url = pUrl; HasEvents = pHasEvents; GetEvents = pGetEvents; NoEvents = pNoEvents; + Drop = pDrop; Id = pId; TimeOutms = pTimeOutms; Type = EventType.LongPoll; diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index ffcad0f..5b40590 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs @@ -160,6 +160,19 @@ namespace OpenSim.Framework.Servers.HttpServer } } + public void DropByContext(PollServiceHttpRequest req) + { + Queue ctxQeueue; + lock (m_bycontext) + { + if (m_bycontext.TryGetValue(req, out ctxQeueue)) + { + ctxQeueue.Clear(); + m_bycontext.Remove(req); + } + } + } + public void EnqueueInt(PollServiceHttpRequest req) { if (m_running) @@ -263,22 +276,61 @@ namespace OpenSim.Framework.Servers.HttpServer PollServiceHttpRequest req = m_requests.Dequeue(5000); Watchdog.UpdateThread(); - if (req != null) + if(req == null) + continue; + + try { - try + if(!req.HttpContext.CanSend()) { - if (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id)) + req.PollServiceArgs.Drop(req.RequestID, req.PollServiceArgs.Id); + byContextDequeue(req); + continue; + } + + if(req.HttpContext.IsSending()) + { + if ((Environment.TickCount - req.RequestTime) > req.PollServiceArgs.TimeOutms) { - Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id); + req.PollServiceArgs.Drop(req.RequestID, req.PollServiceArgs.Id); + byContextDequeue(req); + } + else + ReQueueEvent(req); + continue; + } + if (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id)) + { + Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id); + + m_threadPool.QueueWorkItem(x => + { + try + { + req.DoHTTPGruntWork(m_server, responsedata); + byContextDequeue(req); + } + catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream + { + // Ignore it, no need to reply + } + return null; + }, null); + } + else + { + if ((Environment.TickCount - req.RequestTime) > req.PollServiceArgs.TimeOutms) + { m_threadPool.QueueWorkItem(x => { try { - req.DoHTTPGruntWork(m_server, responsedata); + req.DoHTTPGruntWork(m_server, + req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id)); byContextDequeue(req); } - catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream + catch (ObjectDisposedException) { // Ignore it, no need to reply } @@ -287,36 +339,15 @@ namespace OpenSim.Framework.Servers.HttpServer } else { - if ((Environment.TickCount - req.RequestTime) > req.PollServiceArgs.TimeOutms) - { - m_threadPool.QueueWorkItem(x => - { - try - { - req.DoHTTPGruntWork(m_server, - req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id)); - byContextDequeue(req); - } - catch (ObjectDisposedException) - { - // Ignore it, no need to reply - } - return null; - }, null); - } - else - { - ReQueueEvent(req); - } + ReQueueEvent(req); } } - catch (Exception e) - { - m_log.ErrorFormat("Exception in poll service thread: " + e.ToString()); - } + } + catch (Exception e) + { + m_log.ErrorFormat("Exception in poll service thread: " + e.ToString()); } } } - } } -- cgit v1.1 From 79e464f33fa60e5164874e4c3e2a189c52924ae1 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 17 Jul 2016 16:16:24 +0100 Subject: dont try dequeues if didnt reacquired lock --- OpenSim/Framework/BlockingQueue.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/BlockingQueue.cs b/OpenSim/Framework/BlockingQueue.cs index daf99a8..f6861e4 100644 --- a/OpenSim/Framework/BlockingQueue.cs +++ b/OpenSim/Framework/BlockingQueue.cs @@ -78,7 +78,8 @@ namespace OpenSim.Framework { if (m_queue.Count < 1 && m_pqueue.Count < 1) { - Monitor.Wait(m_queueSync, msTimeout); + if(!Monitor.Wait(m_queueSync, msTimeout)) + return default(T); } if (m_pqueue.Count > 0) -- cgit v1.1 From 8d22b79ba49fd5a53c94f517408adb3a4fa1c100 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 7 Aug 2016 14:30:27 +0100 Subject: several changes related to culling option --- OpenSim/Framework/IClientAPI.cs | 52 +++++++++++++++----------------------- OpenSim/Framework/PriorityQueue.cs | 12 ++++----- 2 files changed, 26 insertions(+), 38 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 018f194..0140733 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -585,10 +585,10 @@ namespace OpenSim.Framework public float dwell; } - public class IEntityUpdate + public class EntityUpdate { private ISceneEntity m_entity; - private uint m_flags; + private PrimUpdateFlags m_flags; private int m_updateTime; public ISceneEntity Entity @@ -596,7 +596,7 @@ namespace OpenSim.Framework get { return m_entity; } } - public uint Flags + public PrimUpdateFlags Flags { get { return m_flags; } } @@ -606,23 +606,31 @@ namespace OpenSim.Framework get { return m_updateTime; } } - public virtual void Update(IEntityUpdate update) + public virtual void Update(EntityUpdate update) { - m_flags |= update.Flags; + PrimUpdateFlags updateFlags = update.Flags; + if(updateFlags.HasFlag(PrimUpdateFlags.CancelKill)) + m_flags = PrimUpdateFlags.FullUpdate; + else if(m_flags.HasFlag(PrimUpdateFlags.Kill)) + return; + else if(updateFlags.HasFlag(PrimUpdateFlags.Kill)) + m_flags = PrimUpdateFlags.Kill; + else + m_flags |= updateFlags; // Use the older of the updates as the updateTime if (Util.EnvironmentTickCountCompare(UpdateTime, update.UpdateTime) > 0) m_updateTime = update.UpdateTime; } - public IEntityUpdate(ISceneEntity entity, uint flags) + public EntityUpdate(ISceneEntity entity, PrimUpdateFlags flags) { m_entity = entity; m_flags = flags; m_updateTime = Util.EnvironmentTickCount(); } - public IEntityUpdate(ISceneEntity entity, uint flags, Int32 updateTime) + public EntityUpdate(ISceneEntity entity, PrimUpdateFlags flags, Int32 updateTime) { m_entity = entity; m_flags = flags; @@ -630,29 +638,6 @@ namespace OpenSim.Framework } } - public class EntityUpdate : IEntityUpdate - { - private float m_timeDilation; - - public float TimeDilation - { - get { return m_timeDilation; } - } - - public EntityUpdate(ISceneEntity entity, PrimUpdateFlags flags, float timedilation) - : base(entity, (uint)flags) - { - // Flags = flags; - m_timeDilation = timedilation; - } - - public EntityUpdate(ISceneEntity entity, PrimUpdateFlags flags, float timedilation, Int32 updateTime) - : base(entity,(uint)flags,updateTime) - { - m_timeDilation = timedilation; - } - } - public class PlacesReplyData { public UUID OwnerID; @@ -701,9 +686,12 @@ namespace OpenSim.Framework ExtraData = 1 << 20, Sound = 1 << 21, Joint = 1 << 22, - FullUpdate = UInt32.MaxValue + FullUpdate = 0x3fffffff, + CancelKill = 0x7fffffff, + Kill = 0x80000000 } +/* included in .net 4.0 public static class PrimUpdateFlagsExtensions { public static bool HasFlag(this PrimUpdateFlags updateFlags, PrimUpdateFlags flag) @@ -711,7 +699,7 @@ namespace OpenSim.Framework return (updateFlags & flag) == flag; } } - +*/ public interface IClientAPI { Vector3 StartPos { get; set; } diff --git a/OpenSim/Framework/PriorityQueue.cs b/OpenSim/Framework/PriorityQueue.cs index 4f05f65..fec01da 100644 --- a/OpenSim/Framework/PriorityQueue.cs +++ b/OpenSim/Framework/PriorityQueue.cs @@ -113,7 +113,7 @@ namespace OpenSim.Framework /// /// Enqueue an item into the specified priority queue /// - public bool Enqueue(uint pqueue, IEntityUpdate value) + public bool Enqueue(uint pqueue, EntityUpdate value) { LookupItem lookup; @@ -154,7 +154,7 @@ namespace OpenSim.Framework /// oldest item from the next queue in order to provide fair access to /// all of the queues /// - public bool TryDequeue(out IEntityUpdate value, out Int32 timeinqueue) + public bool TryDequeue(out EntityUpdate value, out Int32 timeinqueue) { // If there is anything in imediate queues, return it first no // matter what else. Breaks fairness. But very useful. @@ -212,7 +212,7 @@ namespace OpenSim.Framework } timeinqueue = 0; - value = default(IEntityUpdate); + value = default(EntityUpdate); return false; } @@ -270,8 +270,8 @@ namespace OpenSim.Framework #region MinHeapItem private struct MinHeapItem : IComparable { - private IEntityUpdate value; - internal IEntityUpdate Value { + private EntityUpdate value; + internal EntityUpdate Value { get { return this.value; } @@ -307,7 +307,7 @@ namespace OpenSim.Framework this.pqueue = pqueue; } - internal MinHeapItem(uint pqueue, UInt64 entryorder, IEntityUpdate value) + internal MinHeapItem(uint pqueue, UInt64 entryorder, EntityUpdate value) { this.entrytime = Util.EnvironmentTickCount(); this.entryorder = entryorder; -- cgit v1.1 From a0538eb53d8d1d08f4bffb2e9502537dbad3f812 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 7 Aug 2016 20:53:38 +0100 Subject: fix entity update flags update --- OpenSim/Framework/IClientAPI.cs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 0140733..848d574 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -606,21 +606,20 @@ namespace OpenSim.Framework get { return m_updateTime; } } - public virtual void Update(EntityUpdate update) + public virtual void Update(EntityUpdate oldupdate) { - PrimUpdateFlags updateFlags = update.Flags; - if(updateFlags.HasFlag(PrimUpdateFlags.CancelKill)) + // we are on the new one + PrimUpdateFlags updateFlags = oldupdate.Flags; + if(m_flags.HasFlag(PrimUpdateFlags.CancelKill)) m_flags = PrimUpdateFlags.FullUpdate; - else if(m_flags.HasFlag(PrimUpdateFlags.Kill)) - return; else if(updateFlags.HasFlag(PrimUpdateFlags.Kill)) - m_flags = PrimUpdateFlags.Kill; - else + return; + else // kill case will just merge in m_flags |= updateFlags; // Use the older of the updates as the updateTime - if (Util.EnvironmentTickCountCompare(UpdateTime, update.UpdateTime) > 0) - m_updateTime = update.UpdateTime; + if (Util.EnvironmentTickCountCompare(UpdateTime, oldupdate.UpdateTime) > 0) + m_updateTime = oldupdate.UpdateTime; } public EntityUpdate(ISceneEntity entity, PrimUpdateFlags flags) -- cgit v1.1 From 4f9378bf97b69567f8bfb06cb8764405443464ec Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 3 Sep 2016 08:50:22 +0100 Subject: remove reuse context code, they had notthing worth using and on original code when reusing contexts still in use, etc. Change DLL information to make clear it is a opensim fork, so our responsability not original author --- OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 4 ++-- OpenSim/Framework/Servers/HttpServer/Interfaces/IOSHttpResponse.cs | 2 +- OpenSim/Framework/Servers/HttpServer/OSHttpResponse.cs | 4 ++-- OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index e431042..c078a73 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -461,7 +461,7 @@ namespace OpenSim.Framework.Servers.HttpServer } OSHttpResponse resp = new OSHttpResponse(new HttpResponse(context, request),context); - resp.ReuseContext = true; +// resp.ReuseContext = true; // resp.ReuseContext = false; HandleRequest(req, resp); @@ -1804,7 +1804,7 @@ namespace OpenSim.Framework.Servers.HttpServer */ // disable this things response.KeepAlive = false; - response.ReuseContext = false; + // response.ReuseContext = false; // Cross-Origin Resource Sharing with simple requests if (responsedata.ContainsKey("access_control_allow_origin")) diff --git a/OpenSim/Framework/Servers/HttpServer/Interfaces/IOSHttpResponse.cs b/OpenSim/Framework/Servers/HttpServer/Interfaces/IOSHttpResponse.cs index f61b090..d26b68a 100644 --- a/OpenSim/Framework/Servers/HttpServer/Interfaces/IOSHttpResponse.cs +++ b/OpenSim/Framework/Servers/HttpServer/Interfaces/IOSHttpResponse.cs @@ -118,7 +118,7 @@ namespace OpenSim.Framework.Servers.HttpServer /// string StatusDescription { get; set; } - bool ReuseContext { get; set; } +// bool ReuseContext { get; set; } /// /// Add a header field and content to the response. diff --git a/OpenSim/Framework/Servers/HttpServer/OSHttpResponse.cs b/OpenSim/Framework/Servers/HttpServer/OSHttpResponse.cs index ccf9c91..8456654 100644 --- a/OpenSim/Framework/Servers/HttpServer/OSHttpResponse.cs +++ b/OpenSim/Framework/Servers/HttpServer/OSHttpResponse.cs @@ -256,7 +256,7 @@ namespace OpenSim.Framework.Servers.HttpServer _httpResponse.Reason = value; } } - +/* public bool ReuseContext { get @@ -275,7 +275,7 @@ namespace OpenSim.Framework.Servers.HttpServer } } } - +*/ protected IHttpResponse _httpResponse; private IHttpClientContext _httpClientContext; diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs index 9083e12..6537f64 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs @@ -89,7 +89,7 @@ namespace OpenSim.Framework.Servers.HttpServer response.SendChunked = false; response.ContentLength64 = buffer.Length; response.ContentEncoding = Encoding.UTF8; - response.ReuseContext = false; +// response.ReuseContext = false; try { @@ -114,7 +114,7 @@ namespace OpenSim.Framework.Servers.HttpServer response.SendChunked = false; response.ContentLength64 = 0; response.ContentEncoding = Encoding.UTF8; - response.ReuseContext = false; +// response.ReuseContext = false; response.KeepAlive = false; response.SendChunked = false; response.StatusCode = 503; -- cgit v1.1 From b51739e23ecc071a107755c7613ff274f65c3a64 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 6 Oct 2016 21:35:11 +0100 Subject: recover regions main http server ssl suport. Using a PKCS12 cert file, and not certs store for now. Option http_listener_cn, cert CN need to the same as external IP. Self sign certs do seem to work, but the viewers option NoVerifySLLCert needs to be set true. CA check is not done but they do check the IP --- OpenSim/Framework/NetworkServersInfo.cs | 4 ++++ OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 10 +++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/NetworkServersInfo.cs b/OpenSim/Framework/NetworkServersInfo.cs index dfe9695..d79eb0d 100644 --- a/OpenSim/Framework/NetworkServersInfo.cs +++ b/OpenSim/Framework/NetworkServersInfo.cs @@ -37,6 +37,8 @@ namespace OpenSim.Framework public bool isSandbox; public bool HttpUsesSSL = false; public string HttpSSLCN = ""; + public string HttpSSLCertPath = ""; + public string HttpSSLCNCertPass = ""; public uint httpSSLPort = 9001; // "Out of band" managemnt https @@ -62,6 +64,8 @@ namespace OpenSim.Framework (uint)config.Configs["Network"].GetInt("http_listener_sslport", ((int)ConfigSettings.DefaultRegionHttpPort+1)); HttpUsesSSL = config.Configs["Network"].GetBoolean("http_listener_ssl", false); HttpSSLCN = config.Configs["Network"].GetString("http_listener_cn", "localhost"); + HttpSSLCertPath = config.Configs["Network"].GetString("http_listener_cert_path", HttpSSLCertPath); + HttpSSLCNCertPass = config.Configs["Network"].GetString("http_listener_cert_pass", HttpSSLCNCertPass); // "Out of band management https" ssl_listener = config.Configs["Network"].GetBoolean("https_listener",false); diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index c078a73..29a8d3f 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -153,11 +153,19 @@ namespace OpenSim.Framework.Servers.HttpServer m_ssl = ssl; } - public BaseHttpServer(uint port, bool ssl, uint sslport, string CN) : this (port, ssl) + public BaseHttpServer(uint port, bool ssl, uint sslport, string CN, string CPath, string CPass) : this (port, ssl) { if (m_ssl) { + if(string.IsNullOrEmpty(CPass)) + throw new Exception("invalid main http server cert path"); + m_sslport = sslport; + m_cert = new X509Certificate2(CPath, CPass); + m_SSLCommonName = m_cert.GetNameInfo(X509NameType.SimpleName,false); + if(CN != m_SSLCommonName) + throw new Exception("main http server CN does not match cert CN"); + } } -- cgit v1.1 From 5b946405a09a4ec89e0d7664fabbf5015c7c62e8 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 9 Oct 2016 01:01:52 +0100 Subject: changes to regions ssl suport: verify if hostnames are validate by the selected cert, make clear that for now all regions need to have the same ExternalHostName if using sll (due to other code that needs to be changed later) --- .../Framework/Servers/HttpServer/BaseHttpServer.cs | 146 +++++++++++++++++++-- 1 file changed, 135 insertions(+), 11 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 29a8d3f..af292c6 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -43,10 +43,11 @@ using log4net; using Nwc.XmlRpc; using OpenMetaverse.StructuredData; using CoolHTTPListener = HttpServer.HttpListener; -using HttpListener=System.Net.HttpListener; -using LogPrio=HttpServer.LogPrio; +using HttpListener = System.Net.HttpListener; +using LogPrio = HttpServer.LogPrio; using OpenSim.Framework.Monitoring; using System.IO.Compression; +using System.Security.Cryptography; namespace OpenSim.Framework.Servers.HttpServer { @@ -112,6 +113,9 @@ namespace OpenSim.Framework.Servers.HttpServer private X509Certificate2 m_cert; protected bool m_firstcaps = true; protected string m_SSLCommonName = ""; + protected List m_certNames = new List(); + protected List m_certIPs = new List(); + protected string m_certCN= ""; protected IPAddress m_listenIPAddress = IPAddress.Any; @@ -153,30 +157,150 @@ namespace OpenSim.Framework.Servers.HttpServer m_ssl = ssl; } - public BaseHttpServer(uint port, bool ssl, uint sslport, string CN, string CPath, string CPass) : this (port, ssl) + private void load_cert(string CPath, string CPass) { - if (m_ssl) + try { - if(string.IsNullOrEmpty(CPass)) + m_cert = new X509Certificate2(CPath, CPass); + X509Extension ext = m_cert.Extensions["2.5.29.17"]; + if(ext != null) + { + AsnEncodedData asndata = new AsnEncodedData(ext.Oid, ext.RawData); + string datastr = asndata.Format(true); + string[] lines = datastr.Split(new char[] {'\n','\r'}); + foreach(string s in lines) + { + if(String.IsNullOrEmpty(s)) + continue; + string[] parts = s.Split(new char[] {'='}); + if(String.IsNullOrEmpty(parts[0])) + continue; + string entryName = parts[0].Replace(" ",""); + if(entryName == "DNSName") + m_certNames.Add(parts[1]); + else if(entryName == "IPAddress") + m_certIPs.Add(parts[1]); + } + } + m_certCN = m_cert.GetNameInfo(X509NameType.SimpleName, false); + } + catch + { + throw new Exception("SSL cert load error"); + } + } + + public BaseHttpServer(uint port, bool ssl, uint sslport, string CN, string CPath, string CPass) + { + m_port = port; + if (ssl) + { + if(string.IsNullOrEmpty(CPath)) throw new Exception("invalid main http server cert path"); + if(Uri.CheckHostName(CN) == UriHostNameType.Unknown) + throw new Exception("invalid main http server CN (ExternalHostName)"); + + m_certNames.Clear(); + m_certIPs.Clear(); + m_certCN= ""; + + m_ssl = true; m_sslport = sslport; - m_cert = new X509Certificate2(CPath, CPass); - m_SSLCommonName = m_cert.GetNameInfo(X509NameType.SimpleName,false); - if(CN != m_SSLCommonName) - throw new Exception("main http server CN does not match cert CN"); + load_cert(CPath, CPass); + + if(!CheckSSLCertHost(CN)) + throw new Exception("invalid main http server CN (ExternalHostName)"); + + m_SSLCommonName = CN; + + if(m_cert.Issuer == m_cert.Subject ) + m_log.Warn("Self signed certificate. Clients need to allow this (some viewers debug option NoVerifySSLcert must be set to true"); + } + else + m_ssl = false; } public BaseHttpServer(uint port, bool ssl, string CPath, string CPass) : this (port, ssl) { if (m_ssl) { - m_cert = new X509Certificate2(CPath, CPass); + load_cert(CPath, CPass); + if(m_cert.Issuer == m_cert.Subject ) + m_log.Warn("Self signed certificate. Http clients need to allow this"); + } + } + + static bool MatchDNS (string hostname, string dns) + { + int indx = dns.IndexOf ('*'); + if (indx == -1) + return (String.Compare(hostname, dns, true, CultureInfo.InvariantCulture) == 0); + + int dnslen = dns.Length; + dnslen--; + if(indx == dnslen) + return true; // just * ? + + if(indx > dnslen - 2) + return false; // 2 short ? + + if (dns[indx + 1] != '.') + return false; + + int indx2 = dns.IndexOf ('*', indx + 1); + if (indx2 != -1) + return false; // there can only be one; + + string end = dns.Substring(indx + 1); + int hostlen = hostname.Length; + int endlen = end.Length; + int length = hostlen - endlen; + if (length <= 0) + return false; + + if (String.Compare(hostname, length, end, 0, endlen, true, CultureInfo.InvariantCulture) != 0) + return false; + + if (indx == 0) + { + indx2 = hostname.IndexOf ('.'); + return ((indx2 == -1) || (indx2 >= length)); + } + + string start = dns.Substring (0, indx); + return (String.Compare (hostname, 0, start, 0, start.Length, true, CultureInfo.InvariantCulture) == 0); + } + + public bool CheckSSLCertHost(string hostname) + { + UriHostNameType htype = Uri.CheckHostName(hostname); + + if(htype == UriHostNameType.Unknown || htype == UriHostNameType.Basic) + return false; + if(htype == UriHostNameType.Dns) + { + foreach(string name in m_certNames) + { + if(MatchDNS(hostname, name)) + return true; + } + if(MatchDNS(hostname, m_certCN)) + return true; + } + else + { + foreach(string ip in m_certIPs) + { + if (String.Compare(hostname, ip, true, CultureInfo.InvariantCulture) != 0) + return true; + } } - } + return false; + } /// /// Add a stream handler to the http server. If the handler already exists, then nothing happens. /// -- cgit v1.1 From 80d4f76d182f919740d80b665a8cc445d014b540 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 9 Oct 2016 20:18:20 +0100 Subject: keep a unsecure http port up for external services (datasnapshot search). Only fire poolservices on main http listener --- .../Framework/Servers/HttpServer/BaseHttpServer.cs | 29 +++++++++++----------- OpenSim/Framework/Servers/MainServer.cs | 16 ++++++++++++ 2 files changed, 30 insertions(+), 15 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index af292c6..bd8b681 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -111,7 +111,6 @@ namespace OpenSim.Framework.Servers.HttpServer protected uint m_sslport; protected bool m_ssl; private X509Certificate2 m_cert; - protected bool m_firstcaps = true; protected string m_SSLCommonName = ""; protected List m_certNames = new List(); protected List m_certIPs = new List(); @@ -152,11 +151,6 @@ namespace OpenSim.Framework.Servers.HttpServer m_port = port; } - public BaseHttpServer(uint port, bool ssl) : this (port) - { - m_ssl = ssl; - } - private void load_cert(string CPath, string CPass) { try @@ -216,21 +210,24 @@ namespace OpenSim.Framework.Servers.HttpServer if(m_cert.Issuer == m_cert.Subject ) m_log.Warn("Self signed certificate. Clients need to allow this (some viewers debug option NoVerifySSLcert must be set to true"); - - } else m_ssl = false; } - public BaseHttpServer(uint port, bool ssl, string CPath, string CPass) : this (port, ssl) + public BaseHttpServer(uint port, bool ssl, string CPath, string CPass) { - if (m_ssl) + m_port = port; + if (ssl) { load_cert(CPath, CPass); if(m_cert.Issuer == m_cert.Subject ) m_log.Warn("Self signed certificate. Http clients need to allow this"); + m_ssl = true; + m_sslport = port; } + else + m_ssl = false; } static bool MatchDNS (string hostname, string dns) @@ -2038,7 +2035,7 @@ namespace OpenSim.Framework.Servers.HttpServer public void Start() { - Start(true); + Start(true,true); } /// @@ -2048,7 +2045,7 @@ namespace OpenSim.Framework.Servers.HttpServer /// If true then poll responses are performed asynchronsly. /// Option exists to allow regression tests to perform processing synchronously. /// - public void Start(bool performPollResponsesAsync) + public void Start(bool performPollResponsesAsync, bool runPool) { m_log.InfoFormat( "[BASE HTTP SERVER]: Starting {0} server on port {1}", UseSSL ? "HTTPS" : "HTTP", Port); @@ -2086,9 +2083,11 @@ namespace OpenSim.Framework.Servers.HttpServer m_httpListener2.Start(64); // Long Poll Service Manager with 3 worker threads a 25 second timeout for no events - - PollServiceRequestManager = new PollServiceRequestManager(this, performPollResponsesAsync, 2, 25000); - PollServiceRequestManager.Start(); + if(runPool) + { + PollServiceRequestManager = new PollServiceRequestManager(this, performPollResponsesAsync, 2, 25000); + PollServiceRequestManager.Start(); + } HTTPDRunning = true; diff --git a/OpenSim/Framework/Servers/MainServer.cs b/OpenSim/Framework/Servers/MainServer.cs index 57931d4..e9c284c 100644 --- a/OpenSim/Framework/Servers/MainServer.cs +++ b/OpenSim/Framework/Servers/MainServer.cs @@ -42,6 +42,7 @@ namespace OpenSim.Framework.Servers // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static BaseHttpServer instance = null; + private static BaseHttpServer unsecureinstance = null; private static Dictionary m_Servers = new Dictionary(); /// @@ -93,6 +94,21 @@ namespace OpenSim.Framework.Servers } } + + public static BaseHttpServer ÚnSecureInstance + { + get { return unsecureinstance; } + + set + { + lock (m_Servers) + if (!m_Servers.ContainsValue(value)) + throw new Exception("HTTP server must already have been registered to be set as the main instance"); + + unsecureinstance = value; + } + } + /// /// Get all the registered servers. /// -- cgit v1.1 From 08dee3fa34f72912cab3c5facdc79083e85b39ef Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 19 Nov 2016 15:46:47 +0000 Subject: fix pool parameters for httptests --- OpenSim/Framework/Console/RemoteConsole.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Console/RemoteConsole.cs b/OpenSim/Framework/Console/RemoteConsole.cs index 9049b4b..b9c7537 100644 --- a/OpenSim/Framework/Console/RemoteConsole.cs +++ b/OpenSim/Framework/Console/RemoteConsole.cs @@ -403,7 +403,7 @@ namespace OpenSim.Framework.Console string uri = "/ReadResponses/" + sessionID.ToString() + "/"; m_Server.AddPollServiceHTTPHandler( - uri, new PollServiceEventArgs(null, uri, HasEvents, GetEvents, NoEvents, sessionID,25000)); // 25 secs timeout + uri, new PollServiceEventArgs(null, uri, HasEvents, GetEvents, NoEvents, null, sessionID,25000)); // 25 secs timeout // Our reply is an XML document. // TODO: Change this to Linq.Xml -- cgit v1.1 From 3a81642d979a84c5c2e666cb500e080d56f887ed Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 7 Dec 2016 13:30:07 +0000 Subject: add SSL certs validation options for regions to allow simple encriptation without any peer autentification using simple homemade (or even shared) certs. --- OpenSim/Framework/Servers/BaseOpenSimServer.cs | 30 +++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index 1d4deac..541b658 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs @@ -33,6 +33,9 @@ using System.Text; using System.Text.RegularExpressions; using System.Threading; using System.Timers; +using System.Net; +using System.Net.Security; +using System.Security.Cryptography.X509Certificates; using log4net; using log4net.Appender; using log4net.Core; @@ -85,7 +88,27 @@ namespace OpenSim.Framework.Servers // Random uuid for private data m_osSecret = UUID.Random().ToString(); } - + + private static bool m_NoVerifyCertChain = false; + private static bool m_NoVerifyCertHostname = false; + + public static bool ValidateServerCertificate( + object sender, + X509Certificate certificate, + X509Chain chain, + SslPolicyErrors sslPolicyErrors) + { + if (m_NoVerifyCertChain) + sslPolicyErrors &= ~SslPolicyErrors.RemoteCertificateChainErrors; + + if (m_NoVerifyCertHostname) + sslPolicyErrors &= ~SslPolicyErrors.RemoteCertificateNameMismatch; + + if (sslPolicyErrors == SslPolicyErrors.None) + return true; + + return false; + } /// /// Must be overriden by child classes for their own server specific startup behaviour. /// @@ -96,6 +119,11 @@ namespace OpenSim.Framework.Servers RegisterCommonComponents(Config); IConfig startupConfig = Config.Configs["Startup"]; + + m_NoVerifyCertChain = startupConfig.GetBoolean("NoVerifyCertChain", m_NoVerifyCertChain); + m_NoVerifyCertHostname = startupConfig.GetBoolean("NoVerifyCertHostname", m_NoVerifyCertHostname); + ServicePointManager.ServerCertificateValidationCallback = ValidateServerCertificate; + int logShowStatsSeconds = startupConfig.GetInt("LogShowStatsSeconds", m_periodDiagnosticTimerMS / 1000); m_periodDiagnosticTimerMS = logShowStatsSeconds * 1000; m_periodicDiagnosticsTimer.Elapsed += new ElapsedEventHandler(LogDiagnostics); -- cgit v1.1 From 806e75eefbba1a55a3cb22470af3adf8d87b8767 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 8 Dec 2016 23:39:55 +0000 Subject: remove not needed sslport parameter --- OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index bd8b681..01d427e 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -108,7 +108,6 @@ namespace OpenSim.Framework.Servers.HttpServer new Dictionary(); protected uint m_port; - protected uint m_sslport; protected bool m_ssl; private X509Certificate2 m_cert; protected string m_SSLCommonName = ""; @@ -120,9 +119,14 @@ namespace OpenSim.Framework.Servers.HttpServer public PollServiceRequestManager PollServiceRequestManager { get; private set; } + public string Protocol + { + get { return m_ssl ? "https://" : "http://"; } + } + public uint SSLPort { - get { return m_sslport; } + get { return m_port; } } public string SSLCommonName @@ -184,7 +188,7 @@ namespace OpenSim.Framework.Servers.HttpServer } } - public BaseHttpServer(uint port, bool ssl, uint sslport, string CN, string CPath, string CPass) + public BaseHttpServer(uint port, bool ssl, string CN, string CPath, string CPass) { m_port = port; if (ssl) @@ -200,7 +204,6 @@ namespace OpenSim.Framework.Servers.HttpServer m_certCN= ""; m_ssl = true; - m_sslport = sslport; load_cert(CPath, CPass); if(!CheckSSLCertHost(CN)) @@ -224,7 +227,6 @@ namespace OpenSim.Framework.Servers.HttpServer if(m_cert.Issuer == m_cert.Subject ) m_log.Warn("Self signed certificate. Http clients need to allow this"); m_ssl = true; - m_sslport = port; } else m_ssl = false; @@ -2101,7 +2103,7 @@ namespace OpenSim.Framework.Servers.HttpServer catch (Exception e) { m_log.Error("[BASE HTTP SERVER]: Error - " + e.Message); - m_log.Error("[BASE HTTP SERVER]: Tip: Do you have permission to listen on port " + m_port + ", " + m_sslport + "?"); + m_log.Error("[BASE HTTP SERVER]: Tip: Do you have permission to listen on port " + m_port + "?"); // We want this exception to halt the entire server since in current configurations we aren't too // useful without inbound HTTP. -- cgit v1.1 From 6627da693e48836334016e26ddc1cd71b99e0fa8 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 9 Dec 2016 04:07:06 +0000 Subject: suport client certificate validation per listenner, with a supplied static callback --- OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 01d427e..0492b51 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -32,6 +32,7 @@ using System.Collections.Specialized; using System.IO; using System.Net; using System.Net.Sockets; +using System.Net.Security; using System.Security.Cryptography.X509Certificates; using System.Reflection; using System.Globalization; @@ -114,6 +115,7 @@ namespace OpenSim.Framework.Servers.HttpServer protected List m_certNames = new List(); protected List m_certIPs = new List(); protected string m_certCN= ""; + protected RemoteCertificateValidationCallback m_certificateValidationCallback = null; protected IPAddress m_listenIPAddress = IPAddress.Any; @@ -2076,6 +2078,8 @@ namespace OpenSim.Framework.Servers.HttpServer //m_httpListener.Prefixes.Add("https://+:" + (m_sslport) + "/"); //m_httpListener.Prefixes.Add("http://+:" + m_port + "/"); m_httpListener2 = CoolHTTPListener.Create(IPAddress.Any, (int)m_port, m_cert); + if(m_certificateValidationCallback != null) + m_httpListener2.CertificateValidationCallback = m_certificateValidationCallback; m_httpListener2.ExceptionThrown += httpServerException; m_httpListener2.LogWriter = httpserverlog; } -- cgit v1.1 From 30dccd57cd0e9fcc676e77cfed4214d8a1e7f85c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 9 Dec 2016 04:32:59 +0000 Subject: provide remote SSLcommonName to xmlRpcRequest methods, but in a away it can be detected/parsed. This is used by some external modules like DTLNSLMoneyServer. But this module does need to change on this ( and it cannot override default validation rules, it needs to do it on its httplistener with method provided in previus commits --- OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 0492b51..d7e5123 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -1231,6 +1231,17 @@ namespace OpenSim.Framework.Servers.HttpServer if (gridproxy) xmlRprcRequest.Params.Add("gridproxy"); // Param[4] + + // reserve this for + // ... by Fumi.Iseki for DTLNSLMoneyServer + // BUT make its presence possible to detect/parse + string rcn = request.IHttpClientContext.SSLCommonName; + if(!string.IsNullOrWhiteSpace(rcn)) + { + rcn = "SSLCN:" + rcn; + xmlRprcRequest.Params.Add(rcn); // Param[4] or Param[5] + } + try { xmlRpcResponse = method(xmlRprcRequest, request.RemoteIPEndPoint); -- cgit v1.1 From 5fc36059552231ac5f79592f7d1845643dd89524 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 30 Dec 2016 07:15:28 +0000 Subject: some cleanup, use more using(), more checks so http request mem stream is closed --- .../Framework/Servers/HttpServer/BaseHttpServer.cs | 69 +++++++++------------- 1 file changed, 27 insertions(+), 42 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index d7e5123..9c6ee9c 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -529,14 +529,10 @@ namespace OpenSim.Framework.Servers.HttpServer if (psEvArgs.Request != null) { OSHttpRequest req = new OSHttpRequest(context, request); - - Stream requestStream = req.InputStream; - + string requestBody = String.Empty; Encoding encoding = Encoding.UTF8; - StreamReader reader = new StreamReader(requestStream, encoding); - - string requestBody = reader.ReadToEnd(); - reader.Close(); + using(StreamReader reader = new StreamReader(req.InputStream, encoding)) + requestBody = reader.ReadToEnd(); Hashtable keysvals = new Hashtable(); Hashtable headervals = new Hashtable(); @@ -630,6 +626,8 @@ namespace OpenSim.Framework.Servers.HttpServer byte[] buffer500 = SendHTML500(response); response.OutputStream.Write(buffer500, 0, buffer500.Length); response.Send(); + if(request.InputStream.CanRead) + request.InputStream.Close(); } catch { @@ -674,7 +672,6 @@ namespace OpenSim.Framework.Servers.HttpServer // } // } - //response.KeepAlive = true; response.SendChunked = false; string path = request.RawUrl; @@ -698,15 +695,10 @@ namespace OpenSim.Framework.Servers.HttpServer { //m_log.Debug("[BASE HTTP SERVER]: Found Caps based HTTP Handler"); IGenericHTTPHandler HTTPRequestHandler = requestHandler as IGenericHTTPHandler; - Stream requestStream = request.InputStream; - + string requestBody = String.Empty; Encoding encoding = Encoding.UTF8; - StreamReader reader = new StreamReader(requestStream, encoding); - - string requestBody = reader.ReadToEnd(); - - reader.Close(); - //requestStream.Close(); + using(StreamReader reader = new StreamReader(request.InputStream, encoding)) + requestBody = reader.ReadToEnd(); Hashtable keysvals = new Hashtable(); Hashtable headervals = new Hashtable(); @@ -746,7 +738,6 @@ namespace OpenSim.Framework.Servers.HttpServer else { IStreamHandler streamHandler = (IStreamHandler)requestHandler; - using (MemoryStream memoryStream = new MemoryStream()) { streamHandler.Handle(path, request.InputStream, memoryStream, request, response); @@ -823,8 +814,6 @@ namespace OpenSim.Framework.Servers.HttpServer } } - request.InputStream.Close(); - if (buffer != null) { if (WebUtil.DebugLevel >= 5) @@ -856,10 +845,6 @@ namespace OpenSim.Framework.Servers.HttpServer requestEndTick = Environment.TickCount; response.Send(); - - //response.OutputStream.Close(); - - //response.FreeContext(); } catch (SocketException e) { @@ -891,6 +876,9 @@ namespace OpenSim.Framework.Servers.HttpServer } finally { + if(request.InputStream.CanRead) + request.InputStream.Close(); + // Every month or so this will wrap and give bad numbers, not really a problem // since its just for reporting int tickdiff = requestEndTick - requestStartTick; @@ -1148,9 +1136,10 @@ namespace OpenSim.Framework.Servers.HttpServer } finally { - if (innerStream != null) + if (innerStream != null && innerStream.CanRead) innerStream.Dispose(); - requestStream.Dispose(); + if (requestStream.CanRead) + requestStream.Dispose(); } //m_log.Debug(requestBody); @@ -1407,15 +1396,15 @@ namespace OpenSim.Framework.Servers.HttpServer //m_log.Warn("[BASE HTTP SERVER]: We've figured out it's a LLSD Request"); Stream requestStream = request.InputStream; + string requestBody = string.Empty; Encoding encoding = Encoding.UTF8; - StreamReader reader = new StreamReader(requestStream, encoding); + using(StreamReader reader = new StreamReader(requestStream,encoding)) + requestBody = reader.ReadToEnd(); - string requestBody = reader.ReadToEnd(); - reader.Close(); - requestStream.Close(); + if(requestStream.CanRead) + requestStream.Close(); //m_log.DebugFormat("[OGP]: {0}:{1}", request.RawUrl, requestBody); - response.KeepAlive = true; OSD llsdRequest = null; OSD llsdResponse = null; @@ -1736,15 +1725,12 @@ namespace OpenSim.Framework.Servers.HttpServer byte[] buffer; Stream requestStream = request.InputStream; - + string requestBody = string.Empty; Encoding encoding = Encoding.UTF8; - StreamReader reader = new StreamReader(requestStream, encoding); - - string requestBody = reader.ReadToEnd(); - // avoid warning for now - reader.ReadToEnd(); - reader.Close(); - requestStream.Close(); + using(StreamReader reader = new StreamReader(requestStream,encoding)) + requestBody = reader.ReadToEnd(); + if(requestStream.CanRead) + requestStream.Close(); Hashtable keysvals = new Hashtable(); Hashtable headervals = new Hashtable(); @@ -2283,10 +2269,9 @@ namespace OpenSim.Framework.Servers.HttpServer string file = Path.Combine(".", "http_500.html"); if (!File.Exists(file)) return getDefaultHTTP500(); - - StreamReader sr = File.OpenText(file); - string result = sr.ReadToEnd(); - sr.Close(); + string result = string.Empty; + using(StreamReader sr = File.OpenText(file)) + result = sr.ReadToEnd(); return result; } -- cgit v1.1 From 443fc60cdf399a49832e787ca58c2644bef7e457 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 1 Apr 2017 17:49:17 +0100 Subject: store the physics inertia override in Mysql and add it to serializer. run prebuild is required --- OpenSim/Framework/PhysicsInertia.cs | 262 ++++++++++++++++++++++++++++++++++++ 1 file changed, 262 insertions(+) create mode 100644 OpenSim/Framework/PhysicsInertia.cs (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/PhysicsInertia.cs b/OpenSim/Framework/PhysicsInertia.cs new file mode 100644 index 0000000..af70634 --- /dev/null +++ b/OpenSim/Framework/PhysicsInertia.cs @@ -0,0 +1,262 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using OpenMetaverse; +using System.Text; +using System.IO; +using System.Xml; + +namespace OpenSim.Framework +{ + public class PhysicsInertiaData + { + public float TotalMass; // the total mass of a linkset + public Vector3 CenterOfMass; // the center of mass position relative to root part position + public Vector3 Inertia; // (Ixx, Iyy, Izz) moment of inertia relative to center of mass and principal axis in local coords + public Vector4 InertiaRotation; // if principal axis don't match local axis, the principal axis rotation + // or the upper triangle of the inertia tensor + // Ixy (= Iyx), Ixz (= Izx), Iyz (= Izy)) + + public PhysicsInertiaData() + { + } + + public PhysicsInertiaData(PhysicsInertiaData source) + { + TotalMass = source.TotalMass; + CenterOfMass = source.CenterOfMass; + Inertia = source.Inertia; + InertiaRotation = source.InertiaRotation; + } + + private XmlTextWriter writer; + + private void XWint(string name, int i) + { + writer.WriteElementString(name, i.ToString()); + } + + private void XWfloat(string name, float f) + { + writer.WriteElementString(name, f.ToString(Utils.EnUsCulture)); + } + + private void XWVector(string name, Vector3 vec) + { + writer.WriteStartElement(name); + writer.WriteElementString("X", vec.X.ToString(Utils.EnUsCulture)); + writer.WriteElementString("Y", vec.Y.ToString(Utils.EnUsCulture)); + writer.WriteElementString("Z", vec.Z.ToString(Utils.EnUsCulture)); + writer.WriteEndElement(); + } + + private void XWVector4(string name, Vector4 quat) + { + writer.WriteStartElement(name); + writer.WriteElementString("X", quat.X.ToString(Utils.EnUsCulture)); + writer.WriteElementString("Y", quat.Y.ToString(Utils.EnUsCulture)); + writer.WriteElementString("Z", quat.Z.ToString(Utils.EnUsCulture)); + writer.WriteElementString("W", quat.W.ToString(Utils.EnUsCulture)); + writer.WriteEndElement(); + } + + public void ToXml2(XmlTextWriter twriter) + { + writer = twriter; + writer.WriteStartElement("PhysicsInertia"); + + XWfloat("MASS", TotalMass); + XWVector("CM", CenterOfMass); + XWVector("INERTIA", Inertia); + XWVector4("IROT", InertiaRotation); + + writer.WriteEndElement(); + writer = null; + } + + XmlReader reader; + + private int XRint() + { + return reader.ReadElementContentAsInt(); + } + + private float XRfloat() + { + return reader.ReadElementContentAsFloat(); + } + + public Vector3 XRvector() + { + Vector3 vec; + reader.ReadStartElement(); + vec.X = reader.ReadElementContentAsFloat(); + vec.Y = reader.ReadElementContentAsFloat(); + vec.Z = reader.ReadElementContentAsFloat(); + reader.ReadEndElement(); + return vec; + } + + public Vector4 XRVector4() + { + Vector4 q; + reader.ReadStartElement(); + q.X = reader.ReadElementContentAsFloat(); + q.Y = reader.ReadElementContentAsFloat(); + q.Z = reader.ReadElementContentAsFloat(); + q.W = reader.ReadElementContentAsFloat(); + reader.ReadEndElement(); + return q; + } + + public static bool EReadProcessors( + Dictionary processors, + XmlReader xtr) + { + bool errors = false; + + string nodeName = string.Empty; + while (xtr.NodeType != XmlNodeType.EndElement) + { + nodeName = xtr.Name; + + Action p = null; + if (processors.TryGetValue(xtr.Name, out p)) + { + try + { + p(); + } + catch + { + errors = true; + if (xtr.NodeType == XmlNodeType.EndElement) + xtr.Read(); + } + } + else + { + xtr.ReadOuterXml(); // ignore + } + } + + return errors; + } + + public string ToXml2() + { + using (StringWriter sw = new StringWriter()) + { + using (XmlTextWriter xwriter = new XmlTextWriter(sw)) + { + ToXml2(xwriter); + } + + return sw.ToString(); + } + } + + public static PhysicsInertiaData FromXml2(string text) + { + if (text == String.Empty) + return null; + + UTF8Encoding enc = new UTF8Encoding(); + MemoryStream ms = new MemoryStream(enc.GetBytes(text)); + XmlTextReader xreader = new XmlTextReader(ms); + + PhysicsInertiaData v = new PhysicsInertiaData(); + bool error; + + v.FromXml2(xreader, out error); + + xreader.Close(); + + if (error) + return null; + + return v; + } + + public static PhysicsInertiaData FromXml2(XmlReader reader) + { + PhysicsInertiaData data = new PhysicsInertiaData(); + + bool errors = false; + + data.FromXml2(reader, out errors); + if (errors) + return null; + + return data; + } + + private void FromXml2(XmlReader _reader, out bool errors) + { + errors = false; + reader = _reader; + + Dictionary m_XmlProcessors = new Dictionary(); + + m_XmlProcessors.Add("MASS", ProcessXR_Mass); + m_XmlProcessors.Add("CM", ProcessXR_CM); + m_XmlProcessors.Add("INERTIA", ProcessXR_Inertia); + m_XmlProcessors.Add("IROT", ProcessXR_InertiaRotation); + + reader.ReadStartElement("PhysicsInertia", String.Empty); + + errors = EReadProcessors( + m_XmlProcessors, + reader); + + reader.ReadEndElement(); + reader = null; + } + + private void ProcessXR_Mass() + { + TotalMass = XRfloat(); + } + + private void ProcessXR_CM() + { + CenterOfMass = XRvector(); + } + + private void ProcessXR_Inertia() + { + Inertia = XRvector(); + } + + private void ProcessXR_InertiaRotation() + { + InertiaRotation = XRVector4(); + } + } +} -- cgit v1.1 From 63383bf3c5f5923b33e43ddd6b24b5616288ff4f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 14 Apr 2017 21:55:37 +0100 Subject: add functions to send entity updates imediatly, except for avatars (or now) they should be use to bypass normal delayed updates, for debug --- OpenSim/Framework/IClientAPI.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index ab6d58f..6cb37b2 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -685,9 +685,10 @@ namespace OpenSim.Framework ExtraData = 1 << 20, Sound = 1 << 21, Joint = 1 << 22, - FullUpdate = 0x3fffffff, - CancelKill = 0x7fffffff, - Kill = 0x80000000 + FullUpdate = 0x0fffffff, + SendInTransit = 1 << 30, + CancelKill = 0x4fffffff, // 1 << 31 + Kill = 0x80000000 // 1 << 32 } /* included in .net 4.0 @@ -1187,7 +1188,8 @@ namespace OpenSim.Framework void SetAgentThrottleSilent(int throttle, int setting); int GetAgentThrottleSilent(int throttle); - void SendAvatarDataImmediate(ISceneEntity avatar); + void SendEntityFullUpdateImmediate(ISceneEntity entity); + void SendEntityTerseUpdateImmediate(ISceneEntity entity); /// /// Send a positional, velocity, etc. update to the viewer for a given entity. -- cgit v1.1 From 0f7ffc56cee22aa95af58d19d3ea2193cea07340 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 15 Apr 2017 10:46:18 +0100 Subject: several changes for osTeleportObject --- OpenSim/Framework/IClientAPI.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 6cb37b2..5ca8c88 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -685,10 +685,10 @@ namespace OpenSim.Framework ExtraData = 1 << 20, Sound = 1 << 21, Joint = 1 << 22, - FullUpdate = 0x0fffffff, - SendInTransit = 1 << 30, - CancelKill = 0x4fffffff, // 1 << 31 - Kill = 0x80000000 // 1 << 32 + FullUpdate = 0x0fffffff, + SendInTransit = 0x20000000, + CancelKill = 0x4fffffff, // 1 << 30 + Kill = 0x80000000 // 1 << 31 } /* included in .net 4.0 -- cgit v1.1 From 7c5376f224743358a7640477fedfd9de5b27b48d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 25 Apr 2017 14:21:01 +0100 Subject: move mesh pbs creation code out of mesh upload code into to PrimitiveBaseShape.cs --- OpenSim/Framework/PrimitiveBaseShape.cs | 64 +++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs index 29985d2..a830551 100644 --- a/OpenSim/Framework/PrimitiveBaseShape.cs +++ b/OpenSim/Framework/PrimitiveBaseShape.cs @@ -328,6 +328,70 @@ namespace OpenSim.Framework return shape; } + public static PrimitiveBaseShape CreateMesh(int numberOfFaces, UUID meshAssetID) + { + PrimitiveBaseShape shape = new PrimitiveBaseShape(); + + shape._pathScaleX = 100; + shape._pathScaleY = 100; + + if(numberOfFaces <= 0) // oops ? + numberOfFaces = 1; + + switch(numberOfFaces) + { + case 1: // torus + shape.ProfileCurve = (byte)ProfileShape.Circle | (byte)HollowShape.Triangle; + shape.PathCurve = (byte)Extrusion.Curve1; + break; + + case 2: // torus with hollow (a sl viewer whould see 4 faces on a hollow sphere) + shape.ProfileCurve = (byte)ProfileShape.Circle | (byte)HollowShape.Triangle; + shape.PathCurve = (byte)Extrusion.Curve1; + shape.ProfileHollow = 1; + break; + + case 3: // cylinder + shape.ProfileCurve = (byte)ProfileShape.Circle | (byte)HollowShape.Triangle; + shape.PathCurve = (byte)Extrusion.Straight; + break; + + case 4: // cylinder with hollow + shape.ProfileCurve = (byte)ProfileShape.Circle | (byte)HollowShape.Triangle; + shape.PathCurve = (byte)Extrusion.Straight; + shape.ProfileHollow = 1; + break; + + case 5: // prism + shape.ProfileCurve = (byte)ProfileShape.EquilateralTriangle | (byte)HollowShape.Triangle; + shape.PathCurve = (byte)Extrusion.Straight; + break; + + case 6: // box + shape.ProfileCurve = (byte)ProfileShape.Square | (byte)HollowShape.Triangle; + shape.PathCurve = (byte)Extrusion.Straight; + break; + + case 7: // box with hollow + shape.ProfileCurve = (byte)ProfileShape.Square | (byte)HollowShape.Triangle; + shape.PathCurve = (byte)Extrusion.Straight; + shape.ProfileHollow = 1; + break; + + default: // 8 faces box with cut + shape.ProfileCurve = (byte)ProfileShape.Square | (byte)HollowShape.Triangle; + shape.PathCurve = (byte)Extrusion.Straight; + shape.ProfileBegin = 1; + break; + } + + shape.SculptEntry = true; + shape.SculptType = (byte)OpenMetaverse.SculptType.Mesh; + shape.SculptTexture = meshAssetID; + + return shape; + } + public void SetScale(float side) { _scale = new Vector3(side, side, side); -- cgit v1.1 From 1b8c71c965c82a79011290c2cfbcbc8eb1e409c4 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 26 Apr 2017 16:15:33 +0100 Subject: give more information on Fatal Error during region startup --- OpenSim/Framework/Servers/BaseOpenSimServer.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index f761813..62cd543 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs @@ -163,8 +163,7 @@ namespace OpenSim.Framework.Servers } catch(Exception e) { - m_log.FatalFormat("Fatal error: {0}", - (e.Message == null || e.Message == String.Empty) ? "Unknown reason":e.Message ); + m_log.Fatal("Fatal error: " + e.ToString()); Environment.Exit(1); } -- cgit v1.1 From ba4e13ef55c378db13b6aa97316e99d651762a02 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 28 Apr 2017 20:03:44 +0100 Subject: a few changes to permissions folding... we are testing. at this point only use master for TESTING also --- OpenSim/Framework/Util.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 0ec24e6..4d025a9 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -79,7 +79,9 @@ namespace OpenSim.Framework FoldedMask = 0x0f, - // + FoldingShift = 13 , // number of bit shifts from normal perm to folded or back (same as Transfer shift below) + // when doing as a block + Transfer = 1 << 13, // 0x02000 Modify = 1 << 14, // 0x04000 Copy = 1 << 15, // 0x08000 @@ -91,6 +93,7 @@ namespace OpenSim.Framework All = 0x8e000, AllAndExport = 0x9e000, AllEffective = 0x9e000 + } /// -- cgit v1.1 From 04117d9f75ca278a921be9ce09c8c859f81cd428 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 29 Apr 2017 19:07:04 +0100 Subject: recover PermissionsUtil.ApplyFoldedPermissions (well my version). its use easys code readability --- OpenSim/Framework/PermissionsUtil.cs | 32 ++++++++++++++++++++++++++++++++ OpenSim/Framework/Util.cs | 4 ++-- 2 files changed, 34 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/PermissionsUtil.cs b/OpenSim/Framework/PermissionsUtil.cs index 3dce04d..a7f933c 100644 --- a/OpenSim/Framework/PermissionsUtil.cs +++ b/OpenSim/Framework/PermissionsUtil.cs @@ -64,5 +64,37 @@ namespace OpenSim.Framework str = "."; return str; } + + public static void ApplyFoldedPermissions(uint source, ref uint target) + { + uint folded = source & (uint)PermissionMask.FoldedMask; + if(folded == 0) // invalid we need to ignore + return; + + folded <<= (int)PermissionMask.FoldingShift; + folded &= (uint)PermissionMask.UnfoldedMask; // not really necessary but well + folded |= ~(uint)PermissionMask.UnfoldedMask; + + uint tmp = target; + tmp &= folded; + target = tmp; + } + + // do not touch MOD + public static void ApplyNoModFoldedPermissions(uint source, ref uint target) + { + uint folded = source & (uint)PermissionMask.FoldedMask; + if(folded == 0) // invalid we need to ignore + return; + + folded <<= (int)PermissionMask.FoldingShift; + folded &= (uint)PermissionMask.UnfoldedMask; // not really necessary but well + folded |= (~(uint)PermissionMask.UnfoldedMask | (uint)PermissionMask.Modify); + + uint tmp = target; + tmp &= folded; + target = tmp; + } + } } diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 4d025a9..f6ded04 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -92,8 +92,8 @@ namespace OpenSim.Framework // explicitly given All = 0x8e000, AllAndExport = 0x9e000, - AllEffective = 0x9e000 - + AllEffective = 0x9e000, + UnfoldedMask = 0x1e000 } /// -- cgit v1.1 From 522695c821c9f68d6c13533220de428f0d036dd7 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 29 Apr 2017 22:09:45 +0100 Subject: update folded permitions if taking from world, or after unfold --- OpenSim/Framework/PermissionsUtil.cs | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/PermissionsUtil.cs b/OpenSim/Framework/PermissionsUtil.cs index a7f933c..39ccaba 100644 --- a/OpenSim/Framework/PermissionsUtil.cs +++ b/OpenSim/Framework/PermissionsUtil.cs @@ -65,9 +65,9 @@ namespace OpenSim.Framework return str; } - public static void ApplyFoldedPermissions(uint source, ref uint target) + public static void ApplyFoldedPermissions(uint foldedSourcePerms, ref uint targetPerms) { - uint folded = source & (uint)PermissionMask.FoldedMask; + uint folded = foldedSourcePerms & (uint)PermissionMask.FoldedMask; if(folded == 0) // invalid we need to ignore return; @@ -75,15 +75,15 @@ namespace OpenSim.Framework folded &= (uint)PermissionMask.UnfoldedMask; // not really necessary but well folded |= ~(uint)PermissionMask.UnfoldedMask; - uint tmp = target; + uint tmp = targetPerms; tmp &= folded; - target = tmp; + targetPerms = tmp; } // do not touch MOD - public static void ApplyNoModFoldedPermissions(uint source, ref uint target) + public static void ApplyNoModFoldedPermissions(uint foldedSourcePerms, ref uint target) { - uint folded = source & (uint)PermissionMask.FoldedMask; + uint folded = foldedSourcePerms & (uint)PermissionMask.FoldedMask; if(folded == 0) // invalid we need to ignore return; @@ -96,5 +96,21 @@ namespace OpenSim.Framework target = tmp; } + public static uint FixAndFoldPermissions(uint perms) + { + uint tmp = perms; + + // C & T rule + if((tmp & (uint)(PermissionMask.Copy | PermissionMask.Transfer)) == 0) + tmp |= (uint)PermissionMask.Transfer; + + // unlock + tmp |= (uint)PermissionMask.Move; + + tmp &= ~(uint)PermissionMask.FoldedMask; + tmp |= ((tmp >> (int)PermissionMask.FoldingShift) & (uint)PermissionMask.FoldedMask); + + return tmp; + } } } -- cgit v1.1 From b67904a6510d4827e8219a3534b8bc07a5115ec3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 30 Apr 2017 14:31:46 +0100 Subject: remove a redundant operation --- OpenSim/Framework/PermissionsUtil.cs | 2 -- 1 file changed, 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/PermissionsUtil.cs b/OpenSim/Framework/PermissionsUtil.cs index 39ccaba..aba8320 100644 --- a/OpenSim/Framework/PermissionsUtil.cs +++ b/OpenSim/Framework/PermissionsUtil.cs @@ -72,7 +72,6 @@ namespace OpenSim.Framework return; folded <<= (int)PermissionMask.FoldingShift; - folded &= (uint)PermissionMask.UnfoldedMask; // not really necessary but well folded |= ~(uint)PermissionMask.UnfoldedMask; uint tmp = targetPerms; @@ -88,7 +87,6 @@ namespace OpenSim.Framework return; folded <<= (int)PermissionMask.FoldingShift; - folded &= (uint)PermissionMask.UnfoldedMask; // not really necessary but well folded |= (~(uint)PermissionMask.UnfoldedMask | (uint)PermissionMask.Modify); uint tmp = target; -- cgit v1.1 From 0d59a29dc7c6f732da266a4ed4fddb5b39521ddf Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 30 Apr 2017 14:39:20 +0100 Subject: save some nanoseconds if unfolding will not change anything ( export default mks it rare, but looks nice) --- OpenSim/Framework/PermissionsUtil.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/PermissionsUtil.cs b/OpenSim/Framework/PermissionsUtil.cs index aba8320..cf93323 100644 --- a/OpenSim/Framework/PermissionsUtil.cs +++ b/OpenSim/Framework/PermissionsUtil.cs @@ -68,7 +68,7 @@ namespace OpenSim.Framework public static void ApplyFoldedPermissions(uint foldedSourcePerms, ref uint targetPerms) { uint folded = foldedSourcePerms & (uint)PermissionMask.FoldedMask; - if(folded == 0) // invalid we need to ignore + if(folded == 0 || folded == (uint)PermissionMask.FoldedMask) // invalid we need to ignore, or nothing to do return; folded <<= (int)PermissionMask.FoldingShift; @@ -83,7 +83,7 @@ namespace OpenSim.Framework public static void ApplyNoModFoldedPermissions(uint foldedSourcePerms, ref uint target) { uint folded = foldedSourcePerms & (uint)PermissionMask.FoldedMask; - if(folded == 0) // invalid we need to ignore + if(folded == 0 || folded == (uint)PermissionMask.FoldedMask) // invalid we need to ignore, or nothing to do return; folded <<= (int)PermissionMask.FoldingShift; -- cgit v1.1 From a96c0f760a3df08217794e71ec450abddf3c3ef0 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 30 Apr 2017 14:42:20 +0100 Subject: having the file open then let PermissionsToString know about Export --- OpenSim/Framework/PermissionsUtil.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/PermissionsUtil.cs b/OpenSim/Framework/PermissionsUtil.cs index cf93323..e50d4df 100644 --- a/OpenSim/Framework/PermissionsUtil.cs +++ b/OpenSim/Framework/PermissionsUtil.cs @@ -60,6 +60,8 @@ namespace OpenSim.Framework str += "C"; if ((perms & (int)PermissionMask.Transfer) != 0) str += "T"; + if ((perms & (int)PermissionMask.Export) != 0) + str += "X"; if (str == "") str = "."; return str; -- cgit v1.1 From d0912b61516914f810ba306641aaaa813134462e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 7 May 2017 00:47:45 +0100 Subject: let StreamReader be in using statements --- .../Framework/Servers/HttpServer/BaseHttpServer.cs | 42 ++++++++-------------- .../Servers/HttpServer/RestStreamHandler.cs | 7 ++-- 2 files changed, 18 insertions(+), 31 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index fb92b92..c32ee28 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -399,11 +399,10 @@ namespace OpenSim.Framework.Servers.HttpServer Stream requestStream = req.InputStream; + string requestBody; Encoding encoding = Encoding.UTF8; - StreamReader reader = new StreamReader(requestStream, encoding); - - string requestBody = reader.ReadToEnd(); - reader.Close(); + using(StreamReader reader = new StreamReader(requestStream, encoding)) + requestBody = reader.ReadToEnd(); Hashtable keysvals = new Hashtable(); Hashtable headervals = new Hashtable(); @@ -567,13 +566,10 @@ namespace OpenSim.Framework.Servers.HttpServer IGenericHTTPHandler HTTPRequestHandler = requestHandler as IGenericHTTPHandler; Stream requestStream = request.InputStream; + string requestBody; Encoding encoding = Encoding.UTF8; - StreamReader reader = new StreamReader(requestStream, encoding); - - string requestBody = reader.ReadToEnd(); - - reader.Close(); - //requestStream.Close(); + using(StreamReader reader = new StreamReader(requestStream, encoding)) + requestBody = reader.ReadToEnd(); Hashtable keysvals = new Hashtable(); Hashtable headervals = new Hashtable(); @@ -690,7 +686,7 @@ namespace OpenSim.Framework.Servers.HttpServer } } - request.InputStream.Close(); + request.InputStream.Dispose(); if (buffer != null) { @@ -998,7 +994,7 @@ namespace OpenSim.Framework.Servers.HttpServer { String requestBody; - Stream requestStream = request.InputStream; + Stream requestStream = Util.Copy(request.InputStream); Stream innerStream = null; try { @@ -1009,9 +1005,8 @@ namespace OpenSim.Framework.Servers.HttpServer } using (StreamReader reader = new StreamReader(requestStream, Encoding.UTF8)) - { requestBody = reader.ReadToEnd(); - } + } finally { @@ -1263,12 +1258,10 @@ namespace OpenSim.Framework.Servers.HttpServer //m_log.Warn("[BASE HTTP SERVER]: We've figured out it's a LLSD Request"); Stream requestStream = request.InputStream; + string requestBody; Encoding encoding = Encoding.UTF8; - StreamReader reader = new StreamReader(requestStream, encoding); - - string requestBody = reader.ReadToEnd(); - reader.Close(); - requestStream.Close(); + using(StreamReader reader = new StreamReader(requestStream, encoding)) + requestBody= reader.ReadToEnd(); //m_log.DebugFormat("[OGP]: {0}:{1}", request.RawUrl, requestBody); response.KeepAlive = true; @@ -1592,15 +1585,10 @@ namespace OpenSim.Framework.Servers.HttpServer byte[] buffer; Stream requestStream = request.InputStream; - + string requestBody; Encoding encoding = Encoding.UTF8; - StreamReader reader = new StreamReader(requestStream, encoding); - - string requestBody = reader.ReadToEnd(); - // avoid warning for now - reader.ReadToEnd(); - reader.Close(); - requestStream.Close(); + using(StreamReader reader = new StreamReader(requestStream, encoding)) + requestBody = reader.ReadToEnd(); Hashtable keysvals = new Hashtable(); Hashtable headervals = new Hashtable(); diff --git a/OpenSim/Framework/Servers/HttpServer/RestStreamHandler.cs b/OpenSim/Framework/Servers/HttpServer/RestStreamHandler.cs index 0305dee..dfc2715 100644 --- a/OpenSim/Framework/Servers/HttpServer/RestStreamHandler.cs +++ b/OpenSim/Framework/Servers/HttpServer/RestStreamHandler.cs @@ -50,11 +50,10 @@ namespace OpenSim.Framework.Servers.HttpServer protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { + string requestBody; Encoding encoding = Encoding.UTF8; - StreamReader streamReader = new StreamReader(request, encoding); - - string requestBody = streamReader.ReadToEnd(); - streamReader.Close(); + using(StreamReader streamReader = new StreamReader(request,encoding)) + requestBody = streamReader.ReadToEnd(); string param = GetParam(path); string responseString = m_restMethod(requestBody, path, param, httpRequest, httpResponse); -- cgit v1.1 From 604b966d8442be6f034d81c8e8d04d12413c357c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 8 May 2017 00:40:15 +0100 Subject: some conditional dispose on http requests inputstream --- OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 3 ++- OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index c32ee28..92be3a3 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -686,7 +686,8 @@ namespace OpenSim.Framework.Servers.HttpServer } } - request.InputStream.Dispose(); + if(request.InputStream.CanRead) + request.InputStream.Dispose(); if (buffer != null) { diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs index 0e4a941..fefcb20 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs @@ -82,6 +82,9 @@ namespace OpenSim.Framework.Servers.HttpServer byte[] buffer = server.DoHTTPGruntWork(responsedata, response); + if(Request.Body.CanRead) + Request.Body.Dispose(); + response.SendChunked = false; response.ContentLength64 = buffer.Length; response.ContentEncoding = Encoding.UTF8; @@ -107,6 +110,9 @@ namespace OpenSim.Framework.Servers.HttpServer OSHttpResponse response = new OSHttpResponse(new HttpResponse(HttpContext, Request), HttpContext); + if(Request.Body.CanRead) + Request.Body.Dispose(); + response.SendChunked = false; response.ContentLength64 = 0; response.ContentEncoding = Encoding.UTF8; -- cgit v1.1 From 6c79cc652ba481f714ccd728fe1f062fbd69bb83 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 8 May 2017 00:54:17 +0100 Subject: some conditional dispose on http requests inputstream --- OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 3 ++- OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index ec3805f..da2b860 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -815,7 +815,8 @@ namespace OpenSim.Framework.Servers.HttpServer } } - request.InputStream.Dispose(); + if(request.InputStream.CanRead) + request.InputStream.Dispose(); if (buffer != null) { diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs index 6537f64..eb8ca0d 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs @@ -86,6 +86,9 @@ namespace OpenSim.Framework.Servers.HttpServer byte[] buffer = server.DoHTTPGruntWork(responsedata, response); + if(Request.Body.CanRead) + Request.Body.Dispose(); + response.SendChunked = false; response.ContentLength64 = buffer.Length; response.ContentEncoding = Encoding.UTF8; @@ -111,6 +114,9 @@ namespace OpenSim.Framework.Servers.HttpServer OSHttpResponse response = new OSHttpResponse(new HttpResponse(HttpContext, Request), HttpContext); + if(Request.Body.CanRead) + Request.Body.Dispose(); + response.SendChunked = false; response.ContentLength64 = 0; response.ContentEncoding = Encoding.UTF8; -- cgit v1.1 From 9ea49d107d2df96de7c56e561ebd46b0f804bfa3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 13 May 2017 15:58:35 +0100 Subject: fix wrong locking on unused path it case it does get uses. Thanks LaNani Sundara --- OpenSim/Framework/DoubleDictionaryThreadAbortSafe.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/DoubleDictionaryThreadAbortSafe.cs b/OpenSim/Framework/DoubleDictionaryThreadAbortSafe.cs index 55ec13e..fe20767 100644 --- a/OpenSim/Framework/DoubleDictionaryThreadAbortSafe.cs +++ b/OpenSim/Framework/DoubleDictionaryThreadAbortSafe.cs @@ -485,7 +485,7 @@ namespace OpenSim.Framework try {} finally { - rwLock.EnterUpgradeableReadLock(); + rwLock.EnterWriteLock(); gotWriteLock = true; } -- cgit v1.1 From 16f02cb6fd57c5ad015b1c9e5edd17a4dbed37ef Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 13 May 2017 16:34:29 +0100 Subject: we can't allow abort to change only one dic --- .../Framework/DoubleDictionaryThreadAbortSafe.cs | 62 ++++++++++++---------- 1 file changed, 33 insertions(+), 29 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/DoubleDictionaryThreadAbortSafe.cs b/OpenSim/Framework/DoubleDictionaryThreadAbortSafe.cs index fe20767..816523b 100644 --- a/OpenSim/Framework/DoubleDictionaryThreadAbortSafe.cs +++ b/OpenSim/Framework/DoubleDictionaryThreadAbortSafe.cs @@ -74,21 +74,19 @@ namespace OpenSim.Framework { rwLock.EnterWriteLock(); gotLock = true; + if (Dictionary1.ContainsKey(key1)) + { + if (!Dictionary2.ContainsKey(key2)) + throw new ArgumentException("key1 exists in the dictionary but not key2"); + } + else if (Dictionary2.ContainsKey(key2)) + { + if (!Dictionary1.ContainsKey(key1)) + throw new ArgumentException("key2 exists in the dictionary but not key1"); + } + Dictionary1[key1] = value; + Dictionary2[key2] = value; } - - if (Dictionary1.ContainsKey(key1)) - { - if (!Dictionary2.ContainsKey(key2)) - throw new ArgumentException("key1 exists in the dictionary but not key2"); - } - else if (Dictionary2.ContainsKey(key2)) - { - if (!Dictionary1.ContainsKey(key1)) - throw new ArgumentException("key2 exists in the dictionary but not key1"); - } - - Dictionary1[key1] = value; - Dictionary2[key2] = value; } finally { @@ -112,10 +110,9 @@ namespace OpenSim.Framework { rwLock.EnterWriteLock(); gotLock = true; + Dictionary1.Remove(key1); + success = Dictionary2.Remove(key2); } - - Dictionary1.Remove(key1); - success = Dictionary2.Remove(key2); } finally { @@ -151,8 +148,12 @@ namespace OpenSim.Framework { if (kvp.Value.Equals(value)) { - Dictionary1.Remove(key1); - Dictionary2.Remove(kvp.Key); + try { } + finally + { + Dictionary1.Remove(key1); + Dictionary2.Remove(kvp.Key); + } found = true; break; } @@ -193,8 +194,12 @@ namespace OpenSim.Framework { if (kvp.Value.Equals(value)) { - Dictionary2.Remove(key2); - Dictionary1.Remove(kvp.Key); + try { } + finally + { + Dictionary2.Remove(key2); + Dictionary1.Remove(kvp.Key); + } found = true; break; } @@ -224,10 +229,9 @@ namespace OpenSim.Framework { rwLock.EnterWriteLock(); gotLock = true; + Dictionary1.Clear(); + Dictionary2.Clear(); } - - Dictionary1.Clear(); - Dictionary2.Clear(); } finally { @@ -487,13 +491,13 @@ namespace OpenSim.Framework { rwLock.EnterWriteLock(); gotWriteLock = true; - } - for (int i = 0; i < list.Count; i++) - Dictionary1.Remove(list[i]); + for (int i = 0; i < list.Count; i++) + Dictionary1.Remove(list[i]); - for (int i = 0; i < list2.Count; i++) - Dictionary2.Remove(list2[i]); + for (int i = 0; i < list2.Count; i++) + Dictionary2.Remove(list2[i]); + } } finally { -- cgit v1.1 From 25ca8695f3746b000fee42a0d73b91dfa6a1c9c0 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 13 May 2017 20:21:56 +0100 Subject: find parcels by GlobalID.. well most time --- OpenSim/Framework/ILandChannel.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/ILandChannel.cs b/OpenSim/Framework/ILandChannel.cs index 44a24b9..12a8228 100644 --- a/OpenSim/Framework/ILandChannel.cs +++ b/OpenSim/Framework/ILandChannel.cs @@ -76,6 +76,8 @@ namespace OpenSim.Region.Framework.Interfaces /// ILandObject GetLandObject(int localID); + ILandObject GetLandObject(UUID GlobalID); + /// /// Clear the land channel of all parcels. /// -- cgit v1.1 From cb21caae777341b7b4af724e86b9a82b9b827c43 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 14 May 2017 01:44:04 +0100 Subject: fix some issue on parcels loading and make parcels dwell show something. Resolution is 2.5min aprox. --- OpenSim/Framework/LandData.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/LandData.cs b/OpenSim/Framework/LandData.cs index 13d2977..13b58be 100644 --- a/OpenSim/Framework/LandData.cs +++ b/OpenSim/Framework/LandData.cs @@ -97,7 +97,9 @@ namespace OpenSim.Framework private bool _mediaLoop = false; private bool _obscureMusic = false; private bool _obscureMedia = false; - private float _dwell = 0; + + private float m_dwell = 0; + public double LastDwellTimeMS; public bool SeeAVs { get; set; } public bool AnyAVSounds { get; set; } @@ -111,11 +113,12 @@ namespace OpenSim.Framework { get { - return _dwell; + return m_dwell; } set { - _dwell = value; + m_dwell = value; + LastDwellTimeMS = Util.GetTimeStampMS(); } } @@ -735,6 +738,7 @@ namespace OpenSim.Framework SeeAVs = true; AnyAVSounds = true; GroupAVSounds = true; + LastDwellTimeMS = Util.GetTimeStampMS(); } /// @@ -784,7 +788,7 @@ namespace OpenSim.Framework landData._obscureMedia = _obscureMedia; landData._simwideArea = _simwideArea; landData._simwidePrims = _simwidePrims; - landData._dwell = _dwell; + landData.m_dwell = m_dwell; landData.SeeAVs = SeeAVs; landData.AnyAVSounds = AnyAVSounds; landData.GroupAVSounds = GroupAVSounds; -- cgit v1.1 From 156707edfb88b9ddf679751f8f6d8128b2abd7be Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 14 May 2017 06:27:29 +0100 Subject: clear land object on delete --- OpenSim/Framework/ILandObject.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/ILandObject.cs b/OpenSim/Framework/ILandObject.cs index f3b850d..a783256 100644 --- a/OpenSim/Framework/ILandObject.cs +++ b/OpenSim/Framework/ILandObject.cs @@ -189,5 +189,7 @@ namespace OpenSim.Framework /// /// The music url. string GetMusicUrl(); + + void Clear(); } } -- cgit v1.1 From c74e0e2d9b43b2090782c420f4af709b40d6ba3a Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 15 May 2017 18:10:08 +0100 Subject: remove a Paralell.For (actually not used). That kind of fine gained multitask makes no sense on already heavy multitasked server application like opensim. CPU cores are already busy or needed elsewhere. --- OpenSim/Framework/ClientManager.cs | 48 +++++++------------------------------- 1 file changed, 9 insertions(+), 39 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/ClientManager.cs b/OpenSim/Framework/ClientManager.cs index baff2f4..45c54e4 100644 --- a/OpenSim/Framework/ClientManager.cs +++ b/OpenSim/Framework/ClientManager.cs @@ -27,10 +27,8 @@ using System; using System.Collections.Generic; -using System.Reflection; using System.Net; using OpenMetaverse; -using OpenMetaverse.Packets; namespace OpenSim.Framework { @@ -76,20 +74,16 @@ namespace OpenSim.Framework { lock (m_syncRoot) { - if (m_dict1.ContainsKey(value.AgentId) || m_dict2.ContainsKey(value.RemoteEndPoint)) - return false; + // allow self healing +// if (m_dict1.ContainsKey(value.AgentId) || m_dict2.ContainsKey(value.RemoteEndPoint)) +// return false; m_dict1[value.AgentId] = value; m_dict2[value.RemoteEndPoint] = value; - IClientAPI[] oldArray = m_array; - int oldLength = oldArray.Length; - - IClientAPI[] newArray = new IClientAPI[oldLength + 1]; - for (int i = 0; i < oldLength; i++) - newArray[i] = oldArray[i]; - newArray[oldLength] = value; - + // dict1 is the master + IClientAPI[] newArray = new IClientAPI[m_dict1.Count]; + m_dict1.Values.CopyTo(newArray, 0); m_array = newArray; } @@ -112,22 +106,12 @@ namespace OpenSim.Framework m_dict1.Remove(key); m_dict2.Remove(value.RemoteEndPoint); - IClientAPI[] oldArray = m_array; - int oldLength = oldArray.Length; - - IClientAPI[] newArray = new IClientAPI[oldLength - 1]; - int j = 0; - for (int i = 0; i < oldLength; i++) - { - if (oldArray[i] != value) - newArray[j++] = oldArray[i]; - } - + IClientAPI[] newArray = new IClientAPI[m_dict1.Count]; + m_dict1.Values.CopyTo(newArray, 0); m_array = newArray; return true; } } - return false; } @@ -197,25 +181,11 @@ namespace OpenSim.Framework } /// - /// Performs a given task in parallel for each of the elements in the - /// collection - /// - /// Action to perform on each element - public void ForEach(Action action) - { - IClientAPI[] localArray = m_array; - Parallel.For(0, localArray.Length, - delegate(int i) - { action(localArray[i]); } - ); - } - - /// /// Performs a given task synchronously for each of the elements in /// the collection /// /// Action to perform on each element - public void ForEachSync(Action action) + public void ForEach(Action action) { IClientAPI[] localArray = m_array; for (int i = 0; i < localArray.Length; i++) -- cgit v1.1 From a2c245607610bacdacae065ec01c854fedd9df36 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 21 May 2017 02:11:53 +0100 Subject: remove LongPoll type and queues. Events should now have reduced latency also. About previus commit, it maybe a modified ingen-e3s-v1.33 script that is broken, and not the original version, can't tell --- .../Servers/HttpServer/PollServiceEventArgs.cs | 4 +-- .../HttpServer/PollServiceRequestManager.cs | 34 +--------------------- 2 files changed, 3 insertions(+), 35 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs index 8ace7a9..7150aad 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs @@ -50,7 +50,7 @@ namespace OpenSim.Framework.Servers.HttpServer public enum EventType : int { - LongPoll = 0, + Poll = 0, LslHttp = 1, Inventory = 2, Texture = 3, @@ -82,7 +82,7 @@ namespace OpenSim.Framework.Servers.HttpServer NoEvents = pNoEvents; Id = pId; TimeOutms = pTimeOutms; - Type = EventType.LongPoll; + Type = EventType.Poll; } } } diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index 936146d..314719c 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs @@ -48,7 +48,6 @@ namespace OpenSim.Framework.Servers.HttpServer private Dictionary> m_bycontext; private BlockingQueue m_requests = new BlockingQueue(); - private static Queue m_slowRequests = new Queue(); private static Queue m_retryRequests = new Queue(); private uint m_WorkerThreadCount = 0; @@ -56,11 +55,9 @@ namespace OpenSim.Framework.Servers.HttpServer private Thread m_retrysThread; private bool m_running = false; - private int slowCount = 0; private SmartThreadPool m_threadPool; - public PollServiceRequestManager( BaseHttpServer pSrv, bool performResponsesAsync, uint pWorkerThreadCount, int pTimeout) { @@ -80,7 +77,6 @@ namespace OpenSim.Framework.Servers.HttpServer startInfo.ThreadPoolName = "PoolService"; m_threadPool = new SmartThreadPool(startInfo); - } public void Start() @@ -163,17 +159,7 @@ namespace OpenSim.Framework.Servers.HttpServer public void EnqueueInt(PollServiceHttpRequest req) { if (m_running) - { - if (req.PollServiceArgs.Type != PollServiceEventArgs.EventType.LongPoll) - { - m_requests.Enqueue(req); - } - else - { - lock (m_slowRequests) - m_slowRequests.Enqueue(req); - } - } + m_requests.Enqueue(req); } private void CheckRetries() @@ -188,17 +174,6 @@ namespace OpenSim.Framework.Servers.HttpServer while (m_retryRequests.Count > 0 && m_running) m_requests.Enqueue(m_retryRequests.Dequeue()); } - slowCount++; - if (slowCount >= 10) - { - slowCount = 0; - - lock (m_slowRequests) - { - while (m_slowRequests.Count > 0 && m_running) - m_requests.Enqueue(m_slowRequests.Dequeue()); - } - } } } @@ -231,13 +206,6 @@ namespace OpenSim.Framework.Servers.HttpServer PollServiceHttpRequest wreq; m_retryRequests.Clear(); - lock (m_slowRequests) - { - while (m_slowRequests.Count > 0) - m_requests.Enqueue(m_slowRequests.Dequeue()); - - } - while (m_requests.Count() > 0) { try -- cgit v1.1 From 0320225ca816dc6dfdd7a90fe80fdbbb8918139b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 21 May 2017 07:02:35 +0100 Subject: reenqueue poll events while conn is open, and not expired --- OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index 4dad44a..cb0c41f 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs @@ -277,7 +277,11 @@ namespace OpenSim.Framework.Servers.HttpServer try { req.DoHTTPGruntWork(m_server, responsedata); - byContextDequeue(req); + if(req.HttpContext.CanSend() && req.PollServiceArgs.Type == PollServiceEventArgs.EventType.Poll + && (Environment.TickCount - req.RequestTime) > req.PollServiceArgs.TimeOutms) + ReQueueEvent(req); + else + byContextDequeue(req); } catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream { -- cgit v1.1 From fcb435deb4f45511071c7bdb8c4e2290fdc9977f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 22 May 2017 05:53:59 +0100 Subject: make sure we drop requests if DoHTTPGruntWork fails --- .../Servers/HttpServer/PollServiceRequestManager.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index 314719c..8bf98da 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs @@ -244,11 +244,13 @@ namespace OpenSim.Framework.Servers.HttpServer try { req.DoHTTPGruntWork(m_server, responsedata); - byContextDequeue(req); } - catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream + catch (ObjectDisposedException) { - // Ignore it, no need to reply + } + finally + { + byContextDequeue(req); } return null; }, null); @@ -263,12 +265,15 @@ namespace OpenSim.Framework.Servers.HttpServer { req.DoHTTPGruntWork(m_server, req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id)); - byContextDequeue(req); } catch (ObjectDisposedException) { // Ignore it, no need to reply } + finally + { + byContextDequeue(req); + } return null; }, null); } -- cgit v1.1 From 73222e4dd4e735225845184de22e245c454b40db Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 22 May 2017 19:14:19 +0100 Subject: fix IClientIPEndpoint broken by justin long ago.. but stop using it except on SceneBanner, later it my be also removed from there and everywhere --- OpenSim/Framework/Client/IClientIPEndpoint.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Client/IClientIPEndpoint.cs b/OpenSim/Framework/Client/IClientIPEndpoint.cs index 2b99bf0..2194616 100644 --- a/OpenSim/Framework/Client/IClientIPEndpoint.cs +++ b/OpenSim/Framework/Client/IClientIPEndpoint.cs @@ -34,6 +34,6 @@ namespace OpenSim.Framework.Client { public interface IClientIPEndpoint { - IPAddress EndPoint { get; } + IPEndPoint RemoteEndPoint { get; } } } -- cgit v1.1 From 928733efc908e25ea460ca4724a8846a4fb71fa1 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 23 May 2017 03:26:32 +0100 Subject: please DIE! PLEASE?? --- OpenSim/Framework/Servers/BaseOpenSimServer.cs | 9 +++++++-- .../Servers/HttpServer/PollServiceRequestManager.cs | 11 +++++++---- OpenSim/Framework/Servers/MainServer.cs | 12 ++++++++++++ 3 files changed, 26 insertions(+), 6 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index 62cd543..99d94bb 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs @@ -108,12 +108,17 @@ namespace OpenSim.Framework.Servers protected override void ShutdownSpecific() { - m_log.Info("[SHUTDOWN]: Shutdown processing on main thread complete. Exiting..."); - RemovePIDFile(); base.ShutdownSpecific(); + MainServer.Stop(); + + Thread.Sleep(5000); + + RemovePIDFile(); + m_log.Info("[SHUTDOWN]: Shutdown processing on main thread complete. Exiting..."); + if (!SuppressExit) Environment.Exit(0); } diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index 8bf98da..e1bd564 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs @@ -181,17 +181,20 @@ namespace OpenSim.Framework.Servers.HttpServer { m_running = false; - Thread.Sleep(1000); // let the world move + Thread.Sleep(100); // let the world move foreach (Thread t in m_workerThreads) Watchdog.AbortThread(t.ManagedThreadId); + m_threadPool.Shutdown(); + // any entry in m_bycontext should have a active request on the other queues // so just delete contents to easy GC foreach (Queue qu in m_bycontext.Values) qu.Clear(); m_bycontext.Clear(); +/* try { foreach (PollServiceHttpRequest req in m_retryRequests) @@ -204,8 +207,9 @@ namespace OpenSim.Framework.Servers.HttpServer } PollServiceHttpRequest wreq; +*/ m_retryRequests.Clear(); - +/* while (m_requests.Count() > 0) { try @@ -218,7 +222,7 @@ namespace OpenSim.Framework.Servers.HttpServer { } } - +*/ m_requests.Clear(); } @@ -229,7 +233,6 @@ namespace OpenSim.Framework.Servers.HttpServer while (m_running) { PollServiceHttpRequest req = m_requests.Dequeue(5000); - Watchdog.UpdateThread(); if (req != null) { diff --git a/OpenSim/Framework/Servers/MainServer.cs b/OpenSim/Framework/Servers/MainServer.cs index ea7b2b5..9b1d906 100644 --- a/OpenSim/Framework/Servers/MainServer.cs +++ b/OpenSim/Framework/Servers/MainServer.cs @@ -353,5 +353,17 @@ namespace OpenSim.Framework.Servers return m_Servers[port]; } } + + public static void Stop() + { + lock (m_Servers) + { + foreach (BaseHttpServer httpServer in m_Servers.Values) + { + httpServer.Stop(); + } + } + } + } } \ No newline at end of file -- cgit v1.1 From f3eb73926e1602f855f2c7fceb040b07f7265f3b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 23 May 2017 04:05:31 +0100 Subject: stop a few more threads on exit --- OpenSim/Framework/Monitoring/WorkManager.cs | 6 +++++- OpenSim/Framework/Servers/BaseOpenSimServer.cs | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Monitoring/WorkManager.cs b/OpenSim/Framework/Monitoring/WorkManager.cs index 43130f9..a3e0390 100644 --- a/OpenSim/Framework/Monitoring/WorkManager.cs +++ b/OpenSim/Framework/Monitoring/WorkManager.cs @@ -82,6 +82,11 @@ namespace OpenSim.Framework.Monitoring HandleControlCommand); } + public static void Stop() + { + JobEngine.Stop(); + } + /// /// Start a new long-lived thread. /// @@ -131,7 +136,6 @@ namespace OpenSim.Framework.Monitoring thread.Start(); - return thread; } diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index 99d94bb..7d21e00 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs @@ -116,6 +116,8 @@ namespace OpenSim.Framework.Servers Thread.Sleep(5000); + WorkManager.Stop(); + RemovePIDFile(); m_log.Info("[SHUTDOWN]: Shutdown processing on main thread complete. Exiting..."); -- cgit v1.1 From dca3a45803a18103113b9eb861da4f79572de924 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 24 May 2017 22:17:04 +0100 Subject: add a bit more pre exit cleanup --- OpenSim/Framework/Servers/BaseOpenSimServer.cs | 8 ++++---- OpenSim/Framework/Util.cs | 10 ++++++++++ 2 files changed, 14 insertions(+), 4 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index 7d21e00..bc68681 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs @@ -108,16 +108,16 @@ namespace OpenSim.Framework.Servers protected override void ShutdownSpecific() { - - + Watchdog.Enabled = false; base.ShutdownSpecific(); - + MainServer.Stop(); Thread.Sleep(5000); - + Util.StopThreadPool(); WorkManager.Stop(); + Thread.Sleep(1000); RemovePIDFile(); m_log.Info("[SHUTDOWN]: Shutdown processing on main thread complete. Exiting..."); diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index f6ded04..3342df3 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -2852,6 +2852,16 @@ namespace OpenSim.Framework return stpi; } + public static void StopThreadPool() + { + if (m_ThreadPool == null) + return; + SmartThreadPool pool = m_ThreadPool; + m_ThreadPool = null; + + try { pool.Shutdown(); } catch {} + } + #endregion FireAndForget Threading Pattern /// -- cgit v1.1 From b6c23fe91169ed7065280464d20bba658252e278 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 25 May 2017 02:01:36 +0100 Subject: make a few more threads background ones --- OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index e1bd564..bd1c040 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs @@ -91,7 +91,7 @@ namespace OpenSim.Framework.Servers.HttpServer PoolWorkerJob, string.Format("PollServiceWorkerThread {0}:{1}", i, m_server.Port), ThreadPriority.Normal, - false, + true, false, null, int.MaxValue); @@ -101,7 +101,7 @@ namespace OpenSim.Framework.Servers.HttpServer this.CheckRetries, string.Format("PollServiceWatcherThread:{0}", m_server.Port), ThreadPriority.Normal, - false, + true, true, null, 1000 * 60 * 10); -- cgit v1.1 From e5377eb839fe9edecae4063a823ff8bf10768b1c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 25 May 2017 04:51:45 +0100 Subject: use threads from main pool on assetsconnector --- OpenSim/Framework/Util.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 3342df3..5eedd29 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -2579,7 +2579,6 @@ namespace OpenSim.Framework } catch (ThreadAbortException e) { - m_log.Error(string.Format("Aborted threadfunc {0} ", threadFuncNum), e); } catch (Exception e) { -- cgit v1.1 From 772c5b7db030eb95da8852d711323244cfa91ab4 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 25 May 2017 06:05:02 +0100 Subject: move assetsconnector threads to whatchdog; Abort all alive threads known to watchdog before exit --- OpenSim/Framework/Monitoring/Watchdog.cs | 24 ++++++++++++++++++++++++ OpenSim/Framework/Monitoring/WorkManager.cs | 1 + OpenSim/Framework/Servers/BaseOpenSimServer.cs | 3 ++- 3 files changed, 27 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Monitoring/Watchdog.cs b/OpenSim/Framework/Monitoring/Watchdog.cs index 9cc61ee..8a4894e 100644 --- a/OpenSim/Framework/Monitoring/Watchdog.cs +++ b/OpenSim/Framework/Monitoring/Watchdog.cs @@ -180,6 +180,30 @@ namespace OpenSim.Framework.Monitoring m_watchdogTimer.Elapsed += WatchdogTimerElapsed; } + public static void Stop() + { + if(m_threads == null) + return; + + lock(m_threads) + { + m_enabled = false; + if(m_watchdogTimer != null) + { + m_watchdogTimer.Dispose(); + m_watchdogTimer = null; + } + + foreach(ThreadWatchdogInfo twi in m_threads.Values) + { + Thread t = twi.Thread; + if(t.IsAlive) + t.Abort(); + } + m_threads.Clear(); + } + } + /// /// Add a thread to the watchdog tracker. /// diff --git a/OpenSim/Framework/Monitoring/WorkManager.cs b/OpenSim/Framework/Monitoring/WorkManager.cs index a3e0390..9d52f71 100644 --- a/OpenSim/Framework/Monitoring/WorkManager.cs +++ b/OpenSim/Framework/Monitoring/WorkManager.cs @@ -85,6 +85,7 @@ namespace OpenSim.Framework.Monitoring public static void Stop() { JobEngine.Stop(); + Watchdog.Stop(); } /// diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index bc68681..81dd357 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs @@ -119,9 +119,10 @@ namespace OpenSim.Framework.Servers Thread.Sleep(1000); RemovePIDFile(); + m_log.Info("[SHUTDOWN]: Shutdown processing on main thread complete. Exiting..."); - if (!SuppressExit) + if (!SuppressExit) Environment.Exit(0); } -- cgit v1.1 From d90b68c2a637b822b826a0cf3c52991aa9ee2c97 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 26 May 2017 00:05:35 +0100 Subject: change wrong watchdog stopped thread check code, and don't log it --- OpenSim/Framework/Monitoring/Watchdog.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Monitoring/Watchdog.cs b/OpenSim/Framework/Monitoring/Watchdog.cs index 8a4894e..5fb725c 100644 --- a/OpenSim/Framework/Monitoring/Watchdog.cs +++ b/OpenSim/Framework/Monitoring/Watchdog.cs @@ -193,7 +193,7 @@ namespace OpenSim.Framework.Monitoring m_watchdogTimer.Dispose(); m_watchdogTimer = null; } - + foreach(ThreadWatchdogInfo twi in m_threads.Values) { Thread t = twi.Thread; @@ -341,6 +341,8 @@ namespace OpenSim.Framework.Monitoring /// private static void WatchdogTimerElapsed(object sender, System.Timers.ElapsedEventArgs e) { + if(!m_enabled) + return; int now = Environment.TickCount & Int32.MaxValue; int msElapsed = now - LastWatchdogThreadTick; @@ -358,21 +360,26 @@ namespace OpenSim.Framework.Monitoring List callbackInfos = null; List threadsToRemove = null; + const ThreadState thgone = ThreadState.Stopped | ThreadState.Aborted | ThreadState.AbortRequested; + lock (m_threads) { foreach(ThreadWatchdogInfo threadInfo in m_threads.Values) { - if(threadInfo.Thread.ThreadState == ThreadState.Stopped) + if(!m_enabled) + return; + if(!threadInfo.Thread.IsAlive || (threadInfo.Thread.ThreadState & thgone) != 0) { if(threadsToRemove == null) threadsToRemove = new List(); threadsToRemove.Add(threadInfo); - +/* if(callbackInfos == null) callbackInfos = new List(); callbackInfos.Add(threadInfo); +*/ } else if(!threadInfo.IsTimedOut && now - threadInfo.LastTick >= threadInfo.Timeout) { -- cgit v1.1 From 8d8236cfb245eaa25f81f2840175b8fe676febbd Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 26 May 2017 00:34:04 +0100 Subject: missing file change.. actually use watchdog threads on assetsconnector and avoid null refs on JobEngine --- OpenSim/Framework/Monitoring/JobEngine.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Monitoring/JobEngine.cs b/OpenSim/Framework/Monitoring/JobEngine.cs index 0a39e4b..a6a059d 100644 --- a/OpenSim/Framework/Monitoring/JobEngine.cs +++ b/OpenSim/Framework/Monitoring/JobEngine.cs @@ -136,12 +136,15 @@ namespace OpenSim.Framework.Monitoring if(m_jobQueue.Count <= 0) m_cancelSource.Cancel(); - if(m_finishedProcessingAfterStop.WaitOne(RequestProcessTimeoutOnStop)) + m_finishedProcessingAfterStop.WaitOne(RequestProcessTimeoutOnStop); m_finishedProcessingAfterStop.Close(); } finally { - m_cancelSource.Dispose(); + if(m_cancelSource != null) + m_cancelSource.Dispose(); + if(m_finishedProcessingAfterStop != null) + m_finishedProcessingAfterStop.Dispose(); } } } -- cgit v1.1 From e7c2674dec2c9ea36313b51e7bc604753e16f24f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 26 May 2017 21:26:51 +0100 Subject: cleanup (grid)region info endpoint; add log to try to find some xml decode issues --- OpenSim/Framework/RegionInfo.cs | 38 ++------------------------ OpenSim/Framework/Util.cs | 59 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 36 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 7de8c52..75ed999 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -420,6 +420,7 @@ namespace OpenSim.Framework set { m_remotingPort = value; } } + /// /// This accessor can throw all the exceptions that Dns.GetHostAddresses can throw. /// @@ -427,42 +428,7 @@ namespace OpenSim.Framework /// public IPEndPoint ExternalEndPoint { - get - { - // Old one defaults to IPv6 - //return new IPEndPoint(Dns.GetHostAddresses(m_externalHostName)[0], m_internalEndPoint.Port); - - IPAddress ia = null; - // If it is already an IP, don't resolve it - just return directly - if (IPAddress.TryParse(m_externalHostName, out ia)) - return new IPEndPoint(ia, m_internalEndPoint.Port); - - // Reset for next check - ia = null; - try - { - foreach (IPAddress Adr in Dns.GetHostAddresses(m_externalHostName)) - { - if (ia == null) - ia = Adr; - - if (Adr.AddressFamily == AddressFamily.InterNetwork) - { - ia = Adr; - break; - } - } - } - catch (SocketException e) - { - throw new Exception( - "Unable to resolve local hostname " + m_externalHostName + " innerException of type '" + - e + "' attached to this exception", e); - } - - return new IPEndPoint(ia, m_internalEndPoint.Port); - } - + get { return Util.getEndPoint(m_externalHostName, m_internalEndPoint.Port); } set { m_externalHostName = value.ToString(); } } diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 5eedd29..83d9df1 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -429,6 +429,65 @@ namespace OpenSim.Framework return regionCoord << 8; } + public static IPEndPoint getEndPoint(IPAddress ia, int port) + { + if(ia == null) + return null; + + IPEndPoint newEP = null; + try + { + newEP = new IPEndPoint(ia, port); + } + catch + { + newEP = null; + } + return newEP; + } + + public static IPEndPoint getEndPoint(string hostname, int port) + { + IPAddress ia = null; + // If it is already an IP, don't resolve it - just return directly + // we should not need this + if (IPAddress.TryParse(hostname, out ia)) + { + if (ia.Equals(IPAddress.Any) || ia.Equals(IPAddress.IPv6Any)) + return null; + return getEndPoint(ia, port); + } + + // Reset for next check + ia = null; + try + { + foreach (IPAddress Adr in Dns.GetHostAddresses(hostname)) + { + if (ia == null) + ia = Adr; + + if (Adr.AddressFamily == AddressFamily.InterNetwork) + { + ia = Adr; + break; + } + } + } + catch // (SocketException e) + { + /*throw new Exception( + "Unable to resolve local hostname " + m_externalHostName + " innerException of type '" + + e + "' attached to this exception", e);*/ + // Don't throw a fatal exception here, instead, return Null and handle it in the caller. + // Reason is, on systems such as OSgrid it has occured that known hostnames stop + // resolving and thus make surrounding regions crash out with this exception. + return null; + } + + return getEndPoint(ia,port); + } + public static bool checkServiceURI(string uristr, out string serviceURI) { serviceURI = string.Empty; -- cgit v1.1 From 582dc75381a2d8eff4a231cb5fce5889602f57c8 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 27 May 2017 06:30:23 +0100 Subject: remove a accent from a method name --- OpenSim/Framework/Servers/MainServer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/MainServer.cs b/OpenSim/Framework/Servers/MainServer.cs index 7ecd383..523ccba 100644 --- a/OpenSim/Framework/Servers/MainServer.cs +++ b/OpenSim/Framework/Servers/MainServer.cs @@ -95,7 +95,7 @@ namespace OpenSim.Framework.Servers } - public static BaseHttpServer ÚnSecureInstance + public static BaseHttpServer UnSecureInstance { get { return unsecureinstance; } -- cgit v1.1 From 117e6ec26677fa4799521978256ed7f573cb9d9f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 27 May 2017 08:30:12 +0100 Subject: fix wrong cert ip compare --- OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index da2b860..c00ac9b 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -295,7 +295,7 @@ namespace OpenSim.Framework.Servers.HttpServer { foreach(string ip in m_certIPs) { - if (String.Compare(hostname, ip, true, CultureInfo.InvariantCulture) != 0) + if (String.Compare(hostname, ip, true, CultureInfo.InvariantCulture) == 0) return true; } } -- cgit v1.1 From a7db505cafca6ff43e29d169fcb16e47c812e5a8 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 27 May 2017 12:38:31 +0100 Subject: stupid mono5 doesn't know about Subject Alternative Name IPAddress --- OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index c00ac9b..e59d475 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -180,6 +180,21 @@ namespace OpenSim.Framework.Servers.HttpServer m_certNames.Add(parts[1]); else if(entryName == "IPAddress") m_certIPs.Add(parts[1]); + else if(entryName == "Unknown(135)") // stupid mono + { + try + { + if(parts[1].Length == 8) + { + long tmp = long.Parse(parts[1], NumberStyles.AllowHexSpecifier); + tmp = IPAddress.HostToNetworkOrder(tmp); + tmp = (long)((ulong) tmp >> 32); + IPAddress ia = new IPAddress(tmp); + m_certIPs.Add(ia.ToString()); + } + } + catch {} + } } } m_certCN = m_cert.GetNameInfo(X509NameType.SimpleName, false); @@ -2160,7 +2175,8 @@ namespace OpenSim.Framework.Servers.HttpServer try { - PollServiceRequestManager.Stop(); + if(PollServiceRequestManager != null) + PollServiceRequestManager.Stop(); m_httpListener2.ExceptionThrown -= httpServerException; //m_httpListener2.DisconnectHandler = null; -- cgit v1.1 From d1306c8976c17999337cbe1eba68f2d6dcb24e8c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 28 May 2017 02:11:40 +0100 Subject: a null ref check left behind on previus commits --- OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 92be3a3..7f56b6f 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -2017,7 +2017,8 @@ namespace OpenSim.Framework.Servers.HttpServer try { - PollServiceRequestManager.Stop(); + if(PollServiceRequestManager != null) + PollServiceRequestManager.Stop(); m_httpListener2.ExceptionThrown -= httpServerException; //m_httpListener2.DisconnectHandler = null; -- cgit v1.1 From 99111e50520860477a84620b3033b4d5d6a2c750 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 28 May 2017 23:51:13 +0100 Subject: enclose GetRequestStream on try/catch --- OpenSim/Framework/RestClient.cs | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/RestClient.cs b/OpenSim/Framework/RestClient.cs index 0166d9d..ac394fb 100644 --- a/OpenSim/Framework/RestClient.cs +++ b/OpenSim/Framework/RestClient.cs @@ -428,22 +428,23 @@ namespace OpenSim.Framework if (WebUtil.DebugLevel >= 5) WebUtil.LogOutgoingDetail(string.Format("SEND {0}: ", reqnum), src); - using (Stream dst = _request.GetRequestStream()) + + try { - m_log.Debug("[REST]: GetRequestStream is ok"); - - byte[] buf = new byte[1024]; - int length = src.Read(buf, 0, 1024); - m_log.Debug("[REST]: First Read is ok"); - while (length > 0) + using (Stream dst = _request.GetRequestStream()) { - dst.Write(buf, 0, length); - length = src.Read(buf, 0, 1024); + m_log.Debug("[REST]: GetRequestStream is ok"); + + byte[] buf = new byte[1024]; + int length = src.Read(buf, 0, 1024); + m_log.Debug("[REST]: First Read is ok"); + while (length > 0) + { + dst.Write(buf, 0, length); + length = src.Read(buf, 0, 1024); + } } - } - try - { _response = (HttpWebResponse)_request.GetResponse(); } catch (WebException e) -- cgit v1.1 From 2c19d084481e6a710d47ce72c357b1c1a6340531 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 29 May 2017 02:07:53 +0100 Subject: cleanup util.cs get dns --- OpenSim/Framework/Util.cs | 157 +++++++++++++++++++++++----------------------- 1 file changed, 80 insertions(+), 77 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 83d9df1..e3d89dc 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -429,64 +429,6 @@ namespace OpenSim.Framework return regionCoord << 8; } - public static IPEndPoint getEndPoint(IPAddress ia, int port) - { - if(ia == null) - return null; - - IPEndPoint newEP = null; - try - { - newEP = new IPEndPoint(ia, port); - } - catch - { - newEP = null; - } - return newEP; - } - - public static IPEndPoint getEndPoint(string hostname, int port) - { - IPAddress ia = null; - // If it is already an IP, don't resolve it - just return directly - // we should not need this - if (IPAddress.TryParse(hostname, out ia)) - { - if (ia.Equals(IPAddress.Any) || ia.Equals(IPAddress.IPv6Any)) - return null; - return getEndPoint(ia, port); - } - - // Reset for next check - ia = null; - try - { - foreach (IPAddress Adr in Dns.GetHostAddresses(hostname)) - { - if (ia == null) - ia = Adr; - - if (Adr.AddressFamily == AddressFamily.InterNetwork) - { - ia = Adr; - break; - } - } - } - catch // (SocketException e) - { - /*throw new Exception( - "Unable to resolve local hostname " + m_externalHostName + " innerException of type '" + - e + "' attached to this exception", e);*/ - // Don't throw a fatal exception here, instead, return Null and handle it in the caller. - // Reason is, on systems such as OSgrid it has occured that known hostnames stop - // resolving and thus make surrounding regions crash out with this exception. - return null; - } - - return getEndPoint(ia,port); - } public static bool checkServiceURI(string uristr, out string serviceURI) { @@ -1066,38 +1008,99 @@ namespace OpenSim.Framework /// An IP address, or null public static IPAddress GetHostFromDNS(string dnsAddress) { - // Is it already a valid IP? No need to look it up. - IPAddress ipa; - if (IPAddress.TryParse(dnsAddress, out ipa)) - return ipa; + // If it is already an IP, avoid possible broken mono from seeing it + IPAddress ia = null; + if (IPAddress.TryParse(dnsAddress, out ia) && ia != null) + { + if (ia.Equals(IPAddress.Any) || ia.Equals(IPAddress.IPv6Any)) + return null; + return ia; + } + // Reset for next check + ia = null; + try + { + foreach (IPAddress Adr in Dns.GetHostAddresses(dnsAddress)) + { + if (ia == null) + ia = Adr; - IPAddress[] hosts = null; + if (Adr.AddressFamily == AddressFamily.InterNetwork) + { + ia = Adr; + break; + } + } + } + catch // (SocketException e) + { + /*throw new Exception( + "Unable to resolve local hostname " + m_externalHostName + " innerException of type '" + + e + "' attached to this exception", e);*/ + // Don't throw a fatal exception here, instead, return Null and handle it in the caller. + // Reason is, on systems such as OSgrid it has occured that known hostnames stop + // resolving and thus make surrounding regions crash out with this exception. + return null; + } + return ia; + } + + public static IPEndPoint getEndPoint(IPAddress ia, int port) + { + if(ia == null) + return null; - // Not an IP, lookup required + IPEndPoint newEP = null; try { - hosts = Dns.GetHostEntry(dnsAddress).AddressList; + newEP = new IPEndPoint(ia, port); } - catch (Exception e) + catch { - m_log.WarnFormat("[UTIL]: An error occurred while resolving host name {0}, {1}", dnsAddress, e); - - // Still going to throw the exception on for now, since this was what was happening in the first place - throw e; + newEP = null; } + return newEP; + } - foreach (IPAddress host in hosts) + public static IPEndPoint getEndPoint(string hostname, int port) + { + IPAddress ia = null; + // If it is already an IP, avoid possible broken mono from seeing it + if (IPAddress.TryParse(hostname, out ia) && ia != null) { - if (host.AddressFamily == AddressFamily.InterNetwork) + if (ia.Equals(IPAddress.Any) || ia.Equals(IPAddress.IPv6Any)) + return null; + return getEndPoint(ia, port); + } + + // Reset for next check + ia = null; + try + { + foreach (IPAddress Adr in Dns.GetHostAddresses(hostname)) { - return host; + if (ia == null) + ia = Adr; + + if (Adr.AddressFamily == AddressFamily.InterNetwork) + { + ia = Adr; + break; + } } } + catch // (SocketException e) + { + /*throw new Exception( + "Unable to resolve local hostname " + m_externalHostName + " innerException of type '" + + e + "' attached to this exception", e);*/ + // Don't throw a fatal exception here, instead, return Null and handle it in the caller. + // Reason is, on systems such as OSgrid it has occured that known hostnames stop + // resolving and thus make surrounding regions crash out with this exception. + return null; + } - if (hosts.Length > 0) - return hosts[0]; - - return null; + return getEndPoint(ia,port); } public static Uri GetURI(string protocol, string hostname, int port, string path) -- cgit v1.1 From 27afe136d4ef1cf700802cc4d719156f0445f2b4 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 29 May 2017 03:13:56 +0100 Subject: mono is a total crap --- OpenSim/Framework/Util.cs | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index e3d89dc..3ddeafb 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -1064,6 +1064,9 @@ namespace OpenSim.Framework public static IPEndPoint getEndPoint(string hostname, int port) { + if(String.IsNullOrWhiteSpace(hostname)) + return null; + IPAddress ia = null; // If it is already an IP, avoid possible broken mono from seeing it if (IPAddress.TryParse(hostname, out ia) && ia != null) @@ -1075,31 +1078,31 @@ namespace OpenSim.Framework // Reset for next check ia = null; - try +#if (_MONO) + // mono is a TOTAL CRAP + int retry = 3; + while(ia == null && retry-- >= 0) +#endif { - foreach (IPAddress Adr in Dns.GetHostAddresses(hostname)) + try { - if (ia == null) - ia = Adr; - - if (Adr.AddressFamily == AddressFamily.InterNetwork) + foreach (IPAddress Adr in Dns.GetHostAddresses(hostname)) { - ia = Adr; - break; + if (ia == null) + ia = Adr; + + if (Adr.AddressFamily == AddressFamily.InterNetwork) + { + ia = Adr; + break; + } } } + catch // (SocketException e) + { + ia = null; + } } - catch // (SocketException e) - { - /*throw new Exception( - "Unable to resolve local hostname " + m_externalHostName + " innerException of type '" + - e + "' attached to this exception", e);*/ - // Don't throw a fatal exception here, instead, return Null and handle it in the caller. - // Reason is, on systems such as OSgrid it has occured that known hostnames stop - // resolving and thus make surrounding regions crash out with this exception. - return null; - } - return getEndPoint(ia,port); } -- cgit v1.1 From 7be6e16555a25177128f6767661387cdffe084cc Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 29 May 2017 03:41:09 +0100 Subject: no.. still a fail --- OpenSim/Framework/Util.cs | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 3ddeafb..fe84498 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -1078,31 +1078,25 @@ namespace OpenSim.Framework // Reset for next check ia = null; -#if (_MONO) - // mono is a TOTAL CRAP - int retry = 3; - while(ia == null && retry-- >= 0) -#endif + try { - try + foreach (IPAddress Adr in Dns.GetHostAddresses(hostname)) { - foreach (IPAddress Adr in Dns.GetHostAddresses(hostname)) - { - if (ia == null) - ia = Adr; + if (ia == null) + ia = Adr; - if (Adr.AddressFamily == AddressFamily.InterNetwork) - { - ia = Adr; - break; - } + if (Adr.AddressFamily == AddressFamily.InterNetwork) + { + ia = Adr; + break; } } - catch // (SocketException e) - { - ia = null; - } } + catch // (SocketException e) + { + ia = null; + } + return getEndPoint(ia,port); } -- cgit v1.1 From 8f86de265c6187a61dde12fb122c1ae017b6ecf6 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 29 May 2017 05:22:21 +0100 Subject: some cleanup and assume Linux/mono DNS is just broken... --- OpenSim/Framework/Util.cs | 76 ++++++++++++++++++++++++++--------------------- 1 file changed, 42 insertions(+), 34 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index fe84498..061743d 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -1009,6 +1009,9 @@ namespace OpenSim.Framework public static IPAddress GetHostFromDNS(string dnsAddress) { // If it is already an IP, avoid possible broken mono from seeing it + if(String.IsNullOrWhiteSpace(dnsAddress)) + return null; + IPAddress ia = null; if (IPAddress.TryParse(dnsAddress, out ia) && ia != null) { @@ -1016,31 +1019,31 @@ namespace OpenSim.Framework return null; return ia; } - // Reset for next check - ia = null; + + IPHostEntry IPH; try { - foreach (IPAddress Adr in Dns.GetHostAddresses(dnsAddress)) - { - if (ia == null) - ia = Adr; - - if (Adr.AddressFamily == AddressFamily.InterNetwork) - { - ia = Adr; - break; - } - } + IPH = Dns.GetHostEntry(dnsAddress); } catch // (SocketException e) { - /*throw new Exception( - "Unable to resolve local hostname " + m_externalHostName + " innerException of type '" + - e + "' attached to this exception", e);*/ - // Don't throw a fatal exception here, instead, return Null and handle it in the caller. - // Reason is, on systems such as OSgrid it has occured that known hostnames stop - // resolving and thus make surrounding regions crash out with this exception. + return null; + } + + if(IPH == null || IPH.AddressList.Length == 0) return null; + + ia = null; + foreach (IPAddress Adr in IPH.AddressList) + { + if (ia == null) + ia = Adr; + + if (Adr.AddressFamily == AddressFamily.InterNetwork) + { + ia = Adr; + break; + } } return ia; } @@ -1075,26 +1078,31 @@ namespace OpenSim.Framework return null; return getEndPoint(ia, port); } - - // Reset for next check - ia = null; + + IPHostEntry IPH; try { - foreach (IPAddress Adr in Dns.GetHostAddresses(hostname)) - { - if (ia == null) - ia = Adr; - - if (Adr.AddressFamily == AddressFamily.InterNetwork) - { - ia = Adr; - break; - } - } + IPH = Dns.GetHostEntry(hostname); } catch // (SocketException e) { - ia = null; + return null; + } + + if(IPH == null || IPH.AddressList.Length == 0) + return null; + + ia = null; + foreach (IPAddress Adr in IPH.AddressList) + { + if (ia == null) + ia = Adr; + + if (Adr.AddressFamily == AddressFamily.InterNetwork) + { + ia = Adr; + break; + } } return getEndPoint(ia,port); -- cgit v1.1 From a317bba8cf4783b9f664c4b4bc9974eedbca6feb Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 29 May 2017 07:11:13 +0100 Subject: cache endpoints (and other paths) dns requests for 5min, this delay should be acceptable in all cases ? --- OpenSim/Framework/Util.cs | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 061743d..a3c7750 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -991,6 +991,8 @@ namespace OpenSim.Framework return output.ToString(); } + static ExpiringCache dnscache = new ExpiringCache(); + /// /// Converts a URL to a IPAddress /// @@ -1008,15 +1010,20 @@ namespace OpenSim.Framework /// An IP address, or null public static IPAddress GetHostFromDNS(string dnsAddress) { - // If it is already an IP, avoid possible broken mono from seeing it if(String.IsNullOrWhiteSpace(dnsAddress)) return null; IPAddress ia = null; + if(dnscache.TryGetValue(dnsAddress, out ia) && ia != null) + return ia; + + ia = null; + // If it is already an IP, don't let GetHostEntry see it if (IPAddress.TryParse(dnsAddress, out ia) && ia != null) { if (ia.Equals(IPAddress.Any) || ia.Equals(IPAddress.IPv6Any)) return null; + dnscache.AddOrUpdate(dnsAddress, ia, 300); return ia; } @@ -1027,7 +1034,7 @@ namespace OpenSim.Framework } catch // (SocketException e) { - return null; + return null; } if(IPH == null || IPH.AddressList.Length == 0) @@ -1045,6 +1052,8 @@ namespace OpenSim.Framework break; } } + if(ia != null) + dnscache.AddOrUpdate(dnsAddress, ia, 300); return ia; } @@ -1071,14 +1080,22 @@ namespace OpenSim.Framework return null; IPAddress ia = null; - // If it is already an IP, avoid possible broken mono from seeing it + if(dnscache.TryGetValue(hostname, out ia) && ia != null) + return getEndPoint(ia, port); + + ia = null; + + // If it is already an IP, don't let GetHostEntry see it if (IPAddress.TryParse(hostname, out ia) && ia != null) { if (ia.Equals(IPAddress.Any) || ia.Equals(IPAddress.IPv6Any)) return null; + + dnscache.AddOrUpdate(hostname, ia, 300); return getEndPoint(ia, port); } - + + IPHostEntry IPH; try { @@ -1086,7 +1103,7 @@ namespace OpenSim.Framework } catch // (SocketException e) { - return null; + return null; } if(IPH == null || IPH.AddressList.Length == 0) @@ -1105,6 +1122,9 @@ namespace OpenSim.Framework } } + if(ia != null) + dnscache.AddOrUpdate(hostname, ia, 300); + return getEndPoint(ia,port); } -- cgit v1.1 From 91caf98308e4a5f371f9a25adfb4084ff5bfbc34 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 29 May 2017 07:48:09 +0100 Subject: change servicePoint dns expire also to 5min, let the endpoints expire slide. This should reduce impact of absurd dns fails observed on my test ubuntu VM --- OpenSim/Framework/Util.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index a3c7750..f52a84c 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -991,7 +991,7 @@ namespace OpenSim.Framework return output.ToString(); } - static ExpiringCache dnscache = new ExpiringCache(); + private static ExpiringCache dnscache = new ExpiringCache(); /// /// Converts a URL to a IPAddress @@ -1015,7 +1015,10 @@ namespace OpenSim.Framework IPAddress ia = null; if(dnscache.TryGetValue(dnsAddress, out ia) && ia != null) + { + dnscache.AddOrUpdate(dnsAddress, ia, 300); return ia; + } ia = null; // If it is already an IP, don't let GetHostEntry see it @@ -1081,7 +1084,10 @@ namespace OpenSim.Framework IPAddress ia = null; if(dnscache.TryGetValue(hostname, out ia) && ia != null) + { + dnscache.AddOrUpdate(hostname, ia, 300); return getEndPoint(ia, port); + } ia = null; -- cgit v1.1 From e5bebe3a3215bac1d5d54602ded7859860470aa0 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 30 May 2017 08:20:58 +0100 Subject: webrequests serialiazation per endpoint its now ServicePointManager job --- OpenSim/Framework/Servers/ServerBase.cs | 48 +--------------------------- OpenSim/Framework/WebUtil.cs | 55 +-------------------------------- 2 files changed, 2 insertions(+), 101 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/ServerBase.cs b/OpenSim/Framework/Servers/ServerBase.cs index f627ae6..3bb2313 100644 --- a/OpenSim/Framework/Servers/ServerBase.cs +++ b/OpenSim/Framework/Servers/ServerBase.cs @@ -275,18 +275,6 @@ namespace OpenSim.Framework.Servers (string module, string[] args) => Notice(GetThreadsReport())); m_console.Commands.AddCommand ( - "Debug", false, "debug comms set", - "debug comms set serialosdreq true|false", - "Set comms parameters. For debug purposes.", - HandleDebugCommsSet); - - m_console.Commands.AddCommand ( - "Debug", false, "debug comms status", - "debug comms status", - "Show current debug comms parameters.", - HandleDebugCommsStatus); - - m_console.Commands.AddCommand ( "Debug", false, "debug threadpool set", "debug threadpool set worker|iocp min|max ", "Set threadpool parameters. For debug purposes.", @@ -343,47 +331,13 @@ namespace OpenSim.Framework.Servers public void RegisterCommonComponents(IConfigSource configSource) { - IConfig networkConfig = configSource.Configs["Network"]; - - if (networkConfig != null) - { - WebUtil.SerializeOSDRequestsPerEndpoint = networkConfig.GetBoolean("SerializeOSDRequests", false); - } +// IConfig networkConfig = configSource.Configs["Network"]; m_serverStatsCollector = new ServerStatsCollector(); m_serverStatsCollector.Initialise(configSource); m_serverStatsCollector.Start(); } - private void HandleDebugCommsStatus(string module, string[] args) - { - Notice("serialosdreq is {0}", WebUtil.SerializeOSDRequestsPerEndpoint); - } - - private void HandleDebugCommsSet(string module, string[] args) - { - if (args.Length != 5) - { - Notice("Usage: debug comms set serialosdreq true|false"); - return; - } - - if (args[3] != "serialosdreq") - { - Notice("Usage: debug comms set serialosdreq true|false"); - return; - } - - bool setSerializeOsdRequests; - - if (!ConsoleUtil.TryParseConsoleBool(m_console, args[4], out setSerializeOsdRequests)) - return; - - WebUtil.SerializeOSDRequestsPerEndpoint = setSerializeOsdRequests; - - Notice("serialosdreq is now {0}", setSerializeOsdRequests); - } - private void HandleShowThreadpoolCallsActive(string module, string[] args) { List> calls = Util.GetFireAndForgetCallsInProgress().ToList(); diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 12f58fe..7b085d0 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -72,11 +72,6 @@ namespace OpenSim.Framework public static int RequestNumber { get; set; } /// - /// Control where OSD requests should be serialized per endpoint. - /// - public static bool SerializeOSDRequestsPerEndpoint { get; set; } - - /// /// this is the header field used to communicate the local request id /// used for performance and debugging /// @@ -98,31 +93,6 @@ namespace OpenSim.Framework /// public const int MaxRequestDiagLength = 200; - /// - /// Dictionary of end points - /// - private static Dictionary m_endpointSerializer = new Dictionary(); - - private static object EndPointLock(string url) - { - System.Uri uri = new System.Uri(url); - string endpoint = string.Format("{0}:{1}",uri.Host,uri.Port); - - lock (m_endpointSerializer) - { - object eplock = null; - - if (! m_endpointSerializer.TryGetValue(endpoint,out eplock)) - { - eplock = new object(); - m_endpointSerializer.Add(endpoint,eplock); - // m_log.WarnFormat("[WEB UTIL] add a new host to end point serializer {0}",endpoint); - } - - return eplock; - } - } - #region JSONRequest /// @@ -154,21 +124,6 @@ namespace OpenSim.Framework return ServiceOSDRequest(url, null, "GET", timeout, false, false); } - public static OSDMap ServiceOSDRequest(string url, OSDMap data, string method, int timeout, bool compressed, bool rpc) - { - if (SerializeOSDRequestsPerEndpoint) - { - lock (EndPointLock(url)) - { - return ServiceOSDRequestWorker(url, data, method, timeout, compressed, rpc); - } - } - else - { - return ServiceOSDRequestWorker(url, data, method, timeout, compressed, rpc); - } - } - public static void LogOutgoingDetail(Stream outputStream) { LogOutgoingDetail("", outputStream); @@ -222,7 +177,7 @@ namespace OpenSim.Framework LogOutgoingDetail(string.Format("RESPONSE {0}: ", reqnum), input); } - private static OSDMap ServiceOSDRequestWorker(string url, OSDMap data, string method, int timeout, bool compressed, bool rpc) + public static OSDMap ServiceOSDRequest(string url, OSDMap data, string method, int timeout, bool compressed, bool rpc) { int reqnum = RequestNumber++; @@ -422,14 +377,6 @@ namespace OpenSim.Framework public static OSDMap ServiceFormRequest(string url, NameValueCollection data, int timeout) { - lock (EndPointLock(url)) - { - return ServiceFormRequestWorker(url,data,timeout); - } - } - - private static OSDMap ServiceFormRequestWorker(string url, NameValueCollection data, int timeout) - { int reqnum = RequestNumber++; string method = (data != null && data["RequestMethod"] != null) ? data["RequestMethod"] : "unknown"; -- cgit v1.1 From 90da5280af1ade789e6a9d5c71f4d193dac59c33 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 30 May 2017 09:01:39 +0100 Subject: put back soft http close --- .../Framework/Servers/HttpServer/PollServiceRequestManager.cs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index bd1c040..c6a3e65 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs @@ -194,7 +194,6 @@ namespace OpenSim.Framework.Servers.HttpServer qu.Clear(); m_bycontext.Clear(); -/* try { foreach (PollServiceHttpRequest req in m_retryRequests) @@ -207,22 +206,21 @@ namespace OpenSim.Framework.Servers.HttpServer } PollServiceHttpRequest wreq; -*/ + m_retryRequests.Clear(); -/* + while (m_requests.Count() > 0) { try { wreq = m_requests.Dequeue(0); wreq.DoHTTPstop(m_server); - } catch { } } -*/ + m_requests.Clear(); } @@ -232,7 +230,7 @@ namespace OpenSim.Framework.Servers.HttpServer { while (m_running) { - PollServiceHttpRequest req = m_requests.Dequeue(5000); + PollServiceHttpRequest req = m_requests.Dequeue(4500); Watchdog.UpdateThread(); if (req != null) { -- cgit v1.1 From b1c585718c65b709f26fd7d7d55a1ff6223a3ec3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 31 May 2017 04:30:00 +0100 Subject: remove debug messages --- OpenSim/Framework/RestClient.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/RestClient.cs b/OpenSim/Framework/RestClient.cs index ac394fb..4939cf7 100644 --- a/OpenSim/Framework/RestClient.cs +++ b/OpenSim/Framework/RestClient.cs @@ -433,11 +433,11 @@ namespace OpenSim.Framework { using (Stream dst = _request.GetRequestStream()) { - m_log.Debug("[REST]: GetRequestStream is ok"); +// m_log.Debug("[REST]: GetRequestStream is ok"); byte[] buf = new byte[1024]; int length = src.Read(buf, 0, 1024); - m_log.Debug("[REST]: First Read is ok"); +// m_log.Debug("[REST]: First Read is ok"); while (length > 0) { dst.Write(buf, 0, length); -- cgit v1.1 From 67e540e05c34667b771fb5d95e4d7bdc0dfce24d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 3 Jun 2017 04:28:43 +0100 Subject: cross mouse buttons state --- OpenSim/Framework/ChildAgentDataUpdate.cs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs index d6d8dde..ee5007a 100644 --- a/OpenSim/Framework/ChildAgentDataUpdate.cs +++ b/OpenSim/Framework/ChildAgentDataUpdate.cs @@ -375,6 +375,7 @@ namespace OpenSim.Framework public string ActiveGroupTitle = null; public UUID agentCOF; public byte CrossingFlags; + public byte CrossExtraFlags; public Dictionary ChildrenCapSeeds = null; public Animation[] Anims; @@ -454,6 +455,8 @@ namespace OpenSim.Framework args["agent_cof"] = OSD.FromUUID(agentCOF); args["crossingflags"] = OSD.FromInteger(CrossingFlags); + if(CrossingFlags != 0) + args["crossExtraFlags"] = OSD.FromInteger(CrossExtraFlags); args["active_group_id"] = OSD.FromUUID(ActiveGroupID); args["active_group_name"] = OSD.FromString(ActiveGroupName); @@ -646,6 +649,12 @@ namespace OpenSim.Framework if (args.ContainsKey("crossingflags") && args["crossingflags"] != null) CrossingFlags = (byte)args["crossingflags"].AsInteger(); + if(CrossingFlags != 0) + { + if (args.ContainsKey("crossExtraFlags") && args["crossExtraFlags"] != null) + CrossExtraFlags = (byte)args["crossExtraFlags"].AsInteger(); + } + if (args.ContainsKey("active_group_id") && args["active_group_id"] != null) ActiveGroupID = args["active_group_id"].AsUUID(); -- cgit v1.1 From 7d58b73bbcef148cdcd57b9a2796331c6497c397 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 6 Jun 2017 21:55:47 +0100 Subject: some changes on pollevent --- OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 13 +------------ .../Servers/HttpServer/PollServiceRequestManager.cs | 9 ++------- 2 files changed, 3 insertions(+), 19 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index e59d475..ce4503c 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -1935,20 +1935,13 @@ namespace OpenSim.Framework.Servers.HttpServer { response.ProtocolVersion = (string)responsedata["http_protocol_version"]; } -/* + if (responsedata.ContainsKey("keepalive")) { bool keepalive = (bool)responsedata["keepalive"]; response.KeepAlive = keepalive; } - if (responsedata.ContainsKey("reusecontext")) - response.ReuseContext = (bool) responsedata["reusecontext"]; -*/ - // disable this things - response.KeepAlive = false; - // response.ReuseContext = false; - // Cross-Origin Resource Sharing with simple requests if (responsedata.ContainsKey("access_control_allow_origin")) response.AddHeader("Access-Control-Allow-Origin", (string)responsedata["access_control_allow_origin"]); @@ -1961,11 +1954,8 @@ namespace OpenSim.Framework.Servers.HttpServer contentType = "text/html"; } - - // The client ignores anything but 200 here for web login, so ensure that this is 200 for that - response.StatusCode = responsecode; if (responsecode == (int)OSHttpStatusCode.RedirectMovedPermanently) @@ -1975,7 +1965,6 @@ namespace OpenSim.Framework.Servers.HttpServer } response.AddHeader("Content-Type", contentType); - if (responsedata.ContainsKey("headers")) { Hashtable headerdata = (Hashtable)responsedata["headers"]; diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index 415c264..cbdd781 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs @@ -271,22 +271,17 @@ namespace OpenSim.Framework.Servers.HttpServer if (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id)) { - Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id); - m_threadPool.QueueWorkItem(x => { try { + Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id); req.DoHTTPGruntWork(m_server, responsedata); } catch (ObjectDisposedException) { } finally { - if(req.HttpContext.CanSend() && req.PollServiceArgs.Type == PollServiceEventArgs.EventType.Poll - && (Environment.TickCount - req.RequestTime) > req.PollServiceArgs.TimeOutms) - ReQueueEvent(req); - else - byContextDequeue(req); + byContextDequeue(req); } return null; }, null); -- cgit v1.1 From ef2fd8fcea311c32582a2fba7d8979c529ff05be Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 8 Jun 2017 20:47:51 +0100 Subject: keep the reverted code, that does work. Our code likes to have pbs.Media == null when there is no MOAD defined, so handle possible odd oars that may have llsd on that case --- OpenSim/Framework/PrimitiveBaseShape.cs | 43 +++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 15 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs index a830551..96d78d3 100644 --- a/OpenSim/Framework/PrimitiveBaseShape.cs +++ b/OpenSim/Framework/PrimitiveBaseShape.cs @@ -1580,35 +1580,48 @@ namespace OpenSim.Framework { MediaList ml = new MediaList(); ml.ReadXml(rawXml); + if(ml.Count == 0) + return null; return ml; } public void ReadXml(string rawXml) { - using (StringReader sr = new StringReader(rawXml)) + try { - using (XmlTextReader xtr = new XmlTextReader(sr)) + using (StringReader sr = new StringReader(rawXml)) { - xtr.MoveToContent(); + using (XmlTextReader xtr = new XmlTextReader(sr)) + { + xtr.MoveToContent(); - string type = xtr.GetAttribute("type"); - //m_log.DebugFormat("[MOAP]: Loaded media texture entry with type {0}", type); + string type = xtr.GetAttribute("type"); + //m_log.DebugFormat("[MOAP]: Loaded media texture entry with type {0}", type); - if (type != MEDIA_TEXTURE_TYPE) - return; + if (type != MEDIA_TEXTURE_TYPE) + return; - xtr.ReadStartElement("OSMedia"); + xtr.ReadStartElement("OSMedia"); + OSD osdp = OSDParser.DeserializeLLSDXml(xtr.ReadInnerXml()); + if(osdp == null || !(osdp is OSDArray)) + return; - OSDArray osdMeArray = (OSDArray)OSDParser.DeserializeLLSDXml(xtr.ReadInnerXml()); - foreach (OSD osdMe in osdMeArray) - { - MediaEntry me = (osdMe is OSDMap ? MediaEntry.FromOSD(osdMe) : new MediaEntry()); - Add(me); - } + OSDArray osdMeArray = osdp as OSDArray; + if(osdMeArray.Count == 0) + return; - xtr.ReadEndElement(); + foreach (OSD osdMe in osdMeArray) + { + MediaEntry me = (osdMe is OSDMap ? MediaEntry.FromOSD(osdMe) : new MediaEntry()); + Add(me); + } + } } } + catch + { + m_log.Debug("PrimitiveBaseShape] error decoding MOAP xml" ); + } } public void ReadXml(XmlReader reader) -- cgit v1.1 From e8165a7b51db74ea8d283dbfa34f21bf3d7a7552 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 9 Jun 2017 20:14:56 +0100 Subject: only silent remove threads from watch list if they stopped ( ie still consider aborted etc ) --- OpenSim/Framework/Monitoring/Watchdog.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Monitoring/Watchdog.cs b/OpenSim/Framework/Monitoring/Watchdog.cs index 5fb725c..9cac451 100644 --- a/OpenSim/Framework/Monitoring/Watchdog.cs +++ b/OpenSim/Framework/Monitoring/Watchdog.cs @@ -254,14 +254,12 @@ namespace OpenSim.Framework.Monitoring twi.Cleanup(); m_threads.Remove(threadID); - return true; } else { m_log.WarnFormat( "[WATCHDOG]: Requested to remove thread with ID {0} but this is not being monitored", threadID); - return false; } } @@ -360,7 +358,7 @@ namespace OpenSim.Framework.Monitoring List callbackInfos = null; List threadsToRemove = null; - const ThreadState thgone = ThreadState.Stopped | ThreadState.Aborted | ThreadState.AbortRequested; + const ThreadState thgone = ThreadState.Stopped; lock (m_threads) { @@ -368,7 +366,7 @@ namespace OpenSim.Framework.Monitoring { if(!m_enabled) return; - if(!threadInfo.Thread.IsAlive || (threadInfo.Thread.ThreadState & thgone) != 0) + if((threadInfo.Thread.ThreadState & thgone) != 0) { if(threadsToRemove == null) threadsToRemove = new List(); -- cgit v1.1 From 73aa7520341fec13416661f19ea19cf138b6386d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 10 Jun 2017 04:18:31 +0100 Subject: replace some locked objects by .net4.0 concurrent objects --- .../HttpServer/PollServiceRequestManager.cs | 62 +++++++++++----------- 1 file changed, 32 insertions(+), 30 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index cbdd781..9115b62 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs @@ -27,6 +27,7 @@ using System; using System.Collections; +using System.Collections.Concurrent; using System.Threading; using System.Reflection; using log4net; @@ -46,10 +47,9 @@ namespace OpenSim.Framework.Servers.HttpServer private readonly BaseHttpServer m_server; - private Dictionary> m_bycontext; - private BlockingQueue m_requests = new BlockingQueue(); - private static Queue m_retryRequests = new Queue(); - + private ConcurrentDictionary > m_bycontext; + private BlockingCollection m_requests = new BlockingCollection(); + private static ConcurrentQueue m_retryRequests = new ConcurrentQueue(); private uint m_WorkerThreadCount = 0; private Thread[] m_workerThreads; private Thread m_retrysThread; @@ -66,7 +66,7 @@ namespace OpenSim.Framework.Servers.HttpServer m_workerThreads = new Thread[m_WorkerThreadCount]; PollServiceHttpRequestComparer preqCp = new PollServiceHttpRequestComparer(); - m_bycontext = new Dictionary>(preqCp); + m_bycontext = new ConcurrentDictionary >(preqCp); STPStartInfo startInfo = new STPStartInfo(); startInfo.IdleTimeout = 30000; @@ -113,23 +113,23 @@ namespace OpenSim.Framework.Servers.HttpServer { if (m_running) { - lock (m_retryRequests) +// lock (m_retryRequests) m_retryRequests.Enqueue(req); } } public void Enqueue(PollServiceHttpRequest req) { - lock (m_bycontext) +// lock (m_bycontext) { - Queue ctxQeueue; + ConcurrentQueue ctxQeueue; if (m_bycontext.TryGetValue(req, out ctxQeueue)) { ctxQeueue.Enqueue(req); } else { - ctxQeueue = new Queue(); + ctxQeueue = new ConcurrentQueue(); m_bycontext[req] = ctxQeueue; EnqueueInt(req); } @@ -138,19 +138,20 @@ namespace OpenSim.Framework.Servers.HttpServer public void byContextDequeue(PollServiceHttpRequest req) { - Queue ctxQeueue; - lock (m_bycontext) + ConcurrentQueue ctxQeueue; +// lock (m_bycontext) { if (m_bycontext.TryGetValue(req, out ctxQeueue)) { - if (ctxQeueue.Count > 0) + if (!ctxQeueue.IsEmpty) { - PollServiceHttpRequest newreq = ctxQeueue.Dequeue(); - EnqueueInt(newreq); + PollServiceHttpRequest newreq; + if(ctxQeueue.TryDequeue(out newreq)) + EnqueueInt(newreq); } else { - m_bycontext.Remove(req); + m_bycontext.TryRemove(req, out ctxQeueue); } } } @@ -158,13 +159,13 @@ namespace OpenSim.Framework.Servers.HttpServer public void DropByContext(PollServiceHttpRequest req) { - Queue ctxQeueue; + ConcurrentQueue ctxQeueue; lock (m_bycontext) { - if (m_bycontext.TryGetValue(req, out ctxQeueue)) + if (m_bycontext.ContainsKey(req)) { - ctxQeueue.Clear(); - m_bycontext.Remove(req); +// ctxQeueue.Clear(); + m_bycontext.TryRemove(req, out ctxQeueue); } } } @@ -172,20 +173,21 @@ namespace OpenSim.Framework.Servers.HttpServer public void EnqueueInt(PollServiceHttpRequest req) { if (m_running) - m_requests.Enqueue(req); + m_requests.Add(req); } private void CheckRetries() { + PollServiceHttpRequest req; while (m_running) - { Thread.Sleep(100); // let the world move .. back to faster rate Watchdog.UpdateThread(); - lock (m_retryRequests) +// lock (m_retryRequests) { while (m_retryRequests.Count > 0 && m_running) - m_requests.Enqueue(m_retryRequests.Dequeue()); + if(m_retryRequests.TryDequeue(out req)) + m_requests.Add(req); } } } @@ -203,8 +205,8 @@ namespace OpenSim.Framework.Servers.HttpServer // any entry in m_bycontext should have a active request on the other queues // so just delete contents to easy GC - foreach (Queue qu in m_bycontext.Values) - qu.Clear(); +// foreach (Queue qu in m_bycontext.Values) +// qu.Clear(); m_bycontext.Clear(); try @@ -220,13 +222,13 @@ namespace OpenSim.Framework.Servers.HttpServer PollServiceHttpRequest wreq; - m_retryRequests.Clear(); +// m_retryRequests.Clear(); - while (m_requests.Count() > 0) + while (m_requests.Count > 0) { try { - wreq = m_requests.Dequeue(0); + wreq = m_requests.Take(); wreq.DoHTTPstop(m_server); } catch @@ -234,7 +236,7 @@ namespace OpenSim.Framework.Servers.HttpServer } } - m_requests.Clear(); +// m_requests.Clear(); } // work threads @@ -243,7 +245,7 @@ namespace OpenSim.Framework.Servers.HttpServer { while (m_running) { - PollServiceHttpRequest req = m_requests.Dequeue(4500); + PollServiceHttpRequest req = m_requests.Take(); Watchdog.UpdateThread(); if(req == null) continue; -- cgit v1.1 From 5842d5f7b02d437f692063b7802a30125197681a Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 10 Jun 2017 13:58:16 +0100 Subject: revert. The .net concurrent objects look nice, but mono5 cpu load with them does not --- .../HttpServer/PollServiceRequestManager.cs | 62 +++++++++++----------- 1 file changed, 30 insertions(+), 32 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index 9115b62..cbdd781 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs @@ -27,7 +27,6 @@ using System; using System.Collections; -using System.Collections.Concurrent; using System.Threading; using System.Reflection; using log4net; @@ -47,9 +46,10 @@ namespace OpenSim.Framework.Servers.HttpServer private readonly BaseHttpServer m_server; - private ConcurrentDictionary > m_bycontext; - private BlockingCollection m_requests = new BlockingCollection(); - private static ConcurrentQueue m_retryRequests = new ConcurrentQueue(); + private Dictionary> m_bycontext; + private BlockingQueue m_requests = new BlockingQueue(); + private static Queue m_retryRequests = new Queue(); + private uint m_WorkerThreadCount = 0; private Thread[] m_workerThreads; private Thread m_retrysThread; @@ -66,7 +66,7 @@ namespace OpenSim.Framework.Servers.HttpServer m_workerThreads = new Thread[m_WorkerThreadCount]; PollServiceHttpRequestComparer preqCp = new PollServiceHttpRequestComparer(); - m_bycontext = new ConcurrentDictionary >(preqCp); + m_bycontext = new Dictionary>(preqCp); STPStartInfo startInfo = new STPStartInfo(); startInfo.IdleTimeout = 30000; @@ -113,23 +113,23 @@ namespace OpenSim.Framework.Servers.HttpServer { if (m_running) { -// lock (m_retryRequests) + lock (m_retryRequests) m_retryRequests.Enqueue(req); } } public void Enqueue(PollServiceHttpRequest req) { -// lock (m_bycontext) + lock (m_bycontext) { - ConcurrentQueue ctxQeueue; + Queue ctxQeueue; if (m_bycontext.TryGetValue(req, out ctxQeueue)) { ctxQeueue.Enqueue(req); } else { - ctxQeueue = new ConcurrentQueue(); + ctxQeueue = new Queue(); m_bycontext[req] = ctxQeueue; EnqueueInt(req); } @@ -138,20 +138,19 @@ namespace OpenSim.Framework.Servers.HttpServer public void byContextDequeue(PollServiceHttpRequest req) { - ConcurrentQueue ctxQeueue; -// lock (m_bycontext) + Queue ctxQeueue; + lock (m_bycontext) { if (m_bycontext.TryGetValue(req, out ctxQeueue)) { - if (!ctxQeueue.IsEmpty) + if (ctxQeueue.Count > 0) { - PollServiceHttpRequest newreq; - if(ctxQeueue.TryDequeue(out newreq)) - EnqueueInt(newreq); + PollServiceHttpRequest newreq = ctxQeueue.Dequeue(); + EnqueueInt(newreq); } else { - m_bycontext.TryRemove(req, out ctxQeueue); + m_bycontext.Remove(req); } } } @@ -159,13 +158,13 @@ namespace OpenSim.Framework.Servers.HttpServer public void DropByContext(PollServiceHttpRequest req) { - ConcurrentQueue ctxQeueue; + Queue ctxQeueue; lock (m_bycontext) { - if (m_bycontext.ContainsKey(req)) + if (m_bycontext.TryGetValue(req, out ctxQeueue)) { -// ctxQeueue.Clear(); - m_bycontext.TryRemove(req, out ctxQeueue); + ctxQeueue.Clear(); + m_bycontext.Remove(req); } } } @@ -173,21 +172,20 @@ namespace OpenSim.Framework.Servers.HttpServer public void EnqueueInt(PollServiceHttpRequest req) { if (m_running) - m_requests.Add(req); + m_requests.Enqueue(req); } private void CheckRetries() { - PollServiceHttpRequest req; while (m_running) + { Thread.Sleep(100); // let the world move .. back to faster rate Watchdog.UpdateThread(); -// lock (m_retryRequests) + lock (m_retryRequests) { while (m_retryRequests.Count > 0 && m_running) - if(m_retryRequests.TryDequeue(out req)) - m_requests.Add(req); + m_requests.Enqueue(m_retryRequests.Dequeue()); } } } @@ -205,8 +203,8 @@ namespace OpenSim.Framework.Servers.HttpServer // any entry in m_bycontext should have a active request on the other queues // so just delete contents to easy GC -// foreach (Queue qu in m_bycontext.Values) -// qu.Clear(); + foreach (Queue qu in m_bycontext.Values) + qu.Clear(); m_bycontext.Clear(); try @@ -222,13 +220,13 @@ namespace OpenSim.Framework.Servers.HttpServer PollServiceHttpRequest wreq; -// m_retryRequests.Clear(); + m_retryRequests.Clear(); - while (m_requests.Count > 0) + while (m_requests.Count() > 0) { try { - wreq = m_requests.Take(); + wreq = m_requests.Dequeue(0); wreq.DoHTTPstop(m_server); } catch @@ -236,7 +234,7 @@ namespace OpenSim.Framework.Servers.HttpServer } } -// m_requests.Clear(); + m_requests.Clear(); } // work threads @@ -245,7 +243,7 @@ namespace OpenSim.Framework.Servers.HttpServer { while (m_running) { - PollServiceHttpRequest req = m_requests.Take(); + PollServiceHttpRequest req = m_requests.Dequeue(4500); Watchdog.UpdateThread(); if(req == null) continue; -- cgit v1.1 From 70be8ba6defc5ef385ac7b7f030361f8392e3dc4 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 12 Jun 2017 13:29:14 +0100 Subject: make some web request errors visible, so cause of later asset not found is clear --- OpenSim/Framework/WebUtil.cs | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 7b085d0..48078ad 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -1262,18 +1262,24 @@ namespace OpenSim.Framework { if (hwr.StatusCode == HttpStatusCode.NotFound) return deserial; + if (hwr.StatusCode == HttpStatusCode.Unauthorized) { - m_log.Error(string.Format( - "[SynchronousRestObjectRequester]: Web request {0} requires authentication ", - requestUrl)); - return deserial; + m_log.ErrorFormat("[SynchronousRestObjectRequester]: Web request {0} requires authentication", + requestUrl); + } + else + { + m_log.WarnFormat("[SynchronousRestObjectRequester]: Web request {0} returned error: {1}", + requestUrl, hwr.StatusCode); } } else - m_log.Error(string.Format( - "[SynchronousRestObjectRequester]: WebException for {0} {1} {2} ", - verb, requestUrl, typeof(TResponse).ToString()), e); + m_log.ErrorFormat( + "[SynchronousRestObjectRequester]: WebException for {0} {1} {2} {3}", + verb, requestUrl, typeof(TResponse).ToString(), e.Message); + + return deserial; } } catch (System.InvalidOperationException) -- cgit v1.1 From 5ce15566acf41be0d07e67e858d22eb65177816a Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 13 Jun 2017 18:39:42 +0100 Subject: add option for Fireandforget not timeout (our access to main smartThreadPool) --- OpenSim/Framework/Monitoring/WorkManager.cs | 8 +++----- OpenSim/Framework/Util.cs | 10 ++++++---- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Monitoring/WorkManager.cs b/OpenSim/Framework/Monitoring/WorkManager.cs index 9d52f71..50f6731 100644 --- a/OpenSim/Framework/Monitoring/WorkManager.cs +++ b/OpenSim/Framework/Monitoring/WorkManager.cs @@ -182,9 +182,9 @@ namespace OpenSim.Framework.Monitoring /// /// /// The name of the job. This is used in monitoring and debugging. - public static void RunInThreadPool(System.Threading.WaitCallback callback, object obj, string name) + public static void RunInThreadPool(System.Threading.WaitCallback callback, object obj, string name, bool timeout = true) { - Util.FireAndForget(callback, obj, name); + Util.FireAndForget(callback, obj, name, timeout); } /// @@ -231,10 +231,8 @@ namespace OpenSim.Framework.Monitoring JobEngine.QueueJob(name, () => callback(obj)); else if (canRunInThisThread) callback(obj); - else if (mustNotTimeout) - RunInThread(callback, obj, name, log); else - Util.FireAndForget(callback, obj, name); + Util.FireAndForget(callback, obj, name, !mustNotTimeout); } private static void HandleControlCommand(string module, string[] args) diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index f52a84c..9a1e348 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -2492,8 +2492,9 @@ namespace OpenSim.Framework public bool Running { get; set; } public bool Aborted { get; set; } private int started; + public bool DoTimeout; - public ThreadInfo(long threadFuncNum, string context) + public ThreadInfo(long threadFuncNum, string context, bool dotimeout = true) { ThreadFuncNum = threadFuncNum; this.context = context; @@ -2501,6 +2502,7 @@ namespace OpenSim.Framework Thread = null; Running = false; Aborted = false; + DoTimeout = dotimeout; } public void Started() @@ -2571,7 +2573,7 @@ namespace OpenSim.Framework foreach (KeyValuePair entry in activeThreads) { ThreadInfo t = entry.Value; - if (t.Running && !t.Aborted && (t.Elapsed() >= THREAD_TIMEOUT)) + if (t.DoTimeout && t.Running && !t.Aborted && (t.Elapsed() >= THREAD_TIMEOUT)) { m_log.WarnFormat("Timeout in threadfunc {0} ({1}) {2}", t.ThreadFuncNum, t.Thread.Name, t.GetStackTrace()); t.Abort(); @@ -2612,7 +2614,7 @@ namespace OpenSim.Framework FireAndForget(callback, obj, null); } - public static void FireAndForget(System.Threading.WaitCallback callback, object obj, string context) + public static void FireAndForget(System.Threading.WaitCallback callback, object obj, string context, bool dotimeout = true) { Interlocked.Increment(ref numTotalThreadFuncsCalled); @@ -2634,7 +2636,7 @@ namespace OpenSim.Framework bool loggingEnabled = LogThreadPool > 0; long threadFuncNum = Interlocked.Increment(ref nextThreadFuncNum); - ThreadInfo threadInfo = new ThreadInfo(threadFuncNum, context); + ThreadInfo threadInfo = new ThreadInfo(threadFuncNum, context, dotimeout); if (FireAndForgetMethod == FireAndForgetMethod.RegressionTest) { -- cgit v1.1 From 482ff06e13d6694027eec8d4146f733d69908658 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 13 Jun 2017 18:50:34 +0100 Subject: make JobEngine be a workitem of mail pool (smartThread), with the option to release thread after a idle time, so is free to do other service elsewhere --- OpenSim/Framework/Monitoring/JobEngine.cs | 89 ++++++++++++++----------------- 1 file changed, 41 insertions(+), 48 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Monitoring/JobEngine.cs b/OpenSim/Framework/Monitoring/JobEngine.cs index a6a059d..115871e 100644 --- a/OpenSim/Framework/Monitoring/JobEngine.cs +++ b/OpenSim/Framework/Monitoring/JobEngine.cs @@ -57,7 +57,8 @@ namespace OpenSim.Framework.Monitoring /// /// Will be null if no job is currently running. /// - public Job CurrentJob { get; private set; } + private Job m_currentJob; + public Job CurrentJob { get { return m_currentJob;} } /// /// Number of jobs waiting to be processed. @@ -82,16 +83,15 @@ namespace OpenSim.Framework.Monitoring private CancellationTokenSource m_cancelSource; - /// - /// Used to signal that we are ready to complete stop. - /// - private ManualResetEvent m_finishedProcessingAfterStop = new ManualResetEvent(false); + private int m_timeout = -1; + + private bool m_threadRunnig = false; - public JobEngine(string name, string loggingName) + public JobEngine(string name, string loggingName, int timeout = -1) { Name = name; LoggingName = loggingName; - + m_timeout = timeout; RequestProcessTimeoutOnStop = 5000; } @@ -104,18 +104,9 @@ namespace OpenSim.Framework.Monitoring IsRunning = true; - m_finishedProcessingAfterStop.Reset(); - m_cancelSource = new CancellationTokenSource(); - - WorkManager.StartThread( - ProcessRequests, - Name, - ThreadPriority.Normal, - false, - true, - null, - int.MaxValue); + WorkManager.RunInThreadPool(ProcessRequests, null, Name, false); + m_threadRunnig = true; } } @@ -131,20 +122,16 @@ namespace OpenSim.Framework.Monitoring m_log.DebugFormat("[JobEngine] Stopping {0}", Name); IsRunning = false; - - m_finishedProcessingAfterStop.Reset(); - if(m_jobQueue.Count <= 0) + if(m_threadRunnig) + { m_cancelSource.Cancel(); - - m_finishedProcessingAfterStop.WaitOne(RequestProcessTimeoutOnStop); - m_finishedProcessingAfterStop.Close(); + m_threadRunnig = false; + } } finally { if(m_cancelSource != null) m_cancelSource.Dispose(); - if(m_finishedProcessingAfterStop != null) - m_finishedProcessingAfterStop.Dispose(); } } } @@ -203,6 +190,18 @@ namespace OpenSim.Framework.Monitoring /// public bool QueueJob(Job job) { + lock(JobLock) + { + if(!IsRunning) + return false; + + if(!m_threadRunnig) + { + WorkManager.RunInThreadPool(ProcessRequests, null, Name, false); + m_threadRunnig = true; + } + } + if (m_jobQueue.Count < m_jobQueue.BoundedCapacity) { m_jobQueue.Add(job); @@ -222,59 +221,53 @@ namespace OpenSim.Framework.Monitoring m_warnOverMaxQueue = false; } - return false; } } - private void ProcessRequests() + private void ProcessRequests(Object o) { - while(IsRunning || m_jobQueue.Count > 0) + while(IsRunning) { try { - CurrentJob = m_jobQueue.Take(m_cancelSource.Token); - } - catch(ObjectDisposedException e) - { - // If we see this whilst not running then it may be due to a race where this thread checks - // IsRunning after the stopping thread sets it to false and disposes of the cancellation source. - if(IsRunning) - throw e; - else + if(!m_jobQueue.TryTake(out m_currentJob, m_timeout, m_cancelSource.Token)) { - m_log.DebugFormat("[JobEngine] {0} stopping ignoring {1} jobs in queue", - Name,m_jobQueue.Count); + lock(JobLock) + m_threadRunnig = false; break; } } + catch(ObjectDisposedException e) + { + m_log.DebugFormat("[JobEngine] {0} stopping ignoring {1} jobs in queue", + Name,m_jobQueue.Count); + break; + } catch(OperationCanceledException) { break; } if(LogLevel >= 1) - m_log.DebugFormat("[{0}]: Processing job {1}",LoggingName,CurrentJob.Name); + m_log.DebugFormat("[{0}]: Processing job {1}",LoggingName,m_currentJob.Name); try { - CurrentJob.Action(); + m_currentJob.Action(); } catch(Exception e) { m_log.Error( string.Format( - "[{0}]: Job {1} failed, continuing. Exception ",LoggingName,CurrentJob.Name),e); + "[{0}]: Job {1} failed, continuing. Exception ",LoggingName,m_currentJob.Name),e); } if(LogLevel >= 1) - m_log.DebugFormat("[{0}]: Processed job {1}",LoggingName,CurrentJob.Name); + m_log.DebugFormat("[{0}]: Processed job {1}",LoggingName,m_currentJob.Name); - CurrentJob = null; + m_currentJob = null; } - - Watchdog.RemoveThread(false); - m_finishedProcessingAfterStop.Set(); } public class Job -- cgit v1.1 From 5e67bd5778487c3389cf972ed4a46dc20792dabb Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 14 Jun 2017 00:51:22 +0100 Subject: main generic use JobEngine also does not need a permanent thread.. actually doesn't even seem to be in use --- OpenSim/Framework/Monitoring/WorkManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Monitoring/WorkManager.cs b/OpenSim/Framework/Monitoring/WorkManager.cs index 50f6731..5d9b185 100644 --- a/OpenSim/Framework/Monitoring/WorkManager.cs +++ b/OpenSim/Framework/Monitoring/WorkManager.cs @@ -57,7 +57,7 @@ namespace OpenSim.Framework.Monitoring static WorkManager() { - JobEngine = new JobEngine("Non-blocking non-critical job engine", "JOB ENGINE"); + JobEngine = new JobEngine("Non-blocking non-critical job engine", "JOB ENGINE", 30000); StatsManager.RegisterStat( new Stat( -- cgit v1.1 From d9a300fa8e680ec3f41f966e87408e58f3aa0e39 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 14 Jun 2017 20:19:13 +0100 Subject: some cleanup.. remove some stats that only some do look at once on a lifetime --- OpenSim/Framework/ClientInfo.cs | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/ClientInfo.cs b/OpenSim/Framework/ClientInfo.cs index 98e4465..a1ca9bc 100644 --- a/OpenSim/Framework/ClientInfo.cs +++ b/OpenSim/Framework/ClientInfo.cs @@ -36,14 +36,8 @@ namespace OpenSim.Framework public readonly DateTime StartedTime = DateTime.Now; public AgentCircuitData agentcircuit = null; - public Dictionary needAck; - - public List out_packets = new List(); - public Dictionary pendingAcks = new Dictionary(); public EndPoint proxyEP; - public uint sequence; - public byte[] usecircuit; public EndPoint userEP; public int resendThrottle; @@ -59,9 +53,5 @@ namespace OpenSim.Framework public int targetThrottle; public int maxThrottle; - - public Dictionary SyncRequests = new Dictionary(); - public Dictionary AsyncRequests = new Dictionary(); - public Dictionary GenericRequests = new Dictionary(); } } -- cgit v1.1 From 822574df9f3889c877035d302f9060769ed27e70 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 15 Jun 2017 20:28:20 +0100 Subject: change the clock source for EnvironmentTickCount so it does get a bit more resolution if avaiable (1ms) specially on windows. This until all calls to this are removed. Coment out some stats in workpool/threads creation path --- OpenSim/Framework/Util.cs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 9a1e348..a855767 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -2617,7 +2617,7 @@ namespace OpenSim.Framework public static void FireAndForget(System.Threading.WaitCallback callback, object obj, string context, bool dotimeout = true) { Interlocked.Increment(ref numTotalThreadFuncsCalled); - +/* if (context != null) { if (!m_fireAndForgetCallsMade.ContainsKey(context)) @@ -2630,7 +2630,7 @@ namespace OpenSim.Framework else m_fireAndForgetCallsInProgress[context]++; } - +*/ WaitCallback realCallback; bool loggingEnabled = LogThreadPool > 0; @@ -2647,8 +2647,8 @@ namespace OpenSim.Framework Culture.SetCurrentCulture(); callback(o); - if (context != null) - m_fireAndForgetCallsInProgress[context]--; +// if (context != null) +// m_fireAndForgetCallsInProgress[context]--; }; } else @@ -2688,8 +2688,8 @@ namespace OpenSim.Framework if ((loggingEnabled || (threadFuncOverloadMode == 1)) && threadInfo.LogThread) m_log.DebugFormat("Exit threadfunc {0} ({1})", threadFuncNum, FormatDuration(threadInfo.Elapsed())); - if (context != null) - m_fireAndForgetCallsInProgress[context]--; +// if (context != null) +// m_fireAndForgetCallsInProgress[context]--; } }; } @@ -2967,7 +2967,8 @@ namespace OpenSim.Framework /// public static Int32 EnvironmentTickCount() { - return Environment.TickCount & EnvironmentTickCountMask; + double now = GetTimeStampMS(); + return (int)now; } const Int32 EnvironmentTickCountMask = 0x3fffffff; @@ -2993,7 +2994,8 @@ namespace OpenSim.Framework /// subtraction of passed prevValue from current Environment.TickCount public static Int32 EnvironmentTickCountSubtract(Int32 prevValue) { - return EnvironmentTickCountSubtract(EnvironmentTickCount(), prevValue); + double now = GetTimeStampMS(); + return EnvironmentTickCountSubtract((int)now, prevValue); } // Returns value of Tick Count A - TickCount B accounting for wrapping of TickCount -- cgit v1.1 From 4df19ece539d6c731facd43f3eceac3c34418f05 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 16 Jun 2017 18:16:26 +0100 Subject: framework main thread pool is always active and in use ( even id hard to catch) so show in on show stats. Disable ServerStatsCollector by default, since most don't use it, Adicionally it uses shared framework performance counters system that may be affected if a region crashs --- .../Framework/Monitoring/ServerStatsCollector.cs | 8 ++- OpenSim/Framework/Servers/ServerBase.cs | 61 ++++++++++++++-------- 2 files changed, 45 insertions(+), 24 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Monitoring/ServerStatsCollector.cs b/OpenSim/Framework/Monitoring/ServerStatsCollector.cs index 3391240..a26a6e0 100644 --- a/OpenSim/Framework/Monitoring/ServerStatsCollector.cs +++ b/OpenSim/Framework/Monitoring/ServerStatsCollector.cs @@ -88,7 +88,7 @@ namespace OpenSim.Framework.Monitoring IConfig cfg = source.Configs["Monitoring"]; if (cfg != null) - Enabled = cfg.GetBoolean("ServerStatsEnabled", true); + Enabled = cfg.GetBoolean("ServerStatsEnabled", false); if (Enabled) { @@ -98,12 +98,18 @@ namespace OpenSim.Framework.Monitoring public void Start() { + if(!Enabled) + return; + if (RegisteredStats.Count == 0) RegisterServerStats(); } public void Close() { + if(!Enabled) + return; + if (RegisteredStats.Count > 0) { foreach (Stat stat in RegisteredStats.Values) diff --git a/OpenSim/Framework/Servers/ServerBase.cs b/OpenSim/Framework/Servers/ServerBase.cs index 3bb2313..3c2dce8 100644 --- a/OpenSim/Framework/Servers/ServerBase.cs +++ b/OpenSim/Framework/Servers/ServerBase.cs @@ -882,16 +882,12 @@ namespace OpenSim.Framework.Servers sb.Append("\n"); } - sb.Append("\n"); + sb.Append(GetThreadPoolReport()); - // For some reason mono 2.6.7 returns an empty threads set! Not going to confuse people by reporting - // zero active threads. + sb.Append("\n"); int totalThreads = Process.GetCurrentProcess().Threads.Count; if (totalThreads > 0) - sb.AppendFormat("Total threads active: {0}\n\n", totalThreads); - - sb.Append("Main threadpool (excluding script engine pools)\n"); - sb.Append(GetThreadPoolReport()); + sb.AppendFormat("Total process threads active: {0}\n\n", totalThreads); return sb.ToString(); } @@ -902,15 +898,46 @@ namespace OpenSim.Framework.Servers /// public static string GetThreadPoolReport() { + + StringBuilder sb = new StringBuilder(); + + // framework pool is alwasy active + int maxWorkers; + int minWorkers; + int curWorkers; + int maxComp; + int minComp; + int curComp; + + try + { + ThreadPool.GetMaxThreads(out maxWorkers, out maxComp); + ThreadPool.GetMinThreads(out minWorkers, out minComp); + ThreadPool.GetAvailableThreads(out curWorkers, out curComp); + curWorkers = maxWorkers - curWorkers; + curComp = maxComp - curComp; + + sb.Append("\nFramework main threadpool \n"); + sb.AppendFormat("workers: {0} ({1} / {2})\n", curWorkers, maxWorkers, minWorkers); + sb.AppendFormat("Completion: {0} ({1} / {2})\n", curComp, maxComp, minComp); + } + catch { } + + if ( + Util.FireAndForgetMethod == FireAndForgetMethod.QueueUserWorkItem + || Util.FireAndForgetMethod == FireAndForgetMethod.UnsafeQueueUserWorkItem) + { + sb.AppendFormat("\nThread pool used: Framework main threadpool\n"); + return sb.ToString(); + } + string threadPoolUsed = null; int maxThreads = 0; int minThreads = 0; int allocatedThreads = 0; int inUseThreads = 0; int waitingCallbacks = 0; - int completionPortThreads = 0; - StringBuilder sb = new StringBuilder(); if (Util.FireAndForgetMethod == FireAndForgetMethod.SmartThreadPool) { STPInfo stpi = Util.GetSmartThreadPoolInfo(); @@ -926,22 +953,10 @@ namespace OpenSim.Framework.Servers waitingCallbacks = stpi.WaitingCallbacks; } } - else if ( - Util.FireAndForgetMethod == FireAndForgetMethod.QueueUserWorkItem - || Util.FireAndForgetMethod == FireAndForgetMethod.UnsafeQueueUserWorkItem) - { - threadPoolUsed = "BuiltInThreadPool"; - ThreadPool.GetMaxThreads(out maxThreads, out completionPortThreads); - ThreadPool.GetMinThreads(out minThreads, out completionPortThreads); - int availableThreads; - ThreadPool.GetAvailableThreads(out availableThreads, out completionPortThreads); - inUseThreads = maxThreads - availableThreads; - allocatedThreads = -1; - waitingCallbacks = -1; - } - + if (threadPoolUsed != null) { + sb.Append("\nThreadpool (excluding script engine pools)\n"); sb.AppendFormat("Thread pool used : {0}\n", threadPoolUsed); sb.AppendFormat("Max threads : {0}\n", maxThreads); sb.AppendFormat("Min threads : {0}\n", minThreads); -- cgit v1.1 From 79e166e9aaf56b6798e27201962f6e109925c697 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 19 Jun 2017 05:22:38 +0100 Subject: revert EnvironmentTick back to orignal clock, since change may cause issues on some code paths. Clean a bit get mesh and get texture throttle --- OpenSim/Framework/Util.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index a855767..af14939 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -2967,9 +2967,9 @@ namespace OpenSim.Framework /// public static Int32 EnvironmentTickCount() { - double now = GetTimeStampMS(); - return (int)now; + return Environment.TickCount & EnvironmentTickCountMask; } + const Int32 EnvironmentTickCountMask = 0x3fffffff; /// @@ -2994,8 +2994,7 @@ namespace OpenSim.Framework /// subtraction of passed prevValue from current Environment.TickCount public static Int32 EnvironmentTickCountSubtract(Int32 prevValue) { - double now = GetTimeStampMS(); - return EnvironmentTickCountSubtract((int)now, prevValue); + return EnvironmentTickCountSubtract(EnvironmentTickCount(), prevValue); } // Returns value of Tick Count A - TickCount B accounting for wrapping of TickCount -- cgit v1.1 From b0a0163253e14514289578d31e83ce0afe9b91a3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 28 Jun 2017 01:29:49 +0100 Subject: BUG FIX: change lludp hovertext utf-8 cut point. Thx djphil --- OpenSim/Framework/Util.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index af14939..ed24452 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -2221,9 +2221,9 @@ namespace OpenSim.Framework // might have gotten an oversized array even after the string trim byte[] data = UTF8.GetBytes(str); - if (data.Length > 256) + if (data.Length > 255) //play safe { - int cut = 255; + int cut = 254; if((data[cut] & 0x80 ) != 0 ) { while(cut > 0 && (data[cut] & 0xc0) != 0xc0) @@ -2325,7 +2325,7 @@ namespace OpenSim.Framework if (data.Length > MaxLength) { - int cut = MaxLength -1 ; + int cut = MaxLength - 1 ; if((data[cut] & 0x80 ) != 0 ) { while(cut > 0 && (data[cut] & 0xc0) != 0xc0) -- cgit v1.1 From 40b16f1705bd6361d7fd0cd2bc458ae9ea381bf1 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 10 Jul 2017 22:01:38 +0100 Subject: SimpleAngularDistance update prioritization scheme ameks no sense without ordered dequeue of the updates --- OpenSim/Framework/PriorityQueue.cs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/PriorityQueue.cs b/OpenSim/Framework/PriorityQueue.cs index 5b9185e..22ffcdc 100644 --- a/OpenSim/Framework/PriorityQueue.cs +++ b/OpenSim/Framework/PriorityQueue.cs @@ -216,6 +216,27 @@ namespace OpenSim.Framework return false; } + public bool TryOrderedDequeue(out EntityUpdate value, out Int32 timeinqueue) + { + // If there is anything in imediate queues, return it first no + // matter what else. Breaks fairness. But very useful. + for (int iq = 0; iq < NumberOfQueues; iq++) + { + if (m_heaps[iq].Count > 0) + { + MinHeapItem item = m_heaps[iq].RemoveMin(); + m_lookupTable.Remove(item.Value.Entity.LocalId); + timeinqueue = Util.EnvironmentTickCountSubtract(item.EntryTime); + value = item.Value; + return true; + } + } + + timeinqueue = 0; + value = default(EntityUpdate); + return false; + } + /// /// Reapply the prioritization function to each of the updates currently /// stored in the priority queues. -- cgit v1.1 From aff9c345dddfa290222ceaf42b6c452a590a2276 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 12 Jul 2017 07:27:21 +0100 Subject: osSetParcelDetails: add more land update code --- OpenSim/Framework/ILandChannel.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/ILandChannel.cs b/OpenSim/Framework/ILandChannel.cs index 12a8228..8667837 100644 --- a/OpenSim/Framework/ILandChannel.cs +++ b/OpenSim/Framework/ILandChannel.cs @@ -88,6 +88,7 @@ namespace OpenSim.Region.Framework.Interfaces bool IsForcefulBansAllowed(); void UpdateLandObject(int localID, LandData data); + void SendParcelsOverlay(IClientAPI client); void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient); void setParcelObjectMaxOverride(overrideParcelMaxPrimCountDelegate overrideDel); void setSimulatorObjectMaxOverride(overrideSimulatorMaxPrimCountDelegate overrideDel); -- cgit v1.1 From bd249bdf5b175ee6d84588a777444f2b89d7df1e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 13 Jul 2017 04:14:33 +0100 Subject: replace the wrong libOMV user modifiable Utils.EnUSCulture by our own no User modifiable Culture.FormatProvider, and also for internal coerence. We do use the libomv on other code paths, so that must be fixed --- OpenSim/Framework/PhysicsInertia.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/PhysicsInertia.cs b/OpenSim/Framework/PhysicsInertia.cs index af70634..6e15791 100644 --- a/OpenSim/Framework/PhysicsInertia.cs +++ b/OpenSim/Framework/PhysicsInertia.cs @@ -64,25 +64,25 @@ namespace OpenSim.Framework private void XWfloat(string name, float f) { - writer.WriteElementString(name, f.ToString(Utils.EnUsCulture)); + writer.WriteElementString(name, f.ToString(Culture.FormatProvider)); } private void XWVector(string name, Vector3 vec) { writer.WriteStartElement(name); - writer.WriteElementString("X", vec.X.ToString(Utils.EnUsCulture)); - writer.WriteElementString("Y", vec.Y.ToString(Utils.EnUsCulture)); - writer.WriteElementString("Z", vec.Z.ToString(Utils.EnUsCulture)); + writer.WriteElementString("X", vec.X.ToString(Culture.FormatProvider)); + writer.WriteElementString("Y", vec.Y.ToString(Culture.FormatProvider)); + writer.WriteElementString("Z", vec.Z.ToString(Culture.FormatProvider)); writer.WriteEndElement(); } private void XWVector4(string name, Vector4 quat) { writer.WriteStartElement(name); - writer.WriteElementString("X", quat.X.ToString(Utils.EnUsCulture)); - writer.WriteElementString("Y", quat.Y.ToString(Utils.EnUsCulture)); - writer.WriteElementString("Z", quat.Z.ToString(Utils.EnUsCulture)); - writer.WriteElementString("W", quat.W.ToString(Utils.EnUsCulture)); + writer.WriteElementString("X", quat.X.ToString(Culture.FormatProvider)); + writer.WriteElementString("Y", quat.Y.ToString(Culture.FormatProvider)); + writer.WriteElementString("Z", quat.Z.ToString(Culture.FormatProvider)); + writer.WriteElementString("W", quat.W.ToString(Culture.FormatProvider)); writer.WriteEndElement(); } -- cgit v1.1 From 8b16131206818329e973faec3a9861fca37f0073 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 13 Jul 2017 20:21:18 +0100 Subject: add Util.GetTimeStamp() that returns the stamp in seconds; use it on ubOde; separed land collsions dispatch from the others... --- OpenSim/Framework/Util.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index ed24452..a42dcc6 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -156,12 +156,14 @@ namespace OpenSim.Framework public static readonly int MAX_THREADPOOL_LEVEL = 3; public static double TimeStampClockPeriodMS; + public static double TimeStampClockPeriod; static Util() { LogThreadPool = 0; LogOverloads = true; - TimeStampClockPeriodMS = 1000.0D / (double)Stopwatch.Frequency; + TimeStampClockPeriod = 1.0D/ (double)Stopwatch.Frequency; + TimeStampClockPeriodMS = 1e3 * TimeStampClockPeriod; m_log.InfoFormat("[UTIL] TimeStamp clock with period of {0}ms", Math.Round(TimeStampClockPeriodMS,6,MidpointRounding.AwayFromZero)); } @@ -3016,6 +3018,11 @@ namespace OpenSim.Framework // returns a timestamp in ms as double // using the time resolution avaiable to StopWatch + public static double GetTimeStamp() + { + return (double)Stopwatch.GetTimestamp() * TimeStampClockPeriod; + } + public static double GetTimeStampMS() { return (double)Stopwatch.GetTimestamp() * TimeStampClockPeriodMS; -- cgit v1.1 From 0bbe7bab7bb60c39b0defeff173287fc66430c26 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 26 Jul 2017 19:00:49 +0100 Subject: add new funtion bool MoveMoney(UUID fromUser, UUID toUser, int amount, MoneyTransactionType type, string text). this should be called async allowing time for money module to process it. If returns true, the transation did sucess, so if its use was to pay something, the payed item/service must be provided without fail, otherwise another method is needed so a refund is possible --- OpenSim/Framework/IMoneyModule.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IMoneyModule.cs b/OpenSim/Framework/IMoneyModule.cs index be45438..c72c742 100644 --- a/OpenSim/Framework/IMoneyModule.cs +++ b/OpenSim/Framework/IMoneyModule.cs @@ -41,6 +41,7 @@ namespace OpenSim.Framework void ApplyCharge(UUID agentID, int amount, MoneyTransactionType type, string extraData = ""); void ApplyUploadCharge(UUID agentID, int amount, string text); void MoveMoney(UUID fromUser, UUID toUser, int amount, string text); + bool MoveMoney(UUID fromUser, UUID toUser, int amount, MoneyTransactionType type, string text); int UploadCharge { get; } int GroupCreationCharge { get; } -- cgit v1.1 From 21b71ff1d857239c919ad275db5aacbf0cb6331e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 28 Jul 2017 17:36:40 +0100 Subject: partial mantis 8219; on creating or updating items (animationsets, wearables) that reference assets, and user does not have permissions on those, abort and warn, instead of silent invalition of the references to those assets, creating a broken item --- OpenSim/Framework/AnimationSet.cs | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/AnimationSet.cs b/OpenSim/Framework/AnimationSet.cs index 87c4a78..8753088 100644 --- a/OpenSim/Framework/AnimationSet.cs +++ b/OpenSim/Framework/AnimationSet.cs @@ -31,7 +31,8 @@ using OpenMetaverse; namespace OpenSim.Framework { - public delegate bool AnimationSetValidator(UUID animID); +// public delegate bool AnimationSetValidator(UUID animID); + public delegate uint AnimationSetValidator(UUID animID); public class AnimationSet { @@ -141,7 +142,7 @@ namespace OpenSim.Framework assetData += String.Format("{0} {1} {2}\n", kvp.Key, kvp.Value.Value.ToString(), kvp.Value.Key); return System.Text.Encoding.ASCII.GetBytes(assetData); } - +/* public bool Validate(AnimationSetValidator val) { if (m_parseError) @@ -164,5 +165,22 @@ namespace OpenSim.Framework return allOk; } +*/ + public uint Validate(AnimationSetValidator val) + { + if (m_parseError) + return 0; + + uint ret = 0x7fffffff; + uint t; + foreach (KeyValuePair> kvp in m_animations) + { + t = val(kvp.Value.Value); + if (t == 0) + return 0; + ret &= t; + } + return ret; + } } } -- cgit v1.1 From fc4212bc81150cb12aca1d209a089eb8febce5d5 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 29 Jul 2017 17:54:18 +0100 Subject: mantis 8222 --- OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 7f56b6f..f4ba02f 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -1827,7 +1827,7 @@ namespace OpenSim.Framework.Servers.HttpServer Hashtable headerdata = (Hashtable)responsedata["headers"]; foreach (string header in headerdata.Keys) - response.AddHeader(header, (string)headerdata[header]); + response.AddHeader(header, headerdata[header].ToString()); } byte[] buffer; -- cgit v1.1 From 3acdae74db1b7950d1c163a8e6802e24c23fa151 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 17 Aug 2017 11:36:18 -0700 Subject: Make VERSION_FLAVOUR public too, per request. I question the practice of insulating modules against OS versions this way, but hey! -- different folks, different styles. Given that all other components of the version info are public, there's no reason for keeping this one different. --- OpenSim/Framework/VersionInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/VersionInfo.cs b/OpenSim/Framework/VersionInfo.cs index 1e6efe5..8426eb0 100644 --- a/OpenSim/Framework/VersionInfo.cs +++ b/OpenSim/Framework/VersionInfo.cs @@ -32,7 +32,7 @@ namespace OpenSim public const string VersionNumber = "0.9.1.0"; public const string AssemblyVersionNumber = "0.9.1.*"; - private const Flavour VERSION_FLAVOUR = Flavour.Dev; + public const Flavour VERSION_FLAVOUR = Flavour.Dev; public enum Flavour { -- cgit v1.1 From 22c7450363b8873bdc76ad26cd22a6cd25bfd78f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 29 Aug 2017 07:38:52 +0100 Subject: fix cache.cs (used on parcels info) --- OpenSim/Framework/Cache.cs | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Cache.cs b/OpenSim/Framework/Cache.cs index 7ccc320..3ca85d7 100644 --- a/OpenSim/Framework/Cache.cs +++ b/OpenSim/Framework/Cache.cs @@ -390,17 +390,21 @@ namespace OpenSim.Framework Object data = fetch(index); - if (data == null && (m_Flags & CacheFlags.CacheMissing) == 0) - return null; - - lock (m_Index) + if (data == null) { - CacheItemBase missing = new CacheItemBase(index); - if (!m_Index.Contains(missing)) - { - m_Index.Add(missing); - m_Lookup[index] = missing; - } + if((m_Flags & CacheFlags.CacheMissing) != 0) + { + lock (m_Index) + { + CacheItemBase missing = new CacheItemBase(index); + if (!m_Index.Contains(missing)) + { + m_Index.Add(missing); + m_Lookup[index] = missing; + } + } + } + return null; } Store(index, data); -- cgit v1.1 From 05da6b9f1417b8ccef318b8d5e13be695e38f08d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 16 Sep 2017 00:19:58 +0100 Subject: bug fix. Increase the values of profileHollow and profileBegin used to match pbs number of faces and the Mesh number of faces. The small values i used before seem to be randomly lost. --- OpenSim/Framework/PrimitiveBaseShape.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs index 96d78d3..98d1bdd 100644 --- a/OpenSim/Framework/PrimitiveBaseShape.cs +++ b/OpenSim/Framework/PrimitiveBaseShape.cs @@ -348,7 +348,7 @@ namespace OpenSim.Framework case 2: // torus with hollow (a sl viewer whould see 4 faces on a hollow sphere) shape.ProfileCurve = (byte)ProfileShape.Circle | (byte)HollowShape.Triangle; shape.PathCurve = (byte)Extrusion.Curve1; - shape.ProfileHollow = 1; + shape.ProfileHollow = 27500; break; case 3: // cylinder @@ -359,7 +359,7 @@ namespace OpenSim.Framework case 4: // cylinder with hollow shape.ProfileCurve = (byte)ProfileShape.Circle | (byte)HollowShape.Triangle; shape.PathCurve = (byte)Extrusion.Straight; - shape.ProfileHollow = 1; + shape.ProfileHollow = 27500; break; case 5: // prism @@ -375,13 +375,13 @@ namespace OpenSim.Framework case 7: // box with hollow shape.ProfileCurve = (byte)ProfileShape.Square | (byte)HollowShape.Triangle; shape.PathCurve = (byte)Extrusion.Straight; - shape.ProfileHollow = 1; + shape.ProfileHollow = 27500; break; default: // 8 faces box with cut shape.ProfileCurve = (byte)ProfileShape.Square | (byte)HollowShape.Triangle; shape.PathCurve = (byte)Extrusion.Straight; - shape.ProfileBegin = 1; + shape.ProfileBegin = 12500; break; } -- cgit v1.1 From 997a85568e5eed736fe273c7cdeb5736c8ce420f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 16 Sep 2017 00:46:26 +0100 Subject: double request.ReadWriteTimeout --- OpenSim/Framework/WebUtil.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 48078ad..20d30b5 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -200,7 +200,7 @@ namespace OpenSim.Framework request.Timeout = timeout; request.KeepAlive = false; request.MaximumAutomaticRedirections = 10; - request.ReadWriteTimeout = timeout / 4; + request.ReadWriteTimeout = timeout / 2; request.Headers[OSHeaderRequestID] = reqnum.ToString(); // If there is some input, write it into the request @@ -396,7 +396,7 @@ namespace OpenSim.Framework request.Timeout = timeout; request.KeepAlive = false; request.MaximumAutomaticRedirections = 10; - request.ReadWriteTimeout = timeout / 4; + request.ReadWriteTimeout = timeout / 2; request.Headers[OSHeaderRequestID] = reqnum.ToString(); if (data != null) -- cgit v1.1 From 2247251c2f0cf554c51499b88198dc59cc8e351d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 16 Sep 2017 18:58:10 +0100 Subject: bug fix: Of course i had to pick a wrong number for profileBegin --- OpenSim/Framework/PrimitiveBaseShape.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs index 98d1bdd..6607d9f 100644 --- a/OpenSim/Framework/PrimitiveBaseShape.cs +++ b/OpenSim/Framework/PrimitiveBaseShape.cs @@ -381,7 +381,7 @@ namespace OpenSim.Framework default: // 8 faces box with cut shape.ProfileCurve = (byte)ProfileShape.Square | (byte)HollowShape.Triangle; shape.PathCurve = (byte)Extrusion.Straight; - shape.ProfileBegin = 12500; + shape.ProfileBegin = 9375; break; } -- cgit v1.1 From 3fb61f4470593d9dbd4e1cc6b421f868816e588e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 30 Oct 2017 18:26:15 +0000 Subject: mantis 8258: change Mesh basic shape pathScaleY in case of Torus --- OpenSim/Framework/PrimitiveBaseShape.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs index 6607d9f..5056c04 100644 --- a/OpenSim/Framework/PrimitiveBaseShape.cs +++ b/OpenSim/Framework/PrimitiveBaseShape.cs @@ -343,12 +343,14 @@ namespace OpenSim.Framework case 1: // torus shape.ProfileCurve = (byte)ProfileShape.Circle | (byte)HollowShape.Triangle; shape.PathCurve = (byte)Extrusion.Curve1; + shape._pathScaleY = 150; break; case 2: // torus with hollow (a sl viewer whould see 4 faces on a hollow sphere) shape.ProfileCurve = (byte)ProfileShape.Circle | (byte)HollowShape.Triangle; shape.PathCurve = (byte)Extrusion.Curve1; shape.ProfileHollow = 27500; + shape._pathScaleY = 150; break; case 3: // cylinder -- cgit v1.1 From 2f13b68d4f4fd634eaee005bdf4c4a8e21c21c9a Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 16 Nov 2017 17:50:06 +0000 Subject: add missing part of mutes list protocol --- OpenSim/Framework/IClientAPI.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 5ca8c88..a9044d5 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -1485,7 +1485,7 @@ namespace OpenSim.Framework void SendUserInfoReply(bool imViaEmail, bool visible, string email); void SendUseCachedMuteList(); - + void SendEmpytMuteList(); void SendMuteListUpdate(string filename); void SendGroupActiveProposals(UUID groupID, UUID transactionID, GroupActiveProposals[] Proposals); -- cgit v1.1 From 1e3cb827562f580aea60deab640f98078107e8a3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 17 Nov 2017 01:30:39 +0000 Subject: move some sharable items out of Xmute to Framework; add another test mutelistmodule, ignore it --- OpenSim/Framework/Crc32.cs | 139 ++++++++++++++++++++++++++++++++++++++++++ OpenSim/Framework/MuteData.cs | 41 +++++++++++++ 2 files changed, 180 insertions(+) create mode 100644 OpenSim/Framework/Crc32.cs create mode 100644 OpenSim/Framework/MuteData.cs (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Crc32.cs b/OpenSim/Framework/Crc32.cs new file mode 100644 index 0000000..7ad1566 --- /dev/null +++ b/OpenSim/Framework/Crc32.cs @@ -0,0 +1,139 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Security.Cryptography; + +namespace OpenSim.Framework +{ + // this is more generic than openmetaverse CRC32 + + public class Crc32 : HashAlgorithm + { + public const UInt32 DefaultPolynomial = 0xedb88320; + public const UInt32 DefaultSeed = 0xffffffff; + + private UInt32 hash; + private UInt32 seed; + private UInt32[] table; + private static UInt32[] defaultTable; + + public Crc32() + { + table = InitializeTable(DefaultPolynomial); + seed = DefaultSeed; + Initialize(); + } + + public Crc32(UInt32 polynomial, UInt32 seed) + { + table = InitializeTable(polynomial); + this.seed = seed; + Initialize(); + } + + public override void Initialize() + { + hash = seed; + } + + protected override void HashCore(byte[] buffer, int start, int length) + { + hash = CalculateHash(table, hash, buffer, start, length); + } + + protected override byte[] HashFinal() + { + byte[] hashBuffer = UInt32ToBigEndianBytes(~hash); + this.HashValue = hashBuffer; + return hashBuffer; + } + + public override int HashSize + { + get { return 32; } + } + + public static UInt32 Compute(byte[] buffer) + { + return ~CalculateHash(InitializeTable(DefaultPolynomial), DefaultSeed, buffer, 0, buffer.Length); + } + + public static UInt32 Compute(UInt32 seed, byte[] buffer) + { + return ~CalculateHash(InitializeTable(DefaultPolynomial), seed, buffer, 0, buffer.Length); + } + + public static UInt32 Compute(UInt32 polynomial, UInt32 seed, byte[] buffer) + { + return ~CalculateHash(InitializeTable(polynomial), seed, buffer, 0, buffer.Length); + } + + private static UInt32[] InitializeTable(UInt32 polynomial) + { + if (polynomial == DefaultPolynomial && defaultTable != null) + return defaultTable; + + UInt32[] createTable = new UInt32[256]; + for (int i = 0; i < 256; i++) + { + UInt32 entry = (UInt32)i; + for (int j = 0; j < 8; j++) + if ((entry & 1) == 1) + entry = (entry >> 1) ^ polynomial; + else + entry = entry >> 1; + createTable[i] = entry; + } + + if (polynomial == DefaultPolynomial) + defaultTable = createTable; + + return createTable; + } + + private static UInt32 CalculateHash(UInt32[] table, UInt32 seed, byte[] buffer, int start, int size) + { + UInt32 crc = seed; + for (int i = start; i < size; i++) + unchecked + { + crc = (crc >> 8) ^ table[buffer[i] ^ crc & 0xff]; + } + return crc; + } + + private byte[] UInt32ToBigEndianBytes(UInt32 x) + { + return new byte[] { + (byte)((x >> 24) & 0xff), + (byte)((x >> 16) & 0xff), + (byte)((x >> 8) & 0xff), + (byte)(x & 0xff) }; + } + } +} diff --git a/OpenSim/Framework/MuteData.cs b/OpenSim/Framework/MuteData.cs new file mode 100644 index 0000000..7c946d6 --- /dev/null +++ b/OpenSim/Framework/MuteData.cs @@ -0,0 +1,41 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using OpenMetaverse; + +namespace OpenSim.Framework +{ + public class MuteData + { + public UUID AgentID; + public UUID MuteID; + public string MuteName; + public int MuteType; + public int MuteFlags; + public int Stamp; + } +} -- cgit v1.1 From 803289877307ce0016627f58af382b68a1905327 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 30 Dec 2017 15:28:26 +0000 Subject: mantis 8271: work around missing encoding of estate bans on the pseudo url encode used on POST, without changing the xml also used elsewhere. Possible this can be used in other case --- OpenSim/Framework/EstateSettings.cs | 43 ++++++++++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 8 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/EstateSettings.cs b/OpenSim/Framework/EstateSettings.cs index 7134cbf..8c8270a 100644 --- a/OpenSim/Framework/EstateSettings.cs +++ b/OpenSim/Framework/EstateSettings.cs @@ -572,14 +572,41 @@ namespace OpenSim.Framework // EstateBans are special if (map.ContainsKey("EstateBans")) - { - var banData = ((Dictionary)map["EstateBans"]).Values; - EstateBan[] bans = new EstateBan[banData.Count]; - int b = 0; - foreach (Dictionary ban in banData) - bans[b++] = new EstateBan(ban); - PropertyInfo bansProperty = this.GetType().GetProperty("EstateBans", BindingFlags.Public | BindingFlags.Instance); - bansProperty.SetValue(this, bans, null); + { + if(map["EstateBans"] is string) + { + // JSON encoded bans map + Dictionary bdata = new Dictionary(); + try + { + // bypass libovm, we dont need even more useless high level maps + // this should only be called once.. but no problem, i hope + // (other uses may need more..) + LitJson.JsonMapper.RegisterImporter((input) => new UUID(input)); + bdata = LitJson.JsonMapper.ToObject>((string)map["EstateBans"]); + } + // catch(Exception e) + catch + { + return; + } + EstateBan[] jbans = new EstateBan[bdata.Count]; + bdata.Values.CopyTo(jbans,0); + + PropertyInfo jbansProperty = this.GetType().GetProperty("EstateBans", BindingFlags.Public | BindingFlags.Instance); + jbansProperty.SetValue(this, jbans, null); + } + else + { + var banData = ((Dictionary)map["EstateBans"]).Values; + EstateBan[] bans = new EstateBan[banData.Count]; + + int b = 0; + foreach (Dictionary ban in banData) + bans[b++] = new EstateBan(ban); + PropertyInfo bansProperty = this.GetType().GetProperty("EstateBans", BindingFlags.Public | BindingFlags.Instance); + bansProperty.SetValue(this, bans, null); + } } } } -- cgit v1.1 From ec6f87d3eff699ca28214629d360c15e5df13156 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 4 Jan 2018 23:51:43 +0000 Subject: disable some XmlResolver --- OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs | 1 + OpenSim/Framework/Util.cs | 1 + 2 files changed, 2 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs b/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs index 1523fa9..d2ca049 100644 --- a/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs +++ b/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs @@ -156,6 +156,7 @@ namespace OpenSim.Framework.Serialization.External return xml; XmlDocument doc = new XmlDocument(); + doc.XmlResolver=null; doc.LoadXml(xml); XmlNodeList sops = doc.GetElementsByTagName("SceneObjectPart"); diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index a42dcc6..7093010 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -671,6 +671,7 @@ namespace OpenSim.Framework public static string GetFormattedXml(string rawXml) { XmlDocument xd = new XmlDocument(); + xd.XmlResolver=null; xd.LoadXml(rawXml); StringBuilder sb = new StringBuilder(); -- cgit v1.1 From 89a690c11f8c7b6bbe0b6339e79a64d1ae428aec Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 5 Jan 2018 12:24:07 +0000 Subject: a few more xml things --- OpenSim/Framework/PhysicsInertia.cs | 18 ++++++++++-------- OpenSim/Framework/PrimitiveBaseShape.cs | 3 +++ .../External/ExternalRepresentationUtils.cs | 2 +- .../Serialization/External/LandDataSerializer.cs | 2 ++ .../Serialization/External/RegionSettingsSerializer.cs | 2 ++ .../External/UserInventoryItemSerializer.cs | 3 +++ .../Servers/HttpServer/RestDeserialiseHandler.cs | 3 +++ .../Framework/Servers/HttpServer/RestSessionService.cs | 4 ++++ 8 files changed, 28 insertions(+), 9 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/PhysicsInertia.cs b/OpenSim/Framework/PhysicsInertia.cs index 6e15791..8a0e43e 100644 --- a/OpenSim/Framework/PhysicsInertia.cs +++ b/OpenSim/Framework/PhysicsInertia.cs @@ -187,16 +187,18 @@ namespace OpenSim.Framework if (text == String.Empty) return null; - UTF8Encoding enc = new UTF8Encoding(); - MemoryStream ms = new MemoryStream(enc.GetBytes(text)); - XmlTextReader xreader = new XmlTextReader(ms); - - PhysicsInertiaData v = new PhysicsInertiaData(); bool error; + PhysicsInertiaData v; + UTF8Encoding enc = new UTF8Encoding(); + using(MemoryStream ms = new MemoryStream(enc.GetBytes(text))) + using(XmlTextReader xreader = new XmlTextReader(ms)) + { + xreader.DtdProcessing = DtdProcessing.Prohibit; + xreader.XmlResolver = null; - v.FromXml2(xreader, out error); - - xreader.Close(); + v = new PhysicsInertiaData(); + v.FromXml2(xreader, out error); + } if (error) return null; diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs index 5056c04..1dc8bc3 100644 --- a/OpenSim/Framework/PrimitiveBaseShape.cs +++ b/OpenSim/Framework/PrimitiveBaseShape.cs @@ -1595,6 +1595,9 @@ namespace OpenSim.Framework { using (XmlTextReader xtr = new XmlTextReader(sr)) { + xtr.DtdProcessing = DtdProcessing.Prohibit; + xtr.XmlResolver = null; + xtr.MoveToContent(); string type = xtr.GetAttribute("type"); diff --git a/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs b/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs index d2ca049..da877a7 100644 --- a/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs +++ b/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs @@ -221,7 +221,7 @@ namespace OpenSim.Framework.Serialization.External using (StringWriter sw = new StringWriter()) using (XmlTextWriter writer = new XmlTextWriter(sw)) using (XmlTextReader wrappedReader = new XmlTextReader(xmlData, XmlNodeType.Element, null)) - using (XmlReader reader = XmlReader.Create(wrappedReader, new XmlReaderSettings() { IgnoreWhitespace = true, ConformanceLevel = ConformanceLevel.Fragment })) + using (XmlReader reader = XmlReader.Create(wrappedReader, new XmlReaderSettings() { IgnoreWhitespace = true, ConformanceLevel = ConformanceLevel.Fragment, DtdProcessing = DtdProcessing.Prohibit, XmlResolver = null })) { TransformXml(reader, writer, sceneName, homeURL, userService, scopeID); diff --git a/OpenSim/Framework/Serialization/External/LandDataSerializer.cs b/OpenSim/Framework/Serialization/External/LandDataSerializer.cs index e42d56f..d323f45 100644 --- a/OpenSim/Framework/Serialization/External/LandDataSerializer.cs +++ b/OpenSim/Framework/Serialization/External/LandDataSerializer.cs @@ -178,6 +178,8 @@ namespace OpenSim.Framework.Serialization.External using (XmlTextReader reader = new XmlTextReader(new StringReader(serializedLandData))) { + reader.DtdProcessing = DtdProcessing.Prohibit; + reader.XmlResolver = null; reader.ReadStartElement("LandData"); ExternalRepresentationUtils.ExecuteReadProcessors(landData, m_ldProcessors, reader); diff --git a/OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs b/OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs index 617c451..fb4f904 100644 --- a/OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs +++ b/OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs @@ -63,6 +63,8 @@ namespace OpenSim.Framework.Serialization.External StringReader sr = new StringReader(serializedSettings); XmlTextReader xtr = new XmlTextReader(sr); + xtr.DtdProcessing = DtdProcessing.Prohibit; + xtr.XmlResolver = null; xtr.ReadStartElement("RegionSettings"); diff --git a/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs b/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs index 9b02553..3c51140 100644 --- a/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs +++ b/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs @@ -202,6 +202,9 @@ namespace OpenSim.Framework.Serialization.External using (XmlTextReader reader = new XmlTextReader(new StringReader(serialization))) { + reader.DtdProcessing = DtdProcessing.Prohibit; + reader.XmlResolver = null; + reader.ReadStartElement("InventoryItem"); ExternalRepresentationUtils.ExecuteReadProcessors( diff --git a/OpenSim/Framework/Servers/HttpServer/RestDeserialiseHandler.cs b/OpenSim/Framework/Servers/HttpServer/RestDeserialiseHandler.cs index bd55657..fbc51d5 100644 --- a/OpenSim/Framework/Servers/HttpServer/RestDeserialiseHandler.cs +++ b/OpenSim/Framework/Servers/HttpServer/RestDeserialiseHandler.cs @@ -54,6 +54,9 @@ namespace OpenSim.Framework.Servers.HttpServer TRequest deserial; using (XmlTextReader xmlReader = new XmlTextReader(request)) { + xmlReader.DtdProcessing = DtdProcessing.Prohibit; + xmlReader.XmlResolver = null; + XmlSerializer deserializer = new XmlSerializer(typeof (TRequest)); deserial = (TRequest) deserializer.Deserialize(xmlReader); } diff --git a/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs b/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs index 68073c1..dc720dd 100644 --- a/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs +++ b/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs @@ -210,6 +210,8 @@ namespace OpenSim.Framework.Servers.HttpServer { try { + xmlReader.DtdProcessing = DtdProcessing.Prohibit; + xmlReader.XmlResolver = null; XmlSerializer deserializer = new XmlSerializer(typeof(RestSessionObject)); deserial = (RestSessionObject)deserializer.Deserialize(xmlReader); } @@ -269,6 +271,8 @@ namespace OpenSim.Framework.Servers.HttpServer { try { + xmlReader.DtdProcessing = DtdProcessing.Prohibit; + xmlReader.XmlResolver = null; XmlSerializer deserializer = new XmlSerializer(typeof(TRequest)); deserial = (TRequest)deserializer.Deserialize(xmlReader); } -- cgit v1.1 From eec3921800e3a19f210c0488d78399c210f9b9d6 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 8 Jan 2018 12:00:21 +0000 Subject: fall back to a obsolete property since several monos in use (include our own) do not suporte the proper .net4.0 one --- OpenSim/Framework/PhysicsInertia.cs | 2 +- OpenSim/Framework/PrimitiveBaseShape.cs | 2 +- .../Framework/Serialization/External/ExternalRepresentationUtils.cs | 2 +- OpenSim/Framework/Serialization/External/LandDataSerializer.cs | 2 +- OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs | 2 +- .../Framework/Serialization/External/UserInventoryItemSerializer.cs | 2 +- OpenSim/Framework/Servers/HttpServer/RestDeserialiseHandler.cs | 2 +- OpenSim/Framework/Servers/HttpServer/RestSessionService.cs | 4 ++-- 8 files changed, 9 insertions(+), 9 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/PhysicsInertia.cs b/OpenSim/Framework/PhysicsInertia.cs index 8a0e43e..3a55f8a 100644 --- a/OpenSim/Framework/PhysicsInertia.cs +++ b/OpenSim/Framework/PhysicsInertia.cs @@ -193,7 +193,7 @@ namespace OpenSim.Framework using(MemoryStream ms = new MemoryStream(enc.GetBytes(text))) using(XmlTextReader xreader = new XmlTextReader(ms)) { - xreader.DtdProcessing = DtdProcessing.Prohibit; + xreader.ProhibitDtd = true; xreader.XmlResolver = null; v = new PhysicsInertiaData(); diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs index 1dc8bc3..d071b8c 100644 --- a/OpenSim/Framework/PrimitiveBaseShape.cs +++ b/OpenSim/Framework/PrimitiveBaseShape.cs @@ -1595,7 +1595,7 @@ namespace OpenSim.Framework { using (XmlTextReader xtr = new XmlTextReader(sr)) { - xtr.DtdProcessing = DtdProcessing.Prohibit; + xtr.ProhibitDtd = true; xtr.XmlResolver = null; xtr.MoveToContent(); diff --git a/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs b/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs index da877a7..2d4bdbc 100644 --- a/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs +++ b/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs @@ -221,7 +221,7 @@ namespace OpenSim.Framework.Serialization.External using (StringWriter sw = new StringWriter()) using (XmlTextWriter writer = new XmlTextWriter(sw)) using (XmlTextReader wrappedReader = new XmlTextReader(xmlData, XmlNodeType.Element, null)) - using (XmlReader reader = XmlReader.Create(wrappedReader, new XmlReaderSettings() { IgnoreWhitespace = true, ConformanceLevel = ConformanceLevel.Fragment, DtdProcessing = DtdProcessing.Prohibit, XmlResolver = null })) + using (XmlReader reader = XmlReader.Create(wrappedReader, new XmlReaderSettings() { IgnoreWhitespace = true, ConformanceLevel = ConformanceLevel.Fragment, ProhibitDtd = true, XmlResolver = null })) { TransformXml(reader, writer, sceneName, homeURL, userService, scopeID); diff --git a/OpenSim/Framework/Serialization/External/LandDataSerializer.cs b/OpenSim/Framework/Serialization/External/LandDataSerializer.cs index d323f45..7e17bc0 100644 --- a/OpenSim/Framework/Serialization/External/LandDataSerializer.cs +++ b/OpenSim/Framework/Serialization/External/LandDataSerializer.cs @@ -178,7 +178,7 @@ namespace OpenSim.Framework.Serialization.External using (XmlTextReader reader = new XmlTextReader(new StringReader(serializedLandData))) { - reader.DtdProcessing = DtdProcessing.Prohibit; + reader.ProhibitDtd = true; reader.XmlResolver = null; reader.ReadStartElement("LandData"); diff --git a/OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs b/OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs index fb4f904..6ff5687 100644 --- a/OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs +++ b/OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs @@ -63,7 +63,7 @@ namespace OpenSim.Framework.Serialization.External StringReader sr = new StringReader(serializedSettings); XmlTextReader xtr = new XmlTextReader(sr); - xtr.DtdProcessing = DtdProcessing.Prohibit; + xtr.ProhibitDtd = true; xtr.XmlResolver = null; xtr.ReadStartElement("RegionSettings"); diff --git a/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs b/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs index 3c51140..f13bb2c 100644 --- a/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs +++ b/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs @@ -202,7 +202,7 @@ namespace OpenSim.Framework.Serialization.External using (XmlTextReader reader = new XmlTextReader(new StringReader(serialization))) { - reader.DtdProcessing = DtdProcessing.Prohibit; + reader.ProhibitDtd = true; reader.XmlResolver = null; reader.ReadStartElement("InventoryItem"); diff --git a/OpenSim/Framework/Servers/HttpServer/RestDeserialiseHandler.cs b/OpenSim/Framework/Servers/HttpServer/RestDeserialiseHandler.cs index fbc51d5..7e2d909 100644 --- a/OpenSim/Framework/Servers/HttpServer/RestDeserialiseHandler.cs +++ b/OpenSim/Framework/Servers/HttpServer/RestDeserialiseHandler.cs @@ -54,7 +54,7 @@ namespace OpenSim.Framework.Servers.HttpServer TRequest deserial; using (XmlTextReader xmlReader = new XmlTextReader(request)) { - xmlReader.DtdProcessing = DtdProcessing.Prohibit; + xmlReader.ProhibitDtd = true; xmlReader.XmlResolver = null; XmlSerializer deserializer = new XmlSerializer(typeof (TRequest)); diff --git a/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs b/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs index dc720dd..1887a13 100644 --- a/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs +++ b/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs @@ -210,7 +210,7 @@ namespace OpenSim.Framework.Servers.HttpServer { try { - xmlReader.DtdProcessing = DtdProcessing.Prohibit; + xmlReader.ProhibitDtd = true; xmlReader.XmlResolver = null; XmlSerializer deserializer = new XmlSerializer(typeof(RestSessionObject)); deserial = (RestSessionObject)deserializer.Deserialize(xmlReader); @@ -271,7 +271,7 @@ namespace OpenSim.Framework.Servers.HttpServer { try { - xmlReader.DtdProcessing = DtdProcessing.Prohibit; + xmlReader.ProhibitDtd = true; xmlReader.XmlResolver = null; XmlSerializer deserializer = new XmlSerializer(typeof(TRequest)); deserial = (TRequest)deserializer.Deserialize(xmlReader); -- cgit v1.1 From e908c0ecadb9d44102ee649c5f9184e6e3034541 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 9 Jan 2018 19:47:10 +0000 Subject: give up on a property that old monos do compile, but then smore ok exec --- OpenSim/Framework/PhysicsInertia.cs | 1 - OpenSim/Framework/PrimitiveBaseShape.cs | 1 - .../Framework/Serialization/External/ExternalRepresentationUtils.cs | 2 +- OpenSim/Framework/Serialization/External/LandDataSerializer.cs | 1 - OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs | 1 - .../Framework/Serialization/External/UserInventoryItemSerializer.cs | 1 - OpenSim/Framework/Servers/HttpServer/RestDeserialiseHandler.cs | 1 - OpenSim/Framework/Servers/HttpServer/RestSessionService.cs | 4 ++-- 8 files changed, 3 insertions(+), 9 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/PhysicsInertia.cs b/OpenSim/Framework/PhysicsInertia.cs index 3a55f8a..fa83de8 100644 --- a/OpenSim/Framework/PhysicsInertia.cs +++ b/OpenSim/Framework/PhysicsInertia.cs @@ -194,7 +194,6 @@ namespace OpenSim.Framework using(XmlTextReader xreader = new XmlTextReader(ms)) { xreader.ProhibitDtd = true; - xreader.XmlResolver = null; v = new PhysicsInertiaData(); v.FromXml2(xreader, out error); diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs index d071b8c..6e7a038 100644 --- a/OpenSim/Framework/PrimitiveBaseShape.cs +++ b/OpenSim/Framework/PrimitiveBaseShape.cs @@ -1596,7 +1596,6 @@ namespace OpenSim.Framework using (XmlTextReader xtr = new XmlTextReader(sr)) { xtr.ProhibitDtd = true; - xtr.XmlResolver = null; xtr.MoveToContent(); diff --git a/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs b/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs index 2d4bdbc..af130a5 100644 --- a/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs +++ b/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs @@ -221,7 +221,7 @@ namespace OpenSim.Framework.Serialization.External using (StringWriter sw = new StringWriter()) using (XmlTextWriter writer = new XmlTextWriter(sw)) using (XmlTextReader wrappedReader = new XmlTextReader(xmlData, XmlNodeType.Element, null)) - using (XmlReader reader = XmlReader.Create(wrappedReader, new XmlReaderSettings() { IgnoreWhitespace = true, ConformanceLevel = ConformanceLevel.Fragment, ProhibitDtd = true, XmlResolver = null })) + using (XmlReader reader = XmlReader.Create(wrappedReader, new XmlReaderSettings() { IgnoreWhitespace = true, ConformanceLevel = ConformanceLevel.Fragment, ProhibitDtd = true})) { TransformXml(reader, writer, sceneName, homeURL, userService, scopeID); diff --git a/OpenSim/Framework/Serialization/External/LandDataSerializer.cs b/OpenSim/Framework/Serialization/External/LandDataSerializer.cs index 7e17bc0..33ffd83 100644 --- a/OpenSim/Framework/Serialization/External/LandDataSerializer.cs +++ b/OpenSim/Framework/Serialization/External/LandDataSerializer.cs @@ -179,7 +179,6 @@ namespace OpenSim.Framework.Serialization.External using (XmlTextReader reader = new XmlTextReader(new StringReader(serializedLandData))) { reader.ProhibitDtd = true; - reader.XmlResolver = null; reader.ReadStartElement("LandData"); ExternalRepresentationUtils.ExecuteReadProcessors(landData, m_ldProcessors, reader); diff --git a/OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs b/OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs index 6ff5687..fd21f3e 100644 --- a/OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs +++ b/OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs @@ -64,7 +64,6 @@ namespace OpenSim.Framework.Serialization.External StringReader sr = new StringReader(serializedSettings); XmlTextReader xtr = new XmlTextReader(sr); xtr.ProhibitDtd = true; - xtr.XmlResolver = null; xtr.ReadStartElement("RegionSettings"); diff --git a/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs b/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs index f13bb2c..12194ad 100644 --- a/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs +++ b/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs @@ -203,7 +203,6 @@ namespace OpenSim.Framework.Serialization.External using (XmlTextReader reader = new XmlTextReader(new StringReader(serialization))) { reader.ProhibitDtd = true; - reader.XmlResolver = null; reader.ReadStartElement("InventoryItem"); diff --git a/OpenSim/Framework/Servers/HttpServer/RestDeserialiseHandler.cs b/OpenSim/Framework/Servers/HttpServer/RestDeserialiseHandler.cs index 7e2d909..67fc14e 100644 --- a/OpenSim/Framework/Servers/HttpServer/RestDeserialiseHandler.cs +++ b/OpenSim/Framework/Servers/HttpServer/RestDeserialiseHandler.cs @@ -55,7 +55,6 @@ namespace OpenSim.Framework.Servers.HttpServer using (XmlTextReader xmlReader = new XmlTextReader(request)) { xmlReader.ProhibitDtd = true; - xmlReader.XmlResolver = null; XmlSerializer deserializer = new XmlSerializer(typeof (TRequest)); deserial = (TRequest) deserializer.Deserialize(xmlReader); diff --git a/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs b/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs index 1887a13..158befa 100644 --- a/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs +++ b/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs @@ -211,7 +211,7 @@ namespace OpenSim.Framework.Servers.HttpServer try { xmlReader.ProhibitDtd = true; - xmlReader.XmlResolver = null; + XmlSerializer deserializer = new XmlSerializer(typeof(RestSessionObject)); deserial = (RestSessionObject)deserializer.Deserialize(xmlReader); } @@ -272,7 +272,7 @@ namespace OpenSim.Framework.Servers.HttpServer try { xmlReader.ProhibitDtd = true; - xmlReader.XmlResolver = null; + XmlSerializer deserializer = new XmlSerializer(typeof(TRequest)); deserial = (TRequest)deserializer.Deserialize(xmlReader); } -- cgit v1.1 From 1d6a157134ac05b3e040474ea3e05016431a6388 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 13 Jan 2018 22:40:44 +0000 Subject: change version to 0.9.1.1 so we can see it inworld --- OpenSim/Framework/VersionInfo.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/VersionInfo.cs b/OpenSim/Framework/VersionInfo.cs index 8426eb0..6aac3d4 100644 --- a/OpenSim/Framework/VersionInfo.cs +++ b/OpenSim/Framework/VersionInfo.cs @@ -29,8 +29,8 @@ namespace OpenSim { public class VersionInfo { - public const string VersionNumber = "0.9.1.0"; - public const string AssemblyVersionNumber = "0.9.1.*"; + public const string VersionNumber = "0.9.1.1"; + public const string AssemblyVersionNumber = "0.9.1.1"; public const Flavour VERSION_FLAVOUR = Flavour.Dev; -- cgit v1.1 From c92ba1cc04c36d46b3569c06d8339cf897af65cc Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 15 Jan 2018 16:23:19 +0000 Subject: shut up some pesty warnings --- OpenSim/Framework/Monitoring/JobEngine.cs | 2 +- OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Monitoring/JobEngine.cs b/OpenSim/Framework/Monitoring/JobEngine.cs index 115871e..4a831e8 100644 --- a/OpenSim/Framework/Monitoring/JobEngine.cs +++ b/OpenSim/Framework/Monitoring/JobEngine.cs @@ -238,7 +238,7 @@ namespace OpenSim.Framework.Monitoring break; } } - catch(ObjectDisposedException e) + catch(ObjectDisposedException) { m_log.DebugFormat("[JobEngine] {0} stopping ignoring {1} jobs in queue", Name,m_jobQueue.Count); diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs index eb8ca0d..8ab5808 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs @@ -130,7 +130,8 @@ namespace OpenSim.Framework.Servers.HttpServer response.OutputStream.Flush(); response.Send(); } - catch (Exception e) +// catch (Exception e) + catch { } } -- cgit v1.1 From 029d6e40f675387e42ca575ba467dea95cddb3dc Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 17 Jan 2018 04:18:43 +0000 Subject: remove those xml things no longer needed on .net >4.5.2 --- OpenSim/Framework/PhysicsInertia.cs | 2 -- OpenSim/Framework/PrimitiveBaseShape.cs | 2 -- .../Framework/Serialization/External/ExternalRepresentationUtils.cs | 2 +- OpenSim/Framework/Serialization/External/LandDataSerializer.cs | 1 - OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs | 1 - .../Framework/Serialization/External/UserInventoryItemSerializer.cs | 2 -- OpenSim/Framework/Servers/HttpServer/RestDeserialiseHandler.cs | 2 -- OpenSim/Framework/Servers/HttpServer/RestSessionService.cs | 4 ---- 8 files changed, 1 insertion(+), 15 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/PhysicsInertia.cs b/OpenSim/Framework/PhysicsInertia.cs index fa83de8..5aae6d5 100644 --- a/OpenSim/Framework/PhysicsInertia.cs +++ b/OpenSim/Framework/PhysicsInertia.cs @@ -193,8 +193,6 @@ namespace OpenSim.Framework using(MemoryStream ms = new MemoryStream(enc.GetBytes(text))) using(XmlTextReader xreader = new XmlTextReader(ms)) { - xreader.ProhibitDtd = true; - v = new PhysicsInertiaData(); v.FromXml2(xreader, out error); } diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs index 6e7a038..5056c04 100644 --- a/OpenSim/Framework/PrimitiveBaseShape.cs +++ b/OpenSim/Framework/PrimitiveBaseShape.cs @@ -1595,8 +1595,6 @@ namespace OpenSim.Framework { using (XmlTextReader xtr = new XmlTextReader(sr)) { - xtr.ProhibitDtd = true; - xtr.MoveToContent(); string type = xtr.GetAttribute("type"); diff --git a/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs b/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs index af130a5..64b5d41 100644 --- a/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs +++ b/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs @@ -221,7 +221,7 @@ namespace OpenSim.Framework.Serialization.External using (StringWriter sw = new StringWriter()) using (XmlTextWriter writer = new XmlTextWriter(sw)) using (XmlTextReader wrappedReader = new XmlTextReader(xmlData, XmlNodeType.Element, null)) - using (XmlReader reader = XmlReader.Create(wrappedReader, new XmlReaderSettings() { IgnoreWhitespace = true, ConformanceLevel = ConformanceLevel.Fragment, ProhibitDtd = true})) + using (XmlReader reader = XmlReader.Create(wrappedReader, new XmlReaderSettings() { IgnoreWhitespace = true, ConformanceLevel = ConformanceLevel.Fragment})) { TransformXml(reader, writer, sceneName, homeURL, userService, scopeID); diff --git a/OpenSim/Framework/Serialization/External/LandDataSerializer.cs b/OpenSim/Framework/Serialization/External/LandDataSerializer.cs index 33ffd83..e42d56f 100644 --- a/OpenSim/Framework/Serialization/External/LandDataSerializer.cs +++ b/OpenSim/Framework/Serialization/External/LandDataSerializer.cs @@ -178,7 +178,6 @@ namespace OpenSim.Framework.Serialization.External using (XmlTextReader reader = new XmlTextReader(new StringReader(serializedLandData))) { - reader.ProhibitDtd = true; reader.ReadStartElement("LandData"); ExternalRepresentationUtils.ExecuteReadProcessors(landData, m_ldProcessors, reader); diff --git a/OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs b/OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs index fd21f3e..617c451 100644 --- a/OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs +++ b/OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs @@ -63,7 +63,6 @@ namespace OpenSim.Framework.Serialization.External StringReader sr = new StringReader(serializedSettings); XmlTextReader xtr = new XmlTextReader(sr); - xtr.ProhibitDtd = true; xtr.ReadStartElement("RegionSettings"); diff --git a/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs b/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs index 12194ad..9b02553 100644 --- a/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs +++ b/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs @@ -202,8 +202,6 @@ namespace OpenSim.Framework.Serialization.External using (XmlTextReader reader = new XmlTextReader(new StringReader(serialization))) { - reader.ProhibitDtd = true; - reader.ReadStartElement("InventoryItem"); ExternalRepresentationUtils.ExecuteReadProcessors( diff --git a/OpenSim/Framework/Servers/HttpServer/RestDeserialiseHandler.cs b/OpenSim/Framework/Servers/HttpServer/RestDeserialiseHandler.cs index 67fc14e..bd55657 100644 --- a/OpenSim/Framework/Servers/HttpServer/RestDeserialiseHandler.cs +++ b/OpenSim/Framework/Servers/HttpServer/RestDeserialiseHandler.cs @@ -54,8 +54,6 @@ namespace OpenSim.Framework.Servers.HttpServer TRequest deserial; using (XmlTextReader xmlReader = new XmlTextReader(request)) { - xmlReader.ProhibitDtd = true; - XmlSerializer deserializer = new XmlSerializer(typeof (TRequest)); deserial = (TRequest) deserializer.Deserialize(xmlReader); } diff --git a/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs b/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs index 158befa..68073c1 100644 --- a/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs +++ b/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs @@ -210,8 +210,6 @@ namespace OpenSim.Framework.Servers.HttpServer { try { - xmlReader.ProhibitDtd = true; - XmlSerializer deserializer = new XmlSerializer(typeof(RestSessionObject)); deserial = (RestSessionObject)deserializer.Deserialize(xmlReader); } @@ -271,8 +269,6 @@ namespace OpenSim.Framework.Servers.HttpServer { try { - xmlReader.ProhibitDtd = true; - XmlSerializer deserializer = new XmlSerializer(typeof(TRequest)); deserial = (TRequest)deserializer.Deserialize(xmlReader); } -- cgit v1.1 From e9d2d818804bf0c4894ddee3aa9619cced368dce Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 17 Jan 2018 07:04:07 +0000 Subject: pesty warnings --- OpenSim/Framework/Monitoring/Stats/Stat.cs | 4 ---- OpenSim/Framework/Util.cs | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Monitoring/Stats/Stat.cs b/OpenSim/Framework/Monitoring/Stats/Stat.cs index 2402acd..4b1a229 100644 --- a/OpenSim/Framework/Monitoring/Stats/Stat.cs +++ b/OpenSim/Framework/Monitoring/Stats/Stat.cs @@ -242,11 +242,7 @@ namespace OpenSim.Framework.Monitoring public virtual OSDMap ToBriefOSDMap() { OSDMap ret = new OSDMap(); - ret.Add("Value", OSD.FromReal(Value)); - - double lastChangeOverTime, averageChangeOverTime; - return ret; } diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 7093010..ae8b784 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -2675,7 +2675,7 @@ namespace OpenSim.Framework callback(o); } - catch (ThreadAbortException e) + catch (ThreadAbortException) { } catch (Exception e) -- cgit v1.1 From 707eb8de8284c1f3e27565a0dff99ed1563b42ee Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 17 Jan 2018 07:17:24 +0000 Subject: remove more xml things no longer needed on .net >4.5.2 --- OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs | 2 +- OpenSim/Framework/Util.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs b/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs index 64b5d41..238ebb1 100644 --- a/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs +++ b/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs @@ -156,7 +156,7 @@ namespace OpenSim.Framework.Serialization.External return xml; XmlDocument doc = new XmlDocument(); - doc.XmlResolver=null; + doc.LoadXml(xml); XmlNodeList sops = doc.GetElementsByTagName("SceneObjectPart"); diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index ae8b784..eb24c84 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -671,7 +671,7 @@ namespace OpenSim.Framework public static string GetFormattedXml(string rawXml) { XmlDocument xd = new XmlDocument(); - xd.XmlResolver=null; + xd.LoadXml(rawXml); StringBuilder sb = new StringBuilder(); -- cgit v1.1 From a6e0ba262a31468c0e65faf27e6b14817d3c1669 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 18 Jan 2018 02:40:59 +0000 Subject: iStackTrace(targetThread, true) is no longer safe on windoes also --- OpenSim/Framework/Util.cs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index eb24c84..0685fdc 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -2858,6 +2858,12 @@ namespace OpenSim.Framework /// The stack trace, or null if failed to get it private static StackTrace GetStackTrace(Thread targetThread) { + + return null; +/* + not only this does not work on mono but it is not longer recomended on windows. + can cause deadlocks etc. + if (IsPlatformMono) { // This doesn't work in Mono @@ -2920,6 +2926,7 @@ namespace OpenSim.Framework // Signal the fallack-thread to stop exitedSafely.Set(); } +*/ } #pragma warning restore 0618 -- cgit v1.1 From 56535cdb47e16e0f69866461663e37f1b5bc590b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 20 Jan 2018 13:30:15 +0000 Subject: change version numbers back to 0.9.1.0 --- OpenSim/Framework/VersionInfo.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/VersionInfo.cs b/OpenSim/Framework/VersionInfo.cs index 6aac3d4..eac5aae 100644 --- a/OpenSim/Framework/VersionInfo.cs +++ b/OpenSim/Framework/VersionInfo.cs @@ -29,8 +29,8 @@ namespace OpenSim { public class VersionInfo { - public const string VersionNumber = "0.9.1.1"; - public const string AssemblyVersionNumber = "0.9.1.1"; + public const string VersionNumber = "0.9.1.0"; + public const string AssemblyVersionNumber = "0.9.1.0"; public const Flavour VERSION_FLAVOUR = Flavour.Dev; @@ -53,7 +53,7 @@ namespace OpenSim public static string GetVersionString(string versionNumber, Flavour flavour) { - string versionString = "OpenSim " + versionNumber + " " + flavour; + string versionString = "OpenSim " + versionNumber + " Snail " + flavour; return versionString.PadRight(VERSIONINFO_VERSION_LENGTH); } -- cgit v1.1 From ccdaebaed6c6932d57c030adc51347d6b9e73ac7 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 21 Jan 2018 20:22:28 +0000 Subject: give concurrentqueue another chance --- .../HttpServer/PollServiceRequestManager.cs | 30 +++++++--------------- 1 file changed, 9 insertions(+), 21 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index cbdd781..bbfab64 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs @@ -30,13 +30,10 @@ using System.Collections; using System.Threading; using System.Reflection; using log4net; -using HttpServer; -using OpenSim.Framework; using OpenSim.Framework.Monitoring; using Amib.Threading; -using System.IO; -using System.Text; using System.Collections.Generic; +using System.Collections.Concurrent; namespace OpenSim.Framework.Servers.HttpServer { @@ -48,7 +45,7 @@ namespace OpenSim.Framework.Servers.HttpServer private Dictionary> m_bycontext; private BlockingQueue m_requests = new BlockingQueue(); - private static Queue m_retryRequests = new Queue(); + private static ConcurrentQueue m_retryRequests = new ConcurrentQueue(); private uint m_WorkerThreadCount = 0; private Thread[] m_workerThreads; @@ -112,10 +109,7 @@ namespace OpenSim.Framework.Servers.HttpServer private void ReQueueEvent(PollServiceHttpRequest req) { if (m_running) - { - lock (m_retryRequests) - m_retryRequests.Enqueue(req); - } + m_retryRequests.Enqueue(req); } public void Enqueue(PollServiceHttpRequest req) @@ -177,16 +171,13 @@ namespace OpenSim.Framework.Servers.HttpServer private void CheckRetries() { + PollServiceHttpRequest preq; while (m_running) - { - Thread.Sleep(100); // let the world move .. back to faster rate + Thread.Sleep(100); Watchdog.UpdateThread(); - lock (m_retryRequests) - { - while (m_retryRequests.Count > 0 && m_running) - m_requests.Enqueue(m_retryRequests.Dequeue()); - } + while (m_running && m_retryRequests.TryDequeue(out preq)) + m_requests.Enqueue(preq); } } @@ -209,10 +200,9 @@ namespace OpenSim.Framework.Servers.HttpServer try { - foreach (PollServiceHttpRequest req in m_retryRequests) - { + PollServiceHttpRequest req; + while(m_retryRequests.TryDequeue(out req)) req.DoHTTPstop(m_server); - } } catch { @@ -220,8 +210,6 @@ namespace OpenSim.Framework.Servers.HttpServer PollServiceHttpRequest wreq; - m_retryRequests.Clear(); - while (m_requests.Count() > 0) { try -- cgit v1.1 From 855dcda9c358d2688d749d1571f8edc473d4b851 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 21 Jan 2018 21:02:07 +0000 Subject: give BlockingCollection another chance --- .../HttpServer/PollServiceRequestManager.cs | 31 ++++++++++------------ 1 file changed, 14 insertions(+), 17 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index bbfab64..3f43149 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs @@ -44,7 +44,7 @@ namespace OpenSim.Framework.Servers.HttpServer private readonly BaseHttpServer m_server; private Dictionary> m_bycontext; - private BlockingQueue m_requests = new BlockingQueue(); + private BlockingCollection m_requests = new BlockingCollection(); private static ConcurrentQueue m_retryRequests = new ConcurrentQueue(); private uint m_WorkerThreadCount = 0; @@ -166,7 +166,7 @@ namespace OpenSim.Framework.Servers.HttpServer public void EnqueueInt(PollServiceHttpRequest req) { if (m_running) - m_requests.Enqueue(req); + m_requests.Add(req); } private void CheckRetries() @@ -177,7 +177,7 @@ namespace OpenSim.Framework.Servers.HttpServer Thread.Sleep(100); Watchdog.UpdateThread(); while (m_running && m_retryRequests.TryDequeue(out preq)) - m_requests.Enqueue(preq); + m_requests.Add(preq); } } @@ -198,9 +198,9 @@ namespace OpenSim.Framework.Servers.HttpServer qu.Clear(); m_bycontext.Clear(); + PollServiceHttpRequest req; try { - PollServiceHttpRequest req; while(m_retryRequests.TryDequeue(out req)) req.DoHTTPstop(m_server); } @@ -208,21 +208,17 @@ namespace OpenSim.Framework.Servers.HttpServer { } - PollServiceHttpRequest wreq; - - while (m_requests.Count() > 0) + try { - try - { - wreq = m_requests.Dequeue(0); - wreq.DoHTTPstop(m_server); - } - catch - { - } + while(m_requests.TryTake(out req, 0)) + req.DoHTTPstop(m_server); } + catch + { + } + + m_requests.Dispose(); - m_requests.Clear(); } // work threads @@ -231,7 +227,8 @@ namespace OpenSim.Framework.Servers.HttpServer { while (m_running) { - PollServiceHttpRequest req = m_requests.Dequeue(4500); + PollServiceHttpRequest req; + m_requests.TryTake(out req, 4500); Watchdog.UpdateThread(); if(req == null) continue; -- cgit v1.1 From 73b587989cf64bee78d3a5a62e96cb4646d71970 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 22 Jan 2018 00:24:29 +0000 Subject: give BlockingCollection more chances --- .../HttpServer/PollServiceRequestManager.cs | 25 +++++++++++++--------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index 3f43149..db445fa 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs @@ -225,13 +225,16 @@ namespace OpenSim.Framework.Servers.HttpServer private void PoolWorkerJob() { + PollServiceHttpRequest req; while (m_running) { - PollServiceHttpRequest req; - m_requests.TryTake(out req, 4500); - Watchdog.UpdateThread(); - if(req == null) + if(!m_requests.TryTake(out req, 4500) || req == null) + { + Watchdog.UpdateThread(); continue; + } + + Watchdog.UpdateThread(); try { @@ -256,17 +259,18 @@ namespace OpenSim.Framework.Servers.HttpServer if (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id)) { + PollServiceHttpRequest nreq = req; m_threadPool.QueueWorkItem(x => { try { - Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id); - req.DoHTTPGruntWork(m_server, responsedata); + Hashtable responsedata = nreq.PollServiceArgs.GetEvents(nreq.RequestID, nreq.PollServiceArgs.Id); + nreq.DoHTTPGruntWork(m_server, responsedata); } catch (ObjectDisposedException) { } finally { - byContextDequeue(req); + byContextDequeue(nreq); } return null; }, null); @@ -275,17 +279,18 @@ namespace OpenSim.Framework.Servers.HttpServer { if ((Environment.TickCount - req.RequestTime) > req.PollServiceArgs.TimeOutms) { + PollServiceHttpRequest nreq = req; m_threadPool.QueueWorkItem(x => { try { - req.DoHTTPGruntWork(m_server, - req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id)); + nreq.DoHTTPGruntWork(m_server, + nreq.PollServiceArgs.NoEvents(nreq.RequestID, nreq.PollServiceArgs.Id)); } catch (ObjectDisposedException) {} finally { - byContextDequeue(req); + byContextDequeue(nreq); } return null; }, null); -- cgit v1.1 From d38161f83d08e8f36905faaec30fcb9bbce9a319 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 22 Jan 2018 17:09:38 +0000 Subject: retire our BlockingQueue replaced by BlockingCollection and cross fingers --- OpenSim/Framework/BlockingQueue.cs | 148 ------------------------------------- 1 file changed, 148 deletions(-) delete mode 100644 OpenSim/Framework/BlockingQueue.cs (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/BlockingQueue.cs b/OpenSim/Framework/BlockingQueue.cs deleted file mode 100644 index 2461049..0000000 --- a/OpenSim/Framework/BlockingQueue.cs +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System.Collections.Generic; -using System.Threading; - -namespace OpenSim.Framework -{ - public class BlockingQueue - { - private readonly Queue m_pqueue = new Queue(); - private readonly Queue m_queue = new Queue(); - private readonly object m_queueSync = new object(); - - public void PriorityEnqueue(T value) - { - lock (m_queueSync) - { - m_pqueue.Enqueue(value); - Monitor.Pulse(m_queueSync); - } - } - - public void Enqueue(T value) - { - lock (m_queueSync) - { - m_queue.Enqueue(value); - Monitor.Pulse(m_queueSync); - } - } - - public T Dequeue() - { - lock (m_queueSync) - { - while (m_queue.Count < 1 && m_pqueue.Count < 1) - { - Monitor.Wait(m_queueSync); - } - - if (m_pqueue.Count > 0) - return m_pqueue.Dequeue(); - - if (m_queue.Count > 0) - return m_queue.Dequeue(); - return default(T); - } - } - - public T Dequeue(int msTimeout) - { - lock (m_queueSync) - { - if (m_queue.Count < 1 && m_pqueue.Count < 1) - { - if(!Monitor.Wait(m_queueSync, msTimeout)) - return default(T); - } - - if (m_pqueue.Count > 0) - return m_pqueue.Dequeue(); - if (m_queue.Count > 0) - return m_queue.Dequeue(); - return default(T); - } - } - - /// - /// Indicate whether this queue contains the given item. - /// - /// - /// This method is not thread-safe. Do not rely on the result without consistent external locking. - /// - public bool Contains(T item) - { - lock (m_queueSync) - { - if (m_queue.Count < 1 && m_pqueue.Count < 1) - return false; - - if (m_pqueue.Contains(item)) - return true; - return m_queue.Contains(item); - } - } - - /// - /// Return a count of the number of requests on this queue. - /// - public int Count() - { - lock (m_queueSync) - return m_queue.Count + m_pqueue.Count; - } - - /// - /// Return the array of items on this queue. - /// - /// - /// This method is not thread-safe. Do not rely on the result without consistent external locking. - /// - public T[] GetQueueArray() - { - lock (m_queueSync) - { - if (m_queue.Count < 1 && m_pqueue.Count < 1) - return new T[0]; - - return m_queue.ToArray(); - } - } - - public void Clear() - { - lock (m_queueSync) - { - m_pqueue.Clear(); - m_queue.Clear(); - Monitor.Pulse(m_queueSync); - } - } - } -} -- cgit v1.1 From c87585ad96e11397841b8c49b968e11f7c276e21 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 24 Jan 2018 03:12:56 +0000 Subject: simplify http bycontext key --- .../Servers/HttpServer/PollServiceHttpRequest.cs | 18 --------------- .../HttpServer/PollServiceRequestManager.cs | 27 ++++++++++++---------- 2 files changed, 15 insertions(+), 30 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs index 8ab5808..d5c25b9 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs @@ -130,27 +130,9 @@ namespace OpenSim.Framework.Servers.HttpServer response.OutputStream.Flush(); response.Send(); } -// catch (Exception e) catch { } } } - - class PollServiceHttpRequestComparer : IEqualityComparer - { - public bool Equals(PollServiceHttpRequest b1, PollServiceHttpRequest b2) - { - if (b1.contextHash != b2.contextHash) - return false; -// bool b = Object.ReferenceEquals(b1.HttpContext, b2.HttpContext); -// return b; - return true; - } - - public int GetHashCode(PollServiceHttpRequest b2) - { - return (int)b2.contextHash; - } - } } \ No newline at end of file diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index db445fa..a2f6a11 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs @@ -43,7 +43,7 @@ namespace OpenSim.Framework.Servers.HttpServer private readonly BaseHttpServer m_server; - private Dictionary> m_bycontext; + private Dictionary> m_bycontext; private BlockingCollection m_requests = new BlockingCollection(); private static ConcurrentQueue m_retryRequests = new ConcurrentQueue(); @@ -62,8 +62,7 @@ namespace OpenSim.Framework.Servers.HttpServer m_WorkerThreadCount = pWorkerThreadCount; m_workerThreads = new Thread[m_WorkerThreadCount]; - PollServiceHttpRequestComparer preqCp = new PollServiceHttpRequestComparer(); - m_bycontext = new Dictionary>(preqCp); + m_bycontext = new Dictionary>(256); STPStartInfo startInfo = new STPStartInfo(); startInfo.IdleTimeout = 30000; @@ -102,8 +101,6 @@ namespace OpenSim.Framework.Servers.HttpServer true, null, 1000 * 60 * 10); - - } private void ReQueueEvent(PollServiceHttpRequest req) @@ -114,17 +111,18 @@ namespace OpenSim.Framework.Servers.HttpServer public void Enqueue(PollServiceHttpRequest req) { + Queue ctxQeueue; + int rhash = req.contextHash; lock (m_bycontext) { - Queue ctxQeueue; - if (m_bycontext.TryGetValue(req, out ctxQeueue)) + if (m_bycontext.TryGetValue(rhash, out ctxQeueue)) { ctxQeueue.Enqueue(req); } else { ctxQeueue = new Queue(); - m_bycontext[req] = ctxQeueue; + m_bycontext[rhash] = ctxQeueue; EnqueueInt(req); } } @@ -133,9 +131,10 @@ namespace OpenSim.Framework.Servers.HttpServer public void byContextDequeue(PollServiceHttpRequest req) { Queue ctxQeueue; + int rhash = req.contextHash; lock (m_bycontext) { - if (m_bycontext.TryGetValue(req, out ctxQeueue)) + if (m_bycontext.TryGetValue(rhash, out ctxQeueue)) { if (ctxQeueue.Count > 0) { @@ -144,7 +143,7 @@ namespace OpenSim.Framework.Servers.HttpServer } else { - m_bycontext.Remove(req); + m_bycontext.Remove(rhash); } } } @@ -153,12 +152,13 @@ namespace OpenSim.Framework.Servers.HttpServer public void DropByContext(PollServiceHttpRequest req) { Queue ctxQeueue; + int rhash = req.contextHash; lock (m_bycontext) { - if (m_bycontext.TryGetValue(req, out ctxQeueue)) + if (m_bycontext.TryGetValue(rhash, out ctxQeueue)) { ctxQeueue.Clear(); - m_bycontext.Remove(req); + m_bycontext.Remove(rhash); } } } @@ -228,6 +228,7 @@ namespace OpenSim.Framework.Servers.HttpServer PollServiceHttpRequest req; while (m_running) { + req = null; if(!m_requests.TryTake(out req, 4500) || req == null) { Watchdog.UpdateThread(); @@ -271,6 +272,7 @@ namespace OpenSim.Framework.Servers.HttpServer finally { byContextDequeue(nreq); + nreq = null; } return null; }, null); @@ -291,6 +293,7 @@ namespace OpenSim.Framework.Servers.HttpServer finally { byContextDequeue(nreq); + nreq = null; } return null; }, null); -- cgit v1.1 From 5a246026a076b01b60578d1499c9761f8bcf4793 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 24 Jan 2018 04:48:10 +0000 Subject: let MinHeap self trim on empty; cleanup --- OpenSim/Framework/MinHeap.cs | 150 +++++++++++++++++++++++-------------------- 1 file changed, 80 insertions(+), 70 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/MinHeap.cs b/OpenSim/Framework/MinHeap.cs index 99ac25d..68f6668 100644 --- a/OpenSim/Framework/MinHeap.cs +++ b/OpenSim/Framework/MinHeap.cs @@ -45,8 +45,8 @@ namespace OpenSim.Framework internal void Clear() { - this.index = -1; - this.heap = null; + index = -1; + heap = null; } } @@ -55,23 +55,26 @@ namespace OpenSim.Framework internal T value; internal Handle handle; - internal HeapItem(T value, Handle handle) + internal HeapItem(T _value, Handle _handle) { - this.value = value; - this.handle = handle; + value = _value; + handle = _handle; } internal void Clear() { - if (this.handle != null) - this.handle.Clear(); - ClearRef(); + if (handle != null) + { + handle.Clear(); + handle = null; + } + value = default(T); } internal void ClearRef() { - this.value = default(T); - this.handle = null; + value = default(T); + handle = null; } } @@ -81,6 +84,7 @@ namespace OpenSim.Framework private int size; private object sync_root; private int version; + private int capacity; private Comparison comparison; @@ -90,14 +94,15 @@ namespace OpenSim.Framework public MinHeap(int capacity, IComparer comparer) : this(capacity, new Comparison(comparer.Compare)) { } public MinHeap(Comparison comparison) : this(DEFAULT_CAPACITY, comparison) { } - public MinHeap(int capacity, Comparison comparison) + public MinHeap(int _capacity, Comparison _comparison) { - this.items = new HeapItem[capacity]; - this.comparison = comparison; - this.size = this.version = 0; + capacity = _capacity; + items = new HeapItem[capacity]; + comparison = _comparison; + size = version = 0; } - public int Count { get { return this.size; } } + public int Count { get { return size; } } public bool IsReadOnly { get { return false; } } @@ -108,15 +113,16 @@ namespace OpenSim.Framework get { Handle handle = ValidateThisHandle(key); - return this.items[handle.index].value; + return items[handle.index].value; } set { Handle handle = ValidateThisHandle(key); - this.items[handle.index].value = value; - if (!BubbleUp(handle.index)) - BubbleDown(handle.index); + int indx = handle.index; + items[indx].value = value; + if (!BubbleUp(indx)) + BubbleDown(indx); } } @@ -124,9 +130,9 @@ namespace OpenSim.Framework { get { - if (this.sync_root == null) - Interlocked.CompareExchange(ref this.sync_root, new object(), null); - return this.sync_root; + if (sync_root == null) + Interlocked.CompareExchange(ref sync_root, new object(), null); + return sync_root; } } @@ -152,27 +158,27 @@ namespace OpenSim.Framework private void Set(HeapItem item, int index) { - this.items[index] = item; + items[index] = item; if (item.handle != null) item.handle.index = index; } private bool BubbleUp(int index) { - HeapItem item = this.items[index]; + HeapItem item = items[index]; int current, parent; for (current = index, parent = (current - 1) / 2; - (current > 0) && (this.comparison(this.items[parent].value, item.value)) > 0; + (current > 0) && (comparison(items[parent].value, item.value)) > 0; current = parent, parent = (current - 1) / 2) { - Set(this.items[parent], current); + Set(items[parent], current); } if (current != index) { Set(item, current); - ++this.version; + ++version; return true; } return false; @@ -180,24 +186,24 @@ namespace OpenSim.Framework private void BubbleDown(int index) { - HeapItem item = this.items[index]; + HeapItem item = items[index]; int current, child; for (current = index, child = (2 * current) + 1; - current < this.size / 2; + current < size / 2; current = child, child = (2 * current) + 1) { - if ((child < this.size - 1) && this.comparison(this.items[child].value, this.items[child + 1].value) > 0) + if ((child < size - 1) && comparison(items[child].value, items[child + 1].value) > 0) ++child; - if (this.comparison(this.items[child].value, item.value) >= 0) + if (comparison(items[child].value, item.value) >= 0) break; - Set(this.items[child], current); + Set(items[child], current); } if (current != index) { Set(item, current); - ++this.version; + ++version; } } @@ -206,7 +212,7 @@ namespace OpenSim.Framework Handle handle = ValidateHandle(key); if (handle.index > -1) { - value = this.items[handle.index].value; + value = items[handle.index].value; return true; } value = default(T); @@ -228,12 +234,12 @@ namespace OpenSim.Framework public void Add(T value, IHandle ihandle) { - if (this.size == this.items.Length) + if (size == items.Length) { - int capacity = (int)((this.items.Length * 200L) / 100L); - if (capacity < (this.items.Length + DEFAULT_CAPACITY)) - capacity = this.items.Length + DEFAULT_CAPACITY; - Array.Resize(ref this.items, capacity); + int capacity = (int)((items.Length * 200L) / 100L); + if (capacity < (items.Length + DEFAULT_CAPACITY)) + capacity = items.Length + DEFAULT_CAPACITY; + Array.Resize(ref items, capacity); } Handle handle = null; @@ -245,8 +251,8 @@ namespace OpenSim.Framework HeapItem item = new MinHeap.HeapItem(value, handle); - Set(item, this.size); - BubbleUp(this.size++); + Set(item, size); + BubbleUp(size++); } public void Add(T value) @@ -256,50 +262,54 @@ namespace OpenSim.Framework public T Min() { - if (this.size == 0) + if (size == 0) throw new InvalidOperationException("Heap is empty"); - return this.items[0].value; + return items[0].value; } public void Clear() { - for (int index = 0; index < this.size; ++index) - this.items[index].Clear(); - this.size = 0; - ++this.version; + for (int index = 0; index < size; ++index) + items[index].Clear(); + size = 0; + if(items.Length > capacity) + items = new HeapItem[capacity]; + ++version; } public void TrimExcess() { - int length = (int)(this.items.Length * 0.9); - if (this.size < length) - Array.Resize(ref this.items, Math.Min(this.size, DEFAULT_CAPACITY)); + int length = (int)(items.Length * 0.9); + if (size < length) + Array.Resize(ref items, Math.Min(size, capacity)); } private void RemoveAt(int index) { - if (this.size == 0) + if (size == 0) throw new InvalidOperationException("Heap is empty"); - if (index >= this.size) + if (index >= size) throw new ArgumentOutOfRangeException("index"); - this.items[index].Clear(); - if (--this.size > 0 && index != this.size) + items[index].Clear(); + if (--size > 0 && index != size) { - Set(this.items[this.size], index); - this.items[this.size].ClearRef(); + Set(items[size], index); + items[size].ClearRef(); if (!BubbleUp(index)) BubbleDown(index); } + if(size == 0 && items.Length > 4 * capacity) + items = new HeapItem[capacity]; } public T RemoveMin() { - if (this.size == 0) + if (size == 0) throw new InvalidOperationException("Heap is empty"); - HeapItem item = this.items[0]; + HeapItem item = items[0]; RemoveAt(0); return item.value; } @@ -307,7 +317,7 @@ namespace OpenSim.Framework public T Remove(IHandle ihandle) { Handle handle = ValidateThisHandle(ihandle); - HeapItem item = this.items[handle.index]; + HeapItem item = items[handle.index]; RemoveAt(handle.index); return item.value; } @@ -317,9 +327,9 @@ namespace OpenSim.Framework EqualityComparer comparer = EqualityComparer.Default; int index; - for (index = 0; index < this.size; ++index) + for (index = 0; index < size; ++index) { - if (comparer.Equals(this.items[index].value, value)) + if (comparer.Equals(items[index].value, value)) return index; } return -1; @@ -356,8 +366,8 @@ namespace OpenSim.Framework if ((length - index) < this.size) throw new ArgumentException("Not enough space available in array starting at index"); - for (int i = 0; i < this.size; ++i) - array[index + i] = this.items[i].value; + for (int i = 0; i < size; ++i) + array[index + i] = items[i].value; } public void CopyTo(Array array, int index) @@ -372,13 +382,13 @@ namespace OpenSim.Framework int length = array.Length; if ((index < 0) || (index > length)) throw new ArgumentOutOfRangeException("index"); - if ((length - index) < this.size) + if ((length - index) < size) throw new ArgumentException("Not enough space available in array starting at index"); try { - for (int i = 0; i < this.size; ++i) - array.SetValue(this.items[i].value, index + i); + for (int i = 0; i < size; ++i) + array.SetValue(items[i].value, index + i); } catch (ArrayTypeMismatchException) { @@ -388,13 +398,13 @@ namespace OpenSim.Framework public IEnumerator GetEnumerator() { - int version = this.version; + int cversion = version; - for (int index = 0; index < this.size; ++index) + for (int index = 0; index < size; ++index) { - if (version != this.version) + if (cversion != version) throw new InvalidOperationException("Heap was modified while enumerating"); - yield return this.items[index].value; + yield return items[index].value; } } -- cgit v1.1 From fc224b444a8339aae2802fb919c34cfd994595f1 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 24 Jan 2018 10:02:18 +0000 Subject: avoid some large unnecessary strings --- OpenSim/Framework/Monitoring/JobEngine.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Monitoring/JobEngine.cs b/OpenSim/Framework/Monitoring/JobEngine.cs index 4a831e8..6c388b3 100644 --- a/OpenSim/Framework/Monitoring/JobEngine.cs +++ b/OpenSim/Framework/Monitoring/JobEngine.cs @@ -79,7 +79,7 @@ namespace OpenSim.Framework.Monitoring /// private bool m_warnOverMaxQueue = true; - private BlockingCollection m_jobQueue = new BlockingCollection(new ConcurrentQueue(), 5000); + private BlockingCollection m_jobQueue = new BlockingCollection(5000); private CancellationTokenSource m_cancelSource; -- cgit v1.1 From 266eabcad493863de2ddb8430b7d4509e584dfb9 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 25 Jan 2018 06:50:49 +0000 Subject: add a low level LLSDxml encoder for cases where it makes no sense to use more heavy things like OSD, and use it on displaynames --- OpenSim/Framework/LLSDxmlEncode.cs | 457 +++++++++++++++++++++++++++++++++++++ 1 file changed, 457 insertions(+) create mode 100644 OpenSim/Framework/LLSDxmlEncode.cs (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/LLSDxmlEncode.cs b/OpenSim/Framework/LLSDxmlEncode.cs new file mode 100644 index 0000000..afa0214 --- /dev/null +++ b/OpenSim/Framework/LLSDxmlEncode.cs @@ -0,0 +1,457 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +// a class for low level LLSD encoding into a provided StringBuilder +// for cases where we already need to know the low level detail +// and so using something like OSD or even protbuf is just a pure waste + +using System; +using System.Globalization; +using System.Text; +using OpenMetaverse; + +namespace OpenSim.Framework +{ + public static class LLSDxmlEncode + { + static readonly DateTime depoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); + + public static void AddStartHeader(StringBuilder sb, bool addxmlversion = false) + { + if(addxmlversion) + sb.Append(""); // legacy llsd xml name still valid + else + sb.Append(""); + } + + public static void AddEndHeader(StringBuilder sb) + { + sb.Append(""); + } + + // map == a list of key value pairs + public static void AddStartMap(StringBuilder sb) + { + sb.Append(""); + } + + public static void AddEndMap(StringBuilder sb) + { + sb.Append(""); + } + + public static void AddEmpyMap(StringBuilder sb) + { + sb.Append(""); + } + + // array == a list values + public static void AddStartArray(StringBuilder sb) + { + sb.Append(""); + } + + public static void AddEndArray(StringBuilder sb) + { + sb.Append(""); + } + + public static void AddEmpyArray(StringBuilder sb) + { + sb.Append(""); + } + + // undefined or null + public static void AddUnknownElem(StringBuilder sb) + { + sb.Append(""); + } + + public static void AddElem(bool e, StringBuilder sb) + { + if(e) + sb.Append("1"); + else + sb.Append(""); + } + + public static void AddElem(int e, StringBuilder sb) + { + if(e == 0) + sb.Append(""); + else + { + sb.Append(""); + sb.Append(e.ToString()); + sb.Append(""); + } + } + + public static void AddElem(float e, StringBuilder sb) + { + if(e == 0) + sb.Append(""); + else + { + sb.Append(""); + sb.Append(e.ToString(CultureInfo.InvariantCulture)); + sb.Append(""); + } + } + + public static void AddElem(double e, StringBuilder sb) + { + if(e == 0) + sb.Append(""); + else + { + sb.Append(""); + sb.Append(e.ToString(CultureInfo.InvariantCulture)); + sb.Append(""); + } + } + + public static void AddElem(UUID e, StringBuilder sb) + { + if(e == UUID.Zero) + sb.Append(""); + else + { + sb.Append(""); + EscapeToXML(e.ToString(), sb); + sb.Append(""); + } + } + + public static void AddElem(string e, StringBuilder sb) + { + if(String.IsNullOrEmpty(e)) + sb.Append(""); + else + { + sb.Append(""); + sb.Append(e.ToString()); + sb.Append(""); + } + } + + public static void AddRawElem(string e, StringBuilder sb) + { + if(String.IsNullOrEmpty(e)) + sb.Append(""); + else + { + sb.Append(""); + sb.Append(e); + sb.Append(""); + } + } + + public static void AddURIElem(Uri e, StringBuilder sb) + { + if(e == null) + { + sb.Append(""); + return; + } + + string s; + if (e.IsAbsoluteUri) + s = e.AbsoluteUri; + else + s = e.ToString(); + + if(String.IsNullOrEmpty(s)) + sb.Append(""); + else + { + sb.Append(""); + sb.Append(s); + sb.Append(""); + } + } + + public static void AddElem(DateTime e, StringBuilder sb) + { + DateTime u = e.ToUniversalTime(); + if(u == depoch) + { + sb.Append(""); + return; + } + string format; + if(u.Hour == 0 && u.Minute == 0 && u.Second == 0) + format = "yyyy-MM-dd"; + else if (u.Millisecond > 0) + format = "yyyy-MM-ddTHH:mm:ss.ffZ"; + else + format = "yyyy-MM-ddTHH:mm:ssZ"; + sb.Append(""); + sb.Append(u.ToString(format,CultureInfo.InvariantCulture)); + sb.Append(""); + } + +//************ key value ******************* +// assumes name is a valid llsd key + + public static void AddStartMap(string name, StringBuilder sb) + { + sb.Append(""); + sb.Append(name); + sb.Append(""); + } + + public static void AddEmpyMap(string name, StringBuilder sb) + { + sb.Append(""); + sb.Append(name); + sb.Append(""); + } + + // array == a list values + public static void AddStartArray(string name, StringBuilder sb) + { + sb.Append(""); + sb.Append(name); + sb.Append(""); + } + + public static void AddEmpyArray(string name, StringBuilder sb) + { + sb.Append(""); + sb.Append(name); + sb.Append(""); + } + + // undefined or null + public static void AddUnknownElem(string name, StringBuilder sb) + { + sb.Append(""); + sb.Append(name); + sb.Append(""); + } + + public static void AddElem(string name, bool e, StringBuilder sb) + { + sb.Append(""); + sb.Append(name); + sb.Append(""); + + if(e) + sb.Append("1"); + else + sb.Append(""); + } + + public static void AddElem(string name, int e, StringBuilder sb) + { + sb.Append(""); + sb.Append(name); + sb.Append(""); + + if(e == 0) + sb.Append(""); + else + { + sb.Append(""); + sb.Append(e.ToString()); + sb.Append(""); + } + } + + public static void AddElem(string name, float e, StringBuilder sb) + { + sb.Append(""); + sb.Append(name); + sb.Append(""); + + if(e == 0) + sb.Append(""); + else + { + sb.Append(""); + sb.Append(e.ToString(CultureInfo.InvariantCulture)); + sb.Append(""); + } + } + + public static void AddElem(string name, double e, StringBuilder sb) + { + sb.Append(""); + sb.Append(name); + sb.Append(""); + + if(e == 0) + sb.Append(""); + else + { + sb.Append(""); + sb.Append(e.ToString(CultureInfo.InvariantCulture)); + sb.Append(""); + } + } + + public static void AddElem(string name, UUID e, StringBuilder sb) + { + sb.Append(""); + sb.Append(name); + sb.Append(""); + + if(e == UUID.Zero) + sb.Append(""); + else + { + sb.Append(""); + EscapeToXML(e.ToString(), sb); + sb.Append(""); + } + } + + public static void AddElem(string name, string e, StringBuilder sb) + { + sb.Append(""); + sb.Append(name); + sb.Append(""); + + if(String.IsNullOrEmpty(e)) + sb.Append(""); + else + { + sb.Append(""); + sb.Append(e.ToString()); + sb.Append(""); + } + } + + public static void AddRawElem(string name, string e, StringBuilder sb) + { + sb.Append(""); + sb.Append(name); + sb.Append(""); + + if(String.IsNullOrEmpty(e)) + sb.Append(""); + else + { + sb.Append(""); + sb.Append(e); + sb.Append(""); + } + } + + public static void AddURIElem(string name, Uri e, StringBuilder sb) + { + sb.Append(""); + sb.Append(name); + sb.Append(""); + + if(e == null) + { + sb.Append(""); + return; + } + + string s; + if (e.IsAbsoluteUri) + s = e.AbsoluteUri; + else + s = e.ToString(); + + if(String.IsNullOrEmpty(s)) + sb.Append(""); + else + { + sb.Append(""); + sb.Append(s); + sb.Append(""); + } + } + + public static void AddElem(string name, DateTime e, StringBuilder sb) + { + sb.Append(""); + sb.Append(name); + sb.Append(""); + + DateTime u = e.ToUniversalTime(); + if(u == depoch) + { + sb.Append(""); + return; + } + string format; + if(u.Hour == 0 && u.Minute == 0 && u.Second == 0) + format = "yyyy-MM-dd"; + else if (u.Millisecond > 0) + format = "yyyy-MM-ddTHH:mm:ss.ffZ"; + else + format = "yyyy-MM-ddTHH:mm:ssZ"; + sb.Append(""); + sb.Append(u.ToString(format,CultureInfo.InvariantCulture)); + sb.Append(""); + } + + public static void AddLLSD(string e, StringBuilder sb) + { + sb.Append(e); + } + + public static void EscapeToXML(string s, StringBuilder sb) + { + int i; + char c; + String t; + int len = s.Length; + + for (i = 0; i < len; i++) + { + c = s[i]; + switch (c) + { + case '<': + sb.Append("<"); + break; + case '>': + sb.Append(">"); + break; + case '&': + sb.Append("&"); + break; + case '"': + sb.Append("""); + break; + case '\\': + sb.Append("'"); + break; + default: + sb.Append(c); + break; + } + } + } + } +} -- cgit v1.1 From cdd3ef857c296a3aee88eea0386d166222684c04 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 25 Jan 2018 08:02:45 +0000 Subject: a few changes to encoder and a few more uses --- OpenSim/Framework/LLSDxmlEncode.cs | 44 +++++++++++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 8 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/LLSDxmlEncode.cs b/OpenSim/Framework/LLSDxmlEncode.cs index afa0214..e095363 100644 --- a/OpenSim/Framework/LLSDxmlEncode.cs +++ b/OpenSim/Framework/LLSDxmlEncode.cs @@ -40,7 +40,7 @@ namespace OpenSim.Framework { static readonly DateTime depoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); - public static void AddStartHeader(StringBuilder sb, bool addxmlversion = false) + public static void AddStart(StringBuilder sb, bool addxmlversion = false) { if(addxmlversion) sb.Append(""); // legacy llsd xml name still valid @@ -48,13 +48,13 @@ namespace OpenSim.Framework sb.Append(""); } - public static void AddEndHeader(StringBuilder sb) + public static void AddEnd(StringBuilder sb) { sb.Append(""); } // map == a list of key value pairs - public static void AddStartMap(StringBuilder sb) + public static void AddMap(StringBuilder sb) { sb.Append(""); } @@ -70,7 +70,7 @@ namespace OpenSim.Framework } // array == a list values - public static void AddStartArray(StringBuilder sb) + public static void AddArray(StringBuilder sb) { sb.Append(""); } @@ -99,6 +99,18 @@ namespace OpenSim.Framework sb.Append(""); } + public static void AddElem(byte e, StringBuilder sb) + { + if(e == 0) + sb.Append(""); + else + { + sb.Append(""); + sb.Append(e.ToString()); + sb.Append(""); + } + } + public static void AddElem(int e, StringBuilder sb) { if(e == 0) @@ -171,7 +183,7 @@ namespace OpenSim.Framework } } - public static void AddURIElem(Uri e, StringBuilder sb) + public static void AddElem(Uri e, StringBuilder sb) { if(e == null) { @@ -218,7 +230,7 @@ namespace OpenSim.Framework //************ key value ******************* // assumes name is a valid llsd key - public static void AddStartMap(string name, StringBuilder sb) + public static void AddMap(string name, StringBuilder sb) { sb.Append(""); sb.Append(name); @@ -233,7 +245,7 @@ namespace OpenSim.Framework } // array == a list values - public static void AddStartArray(string name, StringBuilder sb) + public static void AddArray(string name, StringBuilder sb) { sb.Append(""); sb.Append(name); @@ -267,6 +279,22 @@ namespace OpenSim.Framework sb.Append(""); } + public static void AddElem(string name, byte e, StringBuilder sb) + { + sb.Append(""); + sb.Append(name); + sb.Append(""); + + if(e == 0) + sb.Append(""); + else + { + sb.Append(""); + sb.Append(e.ToString()); + sb.Append(""); + } + } + public static void AddElem(string name, int e, StringBuilder sb) { sb.Append(""); @@ -363,7 +391,7 @@ namespace OpenSim.Framework } } - public static void AddURIElem(string name, Uri e, StringBuilder sb) + public static void AddElem(string name, Uri e, StringBuilder sb) { sb.Append(""); sb.Append(name); -- cgit v1.1 From 98019031dfc8934be2feb92c99c514307b1ca159 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 25 Jan 2018 09:06:39 +0000 Subject: got tired of creating stringbuilders --- OpenSim/Framework/LLSDxmlEncode.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/LLSDxmlEncode.cs b/OpenSim/Framework/LLSDxmlEncode.cs index e095363..5447963 100644 --- a/OpenSim/Framework/LLSDxmlEncode.cs +++ b/OpenSim/Framework/LLSDxmlEncode.cs @@ -48,11 +48,28 @@ namespace OpenSim.Framework sb.Append(""); } + // got tired of creating a stringbuilder all the time; + public static StringBuilder Start(int size = 256, bool addxmlversion = false) + { + StringBuilder sb = new StringBuilder(size); + if(addxmlversion) + sb.Append(""); // legacy llsd xml name still valid + else + sb.Append(""); + return sb; + } + public static void AddEnd(StringBuilder sb) { sb.Append(""); } + public static string End(StringBuilder sb) + { + sb.Append(""); + return sb.ToString(); + } + // map == a list of key value pairs public static void AddMap(StringBuilder sb) { @@ -452,7 +469,6 @@ namespace OpenSim.Framework { int i; char c; - String t; int len = s.Length; for (i = 0; i < len; i++) -- cgit v1.1 From 69781810751c64cd8c87009dfa433a5dae3b8b20 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 26 Jan 2018 21:04:46 +0000 Subject: Robust: allow Library assets to override old ones, so they can be updated easily from the xml files keeping same id (left FSAssets out) --- OpenSim/Framework/AssetLoader/Filesystem/AssetLoaderFileSystem.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/AssetLoader/Filesystem/AssetLoaderFileSystem.cs b/OpenSim/Framework/AssetLoader/Filesystem/AssetLoaderFileSystem.cs index 097ad7d..efccc35 100644 --- a/OpenSim/Framework/AssetLoader/Filesystem/AssetLoaderFileSystem.cs +++ b/OpenSim/Framework/AssetLoader/Filesystem/AssetLoaderFileSystem.cs @@ -42,11 +42,13 @@ namespace OpenSim.Framework.AssetLoader.Filesystem public class AssetLoaderFileSystem : IAssetLoader { private static readonly UUID LIBRARY_OWNER_ID = new UUID("11111111-1111-0000-0000-000100bba000"); + private static readonly string LIBRARY_OWNER_IDstr = "11111111-1111-0000-0000-000100bba000"; + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); protected static AssetBase CreateAsset(string assetIdStr, string name, string path, sbyte type) { - AssetBase asset = new AssetBase(new UUID(assetIdStr), name, type, LIBRARY_OWNER_ID.ToString()); + AssetBase asset = new AssetBase(new UUID(assetIdStr), name, type, LIBRARY_OWNER_IDstr); if (!String.IsNullOrEmpty(path)) { -- cgit v1.1 From 13b4ce81991736cf424f598233fc43a5103cc939 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 27 Jan 2018 04:32:03 +0000 Subject: add Cap_FetchLib2 note that this is still local to regions, not using grid as it possible should, but this needs more work, and issue with HG older grids/regions --- OpenSim/Framework/LLSDxmlEncode.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/LLSDxmlEncode.cs b/OpenSim/Framework/LLSDxmlEncode.cs index 5447963..bd99cd6 100644 --- a/OpenSim/Framework/LLSDxmlEncode.cs +++ b/OpenSim/Framework/LLSDxmlEncode.cs @@ -81,7 +81,7 @@ namespace OpenSim.Framework sb.Append(""); } - public static void AddEmpyMap(StringBuilder sb) + public static void AddEmptyMap(StringBuilder sb) { sb.Append(""); } @@ -97,7 +97,7 @@ namespace OpenSim.Framework sb.Append(""); } - public static void AddEmpyArray(StringBuilder sb) + public static void AddEmptyArray(StringBuilder sb) { sb.Append(""); } @@ -254,7 +254,7 @@ namespace OpenSim.Framework sb.Append(""); } - public static void AddEmpyMap(string name, StringBuilder sb) + public static void AddEmptyMap(string name, StringBuilder sb) { sb.Append(""); sb.Append(name); @@ -269,7 +269,7 @@ namespace OpenSim.Framework sb.Append(""); } - public static void AddEmpyArray(string name, StringBuilder sb) + public static void AddEmptyArray(string name, StringBuilder sb) { sb.Append(""); sb.Append(name); -- cgit v1.1 From f89b2379a05c53d38643f0c8bdeddfb376dd2737 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 27 Jan 2018 05:35:40 +0000 Subject: add a few more encoding to LLSDxmlEncode.. (W or S ?) --- OpenSim/Framework/LLSDxmlEncode.cs | 224 +++++++++++++++++++++++++++++++++++++ 1 file changed, 224 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/LLSDxmlEncode.cs b/OpenSim/Framework/LLSDxmlEncode.cs index bd99cd6..a740866 100644 --- a/OpenSim/Framework/LLSDxmlEncode.cs +++ b/OpenSim/Framework/LLSDxmlEncode.cs @@ -128,6 +128,18 @@ namespace OpenSim.Framework } } + public static void AddElem(byte[] e, StringBuilder sb) + { + if(e == null || e.Length == 0) + sb.Append("binary />"); + else + { + sb.Append(""); // encode64 is default + sb.Append(Convert.ToBase64String(e,Base64FormattingOptions.None)); + sb.Append(""); + } + } + public static void AddElem(int e, StringBuilder sb) { if(e == 0) @@ -152,6 +164,101 @@ namespace OpenSim.Framework } } + public static void AddElem(Vector2 e, StringBuilder sb) + { + sb.Append("x"); + + if(e.X == 0) + sb.Append("y"); + else + { + sb.Append(""); + sb.Append(e.X.ToString(CultureInfo.InvariantCulture)); + sb.Append("y"); + } + + if(e.Y == 0) + sb.Append(""); + else + { + sb.Append(""); + sb.Append(e.Y.ToString(CultureInfo.InvariantCulture)); + sb.Append(""); + } + } + + public static void AddElem(Vector3 e, StringBuilder sb) + { + sb.Append("key>x"); + + if(e.X == 0) + sb.Append("y"); + else + { + sb.Append(""); + sb.Append(e.X.ToString(CultureInfo.InvariantCulture)); + sb.Append("y"); + } + + if(e.Y == 0) + sb.Append("z"); + else + { + sb.Append(""); + sb.Append(e.Y.ToString(CultureInfo.InvariantCulture)); + sb.Append("z"); + } + + if(e.Z == 0) + sb.Append(""); + else + { + sb.Append(""); + sb.Append(e.Z.ToString(CultureInfo.InvariantCulture)); + sb.Append(""); + } + } + + public static void AddElem(Quaternion e, StringBuilder sb) + { + sb.Append("x"); + + if(e.X == 0) + sb.Append("y"); + else + { + sb.Append(""); + sb.Append(e.X.ToString(CultureInfo.InvariantCulture)); + sb.Append("y"); + } + + if(e.Y == 0) + sb.Append("z"); + else + { + sb.Append(""); + sb.Append(e.Y.ToString(CultureInfo.InvariantCulture)); + sb.Append("z"); + } + if(e.Z == 0) + sb.Append("w"); + else + { + sb.Append(""); + sb.Append(e.Z.ToString(CultureInfo.InvariantCulture)); + sb.Append("w"); + } + + if(e.W == 0) + sb.Append(""); + else + { + sb.Append(""); + sb.Append(e.W.ToString(CultureInfo.InvariantCulture)); + sb.Append(""); + } + } + public static void AddElem(double e, StringBuilder sb) { if(e == 0) @@ -312,6 +419,22 @@ namespace OpenSim.Framework } } + public static void AddElem(string name, byte[] e, StringBuilder sb) + { + sb.Append(""); + sb.Append(name); + sb.Append(""); + + if(e == null || e.Length == 0) + sb.Append("binary />"); + else + { + sb.Append(""); // encode64 is default + sb.Append(Convert.ToBase64String(e,Base64FormattingOptions.None)); + sb.Append(""); + } + } + public static void AddElem(string name, int e, StringBuilder sb) { sb.Append(""); @@ -344,6 +467,107 @@ namespace OpenSim.Framework } } + public static void AddElem(string name, Vector2 e, StringBuilder sb) + { + sb.Append(""); + sb.Append(name); + sb.Append("x"); + + if(e.X == 0) + sb.Append("y"); + else + { + sb.Append(""); + sb.Append(e.X.ToString(CultureInfo.InvariantCulture)); + sb.Append("y"); + } + + if(e.Y == 0) + sb.Append(""); + else + { + sb.Append(""); + sb.Append(e.Y.ToString(CultureInfo.InvariantCulture)); + sb.Append(""); + } + } + + public static void AddElem(string name, Vector3 e, StringBuilder sb) + { + sb.Append(""); + sb.Append(name); + sb.Append("key>x"); + + if(e.X == 0) + sb.Append("y"); + else + { + sb.Append(""); + sb.Append(e.X.ToString(CultureInfo.InvariantCulture)); + sb.Append("y"); + } + + if(e.Y == 0) + sb.Append("z"); + else + { + sb.Append(""); + sb.Append(e.Y.ToString(CultureInfo.InvariantCulture)); + sb.Append("z"); + } + + if(e.Z == 0) + sb.Append(""); + else + { + sb.Append(""); + sb.Append(e.Z.ToString(CultureInfo.InvariantCulture)); + sb.Append(""); + } + } + + public static void AddElem(string name, Quaternion e, StringBuilder sb) + { + sb.Append(""); + sb.Append(name); + sb.Append("x"); + + if(e.X == 0) + sb.Append("y"); + else + { + sb.Append(""); + sb.Append(e.X.ToString(CultureInfo.InvariantCulture)); + sb.Append("y"); + } + + if(e.Y == 0) + sb.Append("z"); + else + { + sb.Append(""); + sb.Append(e.Y.ToString(CultureInfo.InvariantCulture)); + sb.Append("z"); + } + if(e.Z == 0) + sb.Append("w"); + else + { + sb.Append(""); + sb.Append(e.Z.ToString(CultureInfo.InvariantCulture)); + sb.Append("w"); + } + + if(e.W == 0) + sb.Append(""); + else + { + sb.Append(""); + sb.Append(e.W.ToString(CultureInfo.InvariantCulture)); + sb.Append(""); + } + } + public static void AddElem(string name, double e, StringBuilder sb) { sb.Append(""); -- cgit v1.1 From 4c65bb4196408bfb213496c2e52064d578ed0240 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 27 Jan 2018 18:09:44 +0000 Subject: a few more changes on inventory library and inv fetch --- OpenSim/Framework/Util.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 0685fdc..8e4a953 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -92,6 +92,7 @@ namespace OpenSim.Framework // explicitly given All = 0x8e000, AllAndExport = 0x9e000, + AllAndExportNoMod = 0x9a000, AllEffective = 0x9e000, UnfoldedMask = 0x1e000 } -- cgit v1.1 From 5548b66dc06eb2497523f5d8d041c3a53a4a1115 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 30 Jan 2018 01:07:24 +0000 Subject: a few more changes on inventory library and inv fetch --- OpenSim/Framework/InventoryItemBase.cs | 37 ++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/InventoryItemBase.cs b/OpenSim/Framework/InventoryItemBase.cs index c359a0c..8fe9a6a 100644 --- a/OpenSim/Framework/InventoryItemBase.cs +++ b/OpenSim/Framework/InventoryItemBase.cs @@ -26,6 +26,7 @@ */ using System; +using System.Text; using OpenMetaverse; namespace OpenSim.Framework @@ -415,5 +416,41 @@ namespace OpenSim.Framework { return MemberwiseClone(); } + + public void ToLLSDxml(StringBuilder lsl) + { + LLSDxmlEncode.AddMap(lsl); + LLSDxmlEncode.AddElem("parent_id", Folder, lsl); + LLSDxmlEncode.AddElem("asset_id", AssetID, lsl); + LLSDxmlEncode.AddElem("item_id", ID, lsl); + + LLSDxmlEncode.AddMap("permissions",lsl); + LLSDxmlEncode.AddElem("creator_id", CreatorIdAsUuid, lsl); + LLSDxmlEncode.AddElem("owner_id", Owner, lsl); + LLSDxmlEncode.AddElem("group_id", GroupID, lsl); + LLSDxmlEncode.AddElem("base_mask", (int)CurrentPermissions, lsl); + LLSDxmlEncode.AddElem("owner_mask", (int)CurrentPermissions, lsl); + LLSDxmlEncode.AddElem("group_mask", (int)GroupPermissions, lsl); + LLSDxmlEncode.AddElem("everyone_mask", (int)EveryOnePermissions, lsl); + LLSDxmlEncode.AddElem("next_owner_mask", (int)NextPermissions, lsl); + LLSDxmlEncode.AddElem("is_owner_group", GroupOwned, lsl); + LLSDxmlEncode.AddEndMap(lsl); + + LLSDxmlEncode.AddElem("type", AssetType, lsl); + LLSDxmlEncode.AddElem("inv_type", InvType, lsl); + LLSDxmlEncode.AddElem("flags", ((int)Flags) & 0xff, lsl); + LLSDxmlEncode.AddElem("flags", ((int)Flags) & 0xff, lsl); + + LLSDxmlEncode.AddMap("sale_info",lsl); + LLSDxmlEncode.AddElem("sale_price", SalePrice, lsl); + LLSDxmlEncode.AddElem("sale_type", SaleType, lsl); + LLSDxmlEncode.AddEndMap(lsl); + + LLSDxmlEncode.AddElem("name", Name, lsl); + LLSDxmlEncode.AddElem("desc", Description, lsl); + LLSDxmlEncode.AddElem("created_at", CreationDate, lsl); + + LLSDxmlEncode.AddEndMap(lsl); + } } } -- cgit v1.1 From 4381f16e186cd63210b7bcc5e4d34ea708fa0ba9 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 30 Jan 2018 08:15:42 +0000 Subject: keepalive is default --- OpenSim/Framework/Console/RemoteConsole.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Console/RemoteConsole.cs b/OpenSim/Framework/Console/RemoteConsole.cs index ddd9578..24f01b0 100644 --- a/OpenSim/Framework/Console/RemoteConsole.cs +++ b/OpenSim/Framework/Console/RemoteConsole.cs @@ -687,7 +687,6 @@ namespace OpenSim.Framework.Console result["int_response_code"] = 200; result["content_type"] = "application/xml"; result["keepalive"] = false; - result["reusecontext"] = false; result = CheckOrigin(result); return result; -- cgit v1.1 From 5ae09e03aa132cdb17cbc3f613fa3aaaad1738f3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 1 Feb 2018 03:16:32 +0000 Subject: remove a duplicated field --- OpenSim/Framework/InventoryItemBase.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/InventoryItemBase.cs b/OpenSim/Framework/InventoryItemBase.cs index 8fe9a6a..b7f27bd 100644 --- a/OpenSim/Framework/InventoryItemBase.cs +++ b/OpenSim/Framework/InventoryItemBase.cs @@ -439,7 +439,6 @@ namespace OpenSim.Framework LLSDxmlEncode.AddElem("type", AssetType, lsl); LLSDxmlEncode.AddElem("inv_type", InvType, lsl); LLSDxmlEncode.AddElem("flags", ((int)Flags) & 0xff, lsl); - LLSDxmlEncode.AddElem("flags", ((int)Flags) & 0xff, lsl); LLSDxmlEncode.AddMap("sale_info",lsl); LLSDxmlEncode.AddElem("sale_price", SalePrice, lsl); -- cgit v1.1 From 75c5821dfa4a0e9f1bd09a8e868014c9107f1e8e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 6 Apr 2018 16:56:49 +0100 Subject: remove GCnotify(). It is wrong in many ways and has no use. GC now does provide more correct ways of getting warning of when its about to happen, but writing to a log file on that is NOT something to do. --- OpenSim/Framework/GcNotify.cs | 62 ------------------------------------------- 1 file changed, 62 deletions(-) delete mode 100644 OpenSim/Framework/GcNotify.cs (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/GcNotify.cs b/OpenSim/Framework/GcNotify.cs deleted file mode 100644 index 14a22a6..0000000 --- a/OpenSim/Framework/GcNotify.cs +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Reflection; -using log4net; - -public class GcNotify -{ - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - public static bool Enabled - { - get { return s_initialized; } - set - { - if (!s_initialized && value) - new GcNotify(); - - s_initialized = value; - } - } - - private static bool s_initialized = false; - - private GcNotify() {} - - ~GcNotify() - { - if (!Environment.HasShutdownStarted && !AppDomain.CurrentDomain.IsFinalizingForUnload()) - { - m_log.DebugFormat("[GC NOTIFY]: Garbage collection triggered."); - - if (Enabled) - new GcNotify(); - } - } -} \ No newline at end of file -- cgit v1.1 From 90482182e569218af86b20dca24a0792ec7ffaae Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 10 Apr 2018 22:24:48 +0100 Subject: sound radius: missing file --- OpenSim/Framework/IClientAPI.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index a9044d5..f8bf583 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -443,7 +443,7 @@ namespace OpenSim.Framework public delegate void DeclineCallingCard(IClientAPI remoteClient, UUID transactionID); public delegate void SoundTrigger( - UUID soundId, UUID ownerid, UUID objid, UUID parentid, double Gain, Vector3 Position, UInt64 Handle, float radius); + UUID soundId, UUID ownerid, UUID objid, UUID parentid, double Gain, Vector3 Position, UInt64 Handle); public delegate void StartLure(byte lureType, string message, UUID targetID, IClientAPI client); public delegate void TeleportLureRequest(UUID lureID, uint teleportFlags, IClientAPI client); -- cgit v1.1 From 728040ab47ee452bad078ae79b08ea4246a20f78 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 19 Apr 2018 18:58:51 +0100 Subject: a few minor changes --- OpenSim/Framework/Util.cs | 56 +++++++++++++++++++++++++++++++++-------------- 1 file changed, 40 insertions(+), 16 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 8e4a953..c103c5c 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -262,10 +262,7 @@ namespace OpenSim.Framework /// The distance between the two vectors public static double GetDistanceTo(Vector3 a, Vector3 b) { - float dx = a.X - b.X; - float dy = a.Y - b.Y; - float dz = a.Z - b.Z; - return Math.Sqrt(dx * dx + dy * dy + dz * dz); + return Vector3.Distance(a,b); } /// @@ -277,10 +274,7 @@ namespace OpenSim.Framework /// public static bool DistanceLessThan(Vector3 a, Vector3 b, double amount) { - float dx = a.X - b.X; - float dy = a.Y - b.Y; - float dz = a.Z - b.Z; - return (dx*dx + dy*dy + dz*dz) < (amount*amount); + return Vector3.DistanceSquared(a,b) < (amount * amount); } /// @@ -381,15 +375,17 @@ namespace OpenSim.Framework get { return randomClass; } } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] public static ulong UIntsToLong(uint X, uint Y) { - return Utils.UIntsToLong(X, Y); + return ((ulong)X << 32) | (ulong)Y; } // Regions are identified with a 'handle' made up of its world coordinates packed into a ulong. // Region handles are based on the coordinate of the region corner with lower X and Y // var regions need more work than this to get that right corner from a generic world position // this corner must be on a grid point + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] public static ulong RegionWorldLocToHandle(uint X, uint Y) { ulong handle = X & 0xffffff00; // make sure it matchs grid coord points. @@ -398,6 +394,7 @@ namespace OpenSim.Framework return handle; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] public static ulong RegionGridLocToHandle(uint X, uint Y) { ulong handle = X; @@ -406,12 +403,14 @@ namespace OpenSim.Framework return handle; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] public static void RegionHandleToWorldLoc(ulong handle, out uint X, out uint Y) { X = (uint)(handle >> 32); Y = (uint)(handle & 0xfffffffful); } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] public static void RegionHandleToRegionLoc(ulong handle, out uint X, out uint Y) { X = (uint)(handle >> 40) & 0x00ffffffu; // bring from higher half, divide by 256 and clean @@ -421,12 +420,14 @@ namespace OpenSim.Framework // A region location can be 'world coordinates' (meters) or 'region grid coordinates' // grid coordinates have a fixed step of 256m as defined by viewers + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] public static uint WorldToRegionLoc(uint worldCoord) { return worldCoord >> 8; } // Convert a region's 'region grid coordinate' to its 'world coordinate'. + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] public static uint RegionToWorldLoc(uint regionCoord) { return regionCoord << 8; @@ -576,14 +577,15 @@ namespace OpenSim.Framework } // Clamp the maximum magnitude of a vector + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] public static Vector3 ClampV(Vector3 x, float max) { float lenSq = x.LengthSquared(); if (lenSq > (max * max)) { - x = x / x.Length() * max; + lenSq = max / (float)Math.Sqrt(lenSq); + x = x * lenSq; } - return x; } @@ -826,8 +828,8 @@ namespace OpenSim.Framework private static byte[] ComputeMD5Hash(string data, Encoding encoding) { - MD5 md5 = MD5.Create(); - return md5.ComputeHash(encoding.GetBytes(data)); + using(MD5 md5 = MD5.Create()) + return md5.ComputeHash(encoding.GetBytes(data)); } /// @@ -1915,7 +1917,9 @@ namespace OpenSim.Framework string ru = String.Empty; if (Environment.OSVersion.Platform == PlatformID.Unix) - ru = "Unix/Mono"; + { + ru = "Unix/Mono"; + } else if (Environment.OSVersion.Platform == PlatformID.MacOSX) ru = "OSX/Mono"; @@ -3025,16 +3029,36 @@ namespace OpenSim.Framework return tcA - tcB; } + public static long GetPhysicalMemUse() + { + return System.Diagnostics.Process.GetCurrentProcess().WorkingSet64; + } + // returns a timestamp in ms as double // using the time resolution avaiable to StopWatch + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] public static double GetTimeStamp() { - return (double)Stopwatch.GetTimestamp() * TimeStampClockPeriod; + return Stopwatch.GetTimestamp() * TimeStampClockPeriod; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] public static double GetTimeStampMS() { - return (double)Stopwatch.GetTimestamp() * TimeStampClockPeriodMS; + return Stopwatch.GetTimestamp() * TimeStampClockPeriodMS; + } + + // doing math in ticks is usefull to avoid loss of resolution + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + public static long GetTimeStampTicks() + { + return Stopwatch.GetTimestamp(); + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + public static double TimeStampTicksToMS(long ticks) + { + return ticks * TimeStampClockPeriodMS; } /// -- cgit v1.1 From 00cc17c2390c8d558774bc237bdff7141d8209eb Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 6 May 2018 23:28:36 +0100 Subject: breaking map (warp3d) --- OpenSim/Framework/Util.cs | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index c103c5c..c5c4ab3 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -30,6 +30,8 @@ using System.Collections; using System.Collections.Generic; using System.Data; using System.Diagnostics; +using System.Drawing; +using System.Drawing.Imaging; using System.Globalization; using System.IO; using System.IO.Compression; @@ -3442,6 +3444,34 @@ namespace OpenSim.Framework m_log.ErrorFormat("{0} Failed XML ({1} bytes) = {2}", message, length, xml); } + /// + /// Performs a high quality image resize + /// + /// Image to resize + /// New width + /// New height + /// Resized image + public static Bitmap ResizeImageSolid(Image image, int width, int height) + { + Bitmap result = new Bitmap(width, height, PixelFormat.Format24bppRgb); + + using (ImageAttributes atrib = new ImageAttributes()) + using (Graphics graphics = Graphics.FromImage(result)) + { + atrib.SetWrapMode(System.Drawing.Drawing2D.WrapMode.TileFlipXY); + atrib.SetWrapMode(System.Drawing.Drawing2D.WrapMode.TileFlipXY); + graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality; + graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic; + graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; + graphics.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.None; + + graphics.DrawImage(image,new Rectangle(0,0, result.Width, result.Height), + 0, 0, image.Width, image.Height, GraphicsUnit.Pixel, atrib); + } + + return result; + } + } /* don't like this code @@ -3606,5 +3636,6 @@ namespace OpenSim.Framework { rng.GetBytes(buff); } + } } -- cgit v1.1 From 9b87626cdb0812e50fd18201c42293da962c0b56 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 18 Jun 2018 01:04:26 +0100 Subject: mantis 8329: don't fail if response stream is Chunked encoded and http debuglevel >=5 --- OpenSim/Framework/WebUtil.cs | 39 ++++++++++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 7 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 20d30b5..89ccb5d 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -1334,16 +1334,42 @@ namespace OpenSim.Framework public static TResponse LogAndDeserialize(int reqnum, Stream respStream, long contentLength) { XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); - if (WebUtil.DebugLevel >= 5) { - byte[] data = new byte[contentLength]; - Util.ReadStream(respStream, data); + const int blockLength = 4096; + byte[] dataBuffer = new byte[blockLength]; + int curcount; + using (MemoryStream ms = new MemoryStream(4 * blockLength)) + { + if(contentLength == -1) + { + while (true) + { + curcount = respStream.Read(dataBuffer, 0, blockLength); + if (curcount <= 0) + break; + ms.Write(dataBuffer, 0, curcount); + } + } + else + { + int remaining = (int)contentLength; + while (remaining > 0) + { + curcount = respStream.Read(dataBuffer, 0, remaining); + if (curcount <= 0) + throw new EndOfStreamException(String.Format("End of stream reached with {0} bytes left to read", remaining)); + ms.Write(dataBuffer, 0, curcount); + remaining -= curcount; + } + } - WebUtil.LogResponseDetail(reqnum, System.Text.Encoding.UTF8.GetString(data)); + dataBuffer = ms.ToArray(); + WebUtil.LogResponseDetail(reqnum, System.Text.Encoding.UTF8.GetString(dataBuffer)); - using (MemoryStream temp = new MemoryStream(data)) - return (TResponse)deserializer.Deserialize(temp); + ms.Position = 0; + return (TResponse)deserializer.Deserialize(ms); + } } else { @@ -1427,6 +1453,5 @@ namespace OpenSim.Framework } } } - } } -- cgit v1.1 From c53658248ad44d29da33574be60c4ceed7f91f82 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 19 Jun 2018 01:18:18 +0100 Subject: reassign estate setting TaxFree to the role of AllowAccessOverride, as viewers did. Keeping name to reuse dbs entries, etc. let viewers change it, but still NOP --- OpenSim/Framework/EstateSettings.cs | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/EstateSettings.cs b/OpenSim/Framework/EstateSettings.cs index 8c8270a..8212163 100644 --- a/OpenSim/Framework/EstateSettings.cs +++ b/OpenSim/Framework/EstateSettings.cs @@ -44,7 +44,6 @@ namespace OpenSim.Framework // Only the client uses these // private uint m_EstateID = 0; - public uint EstateID { get { return m_EstateID; } @@ -52,7 +51,6 @@ namespace OpenSim.Framework } private string m_EstateName = "My Estate"; - public string EstateName { get { return m_EstateName; } @@ -60,7 +58,6 @@ namespace OpenSim.Framework } private bool m_AllowLandmark = true; - public bool AllowLandmark { get { return m_AllowLandmark; } @@ -68,7 +65,6 @@ namespace OpenSim.Framework } private bool m_AllowParcelChanges = true; - public bool AllowParcelChanges { get { return m_AllowParcelChanges; } @@ -76,7 +72,6 @@ namespace OpenSim.Framework } private bool m_AllowSetHome = true; - public bool AllowSetHome { get { return m_AllowSetHome; } @@ -84,7 +79,6 @@ namespace OpenSim.Framework } private uint m_ParentEstateID = 1; - public uint ParentEstateID { get { return m_ParentEstateID; } @@ -92,7 +86,6 @@ namespace OpenSim.Framework } private float m_BillableFactor = 0.0f; - public float BillableFactor { get { return m_BillableFactor; } @@ -100,7 +93,6 @@ namespace OpenSim.Framework } private int m_PricePerMeter = 1; - public int PricePerMeter { get { return m_PricePerMeter; } @@ -108,7 +100,6 @@ namespace OpenSim.Framework } private int m_RedirectGridX = 0; - public int RedirectGridX { get { return m_RedirectGridX; } @@ -116,7 +107,6 @@ namespace OpenSim.Framework } private int m_RedirectGridY = 0; - public int RedirectGridY { get { return m_RedirectGridY; } @@ -126,7 +116,6 @@ namespace OpenSim.Framework // Used by the sim // private bool m_UseGlobalTime = true; - public bool UseGlobalTime { get { return m_UseGlobalTime; } @@ -134,7 +123,6 @@ namespace OpenSim.Framework } private bool m_FixedSun = false; - public bool FixedSun { get { return m_FixedSun; } @@ -142,7 +130,6 @@ namespace OpenSim.Framework } private double m_SunPosition = 0.0; - public double SunPosition { get { return m_SunPosition; } @@ -150,7 +137,6 @@ namespace OpenSim.Framework } private bool m_AllowVoice = true; - public bool AllowVoice { get { return m_AllowVoice; } @@ -158,7 +144,6 @@ namespace OpenSim.Framework } private bool m_AllowDirectTeleport = true; - public bool AllowDirectTeleport { get { return m_AllowDirectTeleport; } @@ -166,23 +151,22 @@ namespace OpenSim.Framework } private bool m_DenyAnonymous = false; - public bool DenyAnonymous { get { return m_DenyAnonymous; } set { m_DenyAnonymous = value; } } + // no longer in used, may be reassigned private bool m_DenyIdentified = false; - public bool DenyIdentified { get { return m_DenyIdentified; } set { m_DenyIdentified = value; } } + // no longer in used, may be reassigned private bool m_DenyTransacted = false; - public bool DenyTransacted { get { return m_DenyTransacted; } @@ -190,7 +174,6 @@ namespace OpenSim.Framework } private bool m_AbuseEmailToEstateOwner = false; - public bool AbuseEmailToEstateOwner { get { return m_AbuseEmailToEstateOwner; } @@ -198,7 +181,6 @@ namespace OpenSim.Framework } private bool m_BlockDwell = false; - public bool BlockDwell { get { return m_BlockDwell; } @@ -206,7 +188,6 @@ namespace OpenSim.Framework } private bool m_EstateSkipScripts = false; - public bool EstateSkipScripts { get { return m_EstateSkipScripts; } @@ -214,7 +195,6 @@ namespace OpenSim.Framework } private bool m_ResetHomeOnTeleport = false; - public bool ResetHomeOnTeleport { get { return m_ResetHomeOnTeleport; } @@ -222,15 +202,13 @@ namespace OpenSim.Framework } private bool m_TaxFree = false; - - public bool TaxFree + public bool TaxFree // this is now AllowAccessOverride, keeping same name to reuse DB entries { get { return m_TaxFree; } set { m_TaxFree = value; } } private bool m_PublicAccess = true; - public bool PublicAccess { get { return m_PublicAccess; } -- cgit v1.1 From 91247e06310017803da69830b6ed47a1c383112a Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 5 Jul 2018 02:29:56 +0100 Subject: test --- OpenSim/Framework/WebUtil.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 89ccb5d..7ab3f1c 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -44,7 +44,6 @@ using log4net; using Nwc.XmlRpc; using OpenMetaverse.StructuredData; using XMLResponseHelper = OpenSim.Framework.SynchronousRestObjectRequester.XMLResponseHelper; - using OpenSim.Framework.ServiceAuth; namespace OpenSim.Framework -- cgit v1.1 From 5e1bf888752089b712c77063327130f76a18b2c4 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 5 Jul 2018 20:27:52 +0100 Subject: test jenkins --- OpenSim/Framework/WebUtil.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 7ab3f1c..3464ac5 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -43,8 +43,8 @@ using System.Xml.Linq; using log4net; using Nwc.XmlRpc; using OpenMetaverse.StructuredData; -using XMLResponseHelper = OpenSim.Framework.SynchronousRestObjectRequester.XMLResponseHelper; using OpenSim.Framework.ServiceAuth; +using XMLResponseHelper = OpenSim.Framework.SynchronousRestObjectRequester.XMLResponseHelper; namespace OpenSim.Framework { -- cgit v1.1 From 834a0e8b6dac78259f3248a7126fa390cbcbf872 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 6 Jul 2018 01:57:59 +0100 Subject: fix version string size test --- OpenSim/Framework/VersionInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/VersionInfo.cs b/OpenSim/Framework/VersionInfo.cs index eac5aae..e8e746b 100644 --- a/OpenSim/Framework/VersionInfo.cs +++ b/OpenSim/Framework/VersionInfo.cs @@ -57,7 +57,7 @@ namespace OpenSim return versionString.PadRight(VERSIONINFO_VERSION_LENGTH); } - public const int VERSIONINFO_VERSION_LENGTH = 27; + public const int VERSIONINFO_VERSION_LENGTH = 30; /// /// This is the external interface version. It is separate from the OpenSimulator project version. -- cgit v1.1 From 8ac69a5d276e4c8c2ea550402fc6e67376784fe1 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 6 Jul 2018 02:23:06 +0100 Subject: just remove the test instead --- OpenSim/Framework/Servers/Tests/VersionInfoTests.cs | 9 --------- OpenSim/Framework/VersionInfo.cs | 2 +- 2 files changed, 1 insertion(+), 10 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/Tests/VersionInfoTests.cs b/OpenSim/Framework/Servers/Tests/VersionInfoTests.cs index 480f2bb..68a1c78 100644 --- a/OpenSim/Framework/Servers/Tests/VersionInfoTests.cs +++ b/OpenSim/Framework/Servers/Tests/VersionInfoTests.cs @@ -41,14 +41,5 @@ namespace OpenSim.Framework.Servers.Tests { Assert.AreEqual(VersionInfo.VERSIONINFO_VERSION_LENGTH, VersionInfo.Version.Length," VersionInfo.Version string not " + VersionInfo.VERSIONINFO_VERSION_LENGTH + " chars."); } - - [Test] - public void TestGetVersionStringLength() - { - foreach (VersionInfo.Flavour flavour in Enum.GetValues(typeof(VersionInfo.Flavour))) - { - Assert.AreEqual(VersionInfo.VERSIONINFO_VERSION_LENGTH, VersionInfo.GetVersionString("0.0.0", flavour).Length, "0.0.0/" + flavour + " failed"); - } - } } } diff --git a/OpenSim/Framework/VersionInfo.cs b/OpenSim/Framework/VersionInfo.cs index e8e746b..eac5aae 100644 --- a/OpenSim/Framework/VersionInfo.cs +++ b/OpenSim/Framework/VersionInfo.cs @@ -57,7 +57,7 @@ namespace OpenSim return versionString.PadRight(VERSIONINFO_VERSION_LENGTH); } - public const int VERSIONINFO_VERSION_LENGTH = 30; + public const int VERSIONINFO_VERSION_LENGTH = 27; /// /// This is the external interface version. It is separate from the OpenSimulator project version. -- cgit v1.1 From 8ed4bee521d9736abd753ed1e72c7e0461e49846 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 14 Jul 2018 00:46:47 +0100 Subject: mantis 8333: kept idea but my own code. With ini setting ConsoleHistoryTimeStamp set to true, the console history file will have timestamps. Im lazy date is in en-us culture for now. (robust also) --- OpenSim/Framework/Console/LocalConsole.cs | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Console/LocalConsole.cs b/OpenSim/Framework/Console/LocalConsole.cs index 73f0323..ba32f50 100644 --- a/OpenSim/Framework/Console/LocalConsole.cs +++ b/OpenSim/Framework/Console/LocalConsole.cs @@ -46,6 +46,7 @@ namespace OpenSim.Framework.Console private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private string m_historyPath; private bool m_historyEnable; + private bool m_historytimestamps; // private readonly object m_syncRoot = new object(); private const string LOGLEVEL_NONE = "(none)"; @@ -98,15 +99,30 @@ namespace OpenSim.Framework.Console string m_historyFile = startupConfig.GetString("ConsoleHistoryFile", "OpenSimConsoleHistory.txt"); int m_historySize = startupConfig.GetInt("ConsoleHistoryFileLines", 100); m_historyPath = Path.GetFullPath(Path.Combine(Util.configDir(), m_historyFile)); - m_log.InfoFormat("[LOCAL CONSOLE]: Persistent command line history is Enabled, up to {0} lines from file {1}", m_historySize, m_historyPath); + m_historytimestamps = startupConfig.GetBoolean("ConsoleHistoryTimeStamp", false); + m_log.InfoFormat("[LOCAL CONSOLE]: Persistent command line history is Enabled, up to {0} lines from file {1} {2} timestamps", + m_historySize, m_historyPath, m_historytimestamps?"with":"without"); if (File.Exists(m_historyPath)) { + List originallines = new List(); using (StreamReader history_file = new StreamReader(m_historyPath)) { string line; while ((line = history_file.ReadLine()) != null) { + originallines.Add(line); + if(line.StartsWith("[")) + { + int indx = line.IndexOf("]:> "); + if(indx > 0) + { + if(indx + 4 >= line.Length) + line = String.Empty; + else + line = line.Substring(indx + 4); + } + } m_history.Add(line); } } @@ -114,11 +130,14 @@ namespace OpenSim.Framework.Console if (m_history.Count > m_historySize) { while (m_history.Count > m_historySize) + { m_history.RemoveAt(0); + originallines.RemoveAt(0); + } using (StreamWriter history_file = new StreamWriter(m_historyPath)) { - foreach (string line in m_history) + foreach (string line in originallines) { history_file.WriteLine(line); } @@ -141,6 +160,8 @@ namespace OpenSim.Framework.Console m_history.Add(text); if (m_historyEnable) { + if (m_historytimestamps) + text = String.Format("[{0} {1}]:> {2}", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), text); File.AppendAllText(m_historyPath, text + Environment.NewLine); } } -- cgit v1.1 From f9c9dc585cb1c96a441314529d344dcf362c117d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 14 Jul 2018 14:27:33 +0100 Subject: have default ids of avatar alpha and tattoo --- OpenSim/Framework/AvatarWearable.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/AvatarWearable.cs b/OpenSim/Framework/AvatarWearable.cs index 0e8f960..fddd0f0 100644 --- a/OpenSim/Framework/AvatarWearable.cs +++ b/OpenSim/Framework/AvatarWearable.cs @@ -91,11 +91,11 @@ namespace OpenSim.Framework public static readonly UUID DEFAULT_PANTS_ITEM = new UUID("77c41e39-38f9-f75a-0000-5859892f1111"); public static readonly UUID DEFAULT_PANTS_ASSET = new UUID("00000000-38f9-1111-024e-222222111120"); -// public static readonly UUID DEFAULT_ALPHA_ITEM = new UUID("bfb9923c-4838-4d2d-bf07-608c5b1165c8"); -// public static readonly UUID DEFAULT_ALPHA_ASSET = new UUID("1578a2b1-5179-4b53-b618-fe00ca5a5594"); + public static readonly UUID DEFAULT_ALPHA_ITEM = new UUID("bfb9923c-4838-4d2d-bf07-608c5b1165c8"); + public static readonly UUID DEFAULT_ALPHA_ASSET = new UUID("1578a2b1-5179-4b53-b618-fe00ca5a5594"); -// public static readonly UUID DEFAULT_TATTOO_ITEM = new UUID("c47e22bd-3021-4ba4-82aa-2b5cb34d35e1"); -// public static readonly UUID DEFAULT_TATTOO_ASSET = new UUID("00000000-0000-2222-3333-100000001007"); + public static readonly UUID DEFAULT_TATTOO_ITEM = new UUID("c47e22bd-3021-4ba4-82aa-2b5cb34d35e1"); + public static readonly UUID DEFAULT_TATTOO_ASSET = new UUID("00000000-0000-2222-3333-100000001007"); protected Dictionary m_items = new Dictionary(); protected List m_ids = new List(); -- cgit v1.1 From ea815df6bd7234d8c3e030db0a86272c4d4197c8 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 14 Jul 2018 14:43:20 +0100 Subject: add a disabled log --- OpenSim/Framework/Monitoring/Watchdog.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Monitoring/Watchdog.cs b/OpenSim/Framework/Monitoring/Watchdog.cs index 9cac451..ad21d93 100644 --- a/OpenSim/Framework/Monitoring/Watchdog.cs +++ b/OpenSim/Framework/Monitoring/Watchdog.cs @@ -197,6 +197,9 @@ namespace OpenSim.Framework.Monitoring foreach(ThreadWatchdogInfo twi in m_threads.Values) { Thread t = twi.Thread; + // m_log.DebugFormat( + // "[WATCHDOG]: Stop: Removing thread {0}, ID {1}", twi.Thread.Name, twi.Thread.ManagedThreadId); + if(t.IsAlive) t.Abort(); } -- cgit v1.1 From ef8097f998e325adea452ff3c0cb6fdc71481841 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 14 Jul 2018 14:46:08 +0100 Subject: add missing xml escape --- OpenSim/Framework/LLSDxmlEncode.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/LLSDxmlEncode.cs b/OpenSim/Framework/LLSDxmlEncode.cs index a740866..ed5c4db 100644 --- a/OpenSim/Framework/LLSDxmlEncode.cs +++ b/OpenSim/Framework/LLSDxmlEncode.cs @@ -290,7 +290,7 @@ namespace OpenSim.Framework else { sb.Append(""); - sb.Append(e.ToString()); + EscapeToXML(e.ToString(), sb); sb.Append(""); } } @@ -611,7 +611,7 @@ namespace OpenSim.Framework else { sb.Append(""); - sb.Append(e.ToString()); + EscapeToXML(e.ToString(), sb); sb.Append(""); } } -- cgit v1.1 From a4881797b978b0ab73035ef6f9fc10ae897b08cc Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 14 Jul 2018 16:36:41 +0100 Subject: add options for regions to ignore age < 18 and payment access control where they don't apply --- OpenSim/Framework/EstateSettings.cs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/EstateSettings.cs b/OpenSim/Framework/EstateSettings.cs index 8212163..1b5ebfa 100644 --- a/OpenSim/Framework/EstateSettings.cs +++ b/OpenSim/Framework/EstateSettings.cs @@ -224,7 +224,6 @@ namespace OpenSim.Framework } private UUID m_EstateOwner = UUID.Zero; - public UUID EstateOwner { get { return m_EstateOwner; } @@ -232,7 +231,6 @@ namespace OpenSim.Framework } private bool m_DenyMinors = false; - public bool DenyMinors { get { return m_DenyMinors; } @@ -258,7 +256,6 @@ namespace OpenSim.Framework } private List l_EstateAccess = new List(); - public UUID[] EstateAccess { get { return l_EstateAccess.ToArray(); } @@ -266,13 +263,15 @@ namespace OpenSim.Framework } private List l_EstateGroups = new List(); - public UUID[] EstateGroups { get { return l_EstateGroups.ToArray(); } set { l_EstateGroups = new List(value); } } + public bool DoDenyMinors = true; + public bool DoDenyAnonymous = true; + public EstateSettings() { } @@ -380,14 +379,14 @@ namespace OpenSim.Framework if (!HasAccess(avatarID)) { - if (DenyMinors) + if (DoDenyMinors && DenyMinors) { if ((userFlags & 32) == 0) { return true; } } - if (DenyAnonymous) + if (DoDenyAnonymous && DenyAnonymous) { if ((userFlags & 4) == 0) { -- cgit v1.1 From 0daa4eff8a630a4828148624e713c735f4d9f4b8 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 14 Jul 2018 17:07:30 +0100 Subject: minor cleanup --- OpenSim/Framework/WebUtil.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 3464ac5..417e1cf 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -33,7 +33,6 @@ using System.Globalization; using System.IO; using System.IO.Compression; using System.Net; -using System.Net.Security; using System.Reflection; using System.Text; using System.Web; @@ -46,6 +45,7 @@ using OpenMetaverse.StructuredData; using OpenSim.Framework.ServiceAuth; using XMLResponseHelper = OpenSim.Framework.SynchronousRestObjectRequester.XMLResponseHelper; + namespace OpenSim.Framework { /// -- cgit v1.1 From ee2eed8c6f8f6d10590b00337fc7ef5957b29753 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 14 Jul 2018 21:42:07 +0100 Subject: http reusecontext is obsolete --- OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs index d5c25b9..7f24ebd 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs @@ -92,7 +92,6 @@ namespace OpenSim.Framework.Servers.HttpServer response.SendChunked = false; response.ContentLength64 = buffer.Length; response.ContentEncoding = Encoding.UTF8; -// response.ReuseContext = false; try { -- cgit v1.1 From aee981e5e2c0bbbfc5c6e840fe13fb107bc47804 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 14 Jul 2018 21:48:59 +0100 Subject: http reusecontext is obsolete --- .../Framework/Servers/HttpServer/BaseHttpServer.cs | 3 +-- .../Framework/Servers/HttpServer/OSHttpResponse.cs | 21 +-------------------- .../Servers/HttpServer/PollServiceHttpRequest.cs | 1 - 3 files changed, 2 insertions(+), 23 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index ca67d84..79f4952 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -605,8 +605,7 @@ namespace OpenSim.Framework.Servers.HttpServer } OSHttpResponse resp = new OSHttpResponse(new HttpResponse(context, request),context); -// resp.ReuseContext = true; -// resp.ReuseContext = false; + HandleRequest(req, resp); // !!!HACK ALERT!!! diff --git a/OpenSim/Framework/Servers/HttpServer/OSHttpResponse.cs b/OpenSim/Framework/Servers/HttpServer/OSHttpResponse.cs index 8e1b545..a107ced 100644 --- a/OpenSim/Framework/Servers/HttpServer/OSHttpResponse.cs +++ b/OpenSim/Framework/Servers/HttpServer/OSHttpResponse.cs @@ -256,26 +256,7 @@ namespace OpenSim.Framework.Servers.HttpServer _httpResponse.Reason = value; } } -/* - public bool ReuseContext - { - get - { - if (_httpClientContext != null) - { - return !_httpClientContext.EndWhenDone; - } - return true; - } - set - { - if (_httpClientContext != null) - { - _httpClientContext.EndWhenDone = !value; - } - } - } -*/ + protected IHttpResponse _httpResponse; private IHttpClientContext _httpClientContext; diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs index 7f24ebd..1e2e2e3 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs @@ -119,7 +119,6 @@ namespace OpenSim.Framework.Servers.HttpServer response.SendChunked = false; response.ContentLength64 = 0; response.ContentEncoding = Encoding.UTF8; -// response.ReuseContext = false; response.KeepAlive = false; response.SendChunked = false; response.StatusCode = 503; -- cgit v1.1 From 81fb1b008fb8d7206cfdc43c1cc27bbcd94d74aa Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 14 Jul 2018 21:51:43 +0100 Subject: http reusecontext is obsolete --- OpenSim/Framework/Console/RemoteConsole.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Console/RemoteConsole.cs b/OpenSim/Framework/Console/RemoteConsole.cs index 24f01b0..b90b75f 100644 --- a/OpenSim/Framework/Console/RemoteConsole.cs +++ b/OpenSim/Framework/Console/RemoteConsole.cs @@ -712,7 +712,6 @@ namespace OpenSim.Framework.Console result["int_response_code"] = 200; result["content_type"] = "text/xml"; result["keepalive"] = false; - result["reusecontext"] = false; result = CheckOrigin(result); return result; -- cgit v1.1 From 9278a9a9dd3131e96096d99d4ccf17bee94f9106 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 14 Jul 2018 22:35:51 +0100 Subject: http reusecontext is obsolete --- OpenSim/Framework/AgentUpdateArgs.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/AgentUpdateArgs.cs b/OpenSim/Framework/AgentUpdateArgs.cs index f04d692..cd1c3a0 100644 --- a/OpenSim/Framework/AgentUpdateArgs.cs +++ b/OpenSim/Framework/AgentUpdateArgs.cs @@ -83,6 +83,7 @@ namespace OpenSim.Framework public bool UseClientAgentPosition; public bool NeedsCameraCollision; public uint lastpacketSequence; + public double lastUpdateTS; public AgentUpdateArgs() { -- cgit v1.1 From e15fca60d1efcfe32e795e3494e35bdae26111e2 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 21 Jul 2018 18:31:58 +0100 Subject: mantis8342: make max ban height above ground configurable per regions instance with ini file option BanLineSafeHeight --- OpenSim/Framework/ILandChannel.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/ILandChannel.cs b/OpenSim/Framework/ILandChannel.cs index 8667837..e5ea596 100644 --- a/OpenSim/Framework/ILandChannel.cs +++ b/OpenSim/Framework/ILandChannel.cs @@ -33,6 +33,8 @@ namespace OpenSim.Region.Framework.Interfaces { public interface ILandChannel { + + float BanLineSafeHeight {get;} /// /// Get all parcels /// @@ -97,6 +99,5 @@ namespace OpenSim.Region.Framework.Interfaces void Join(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id); void Subdivide(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id); void sendClientInitialLandInfo(IClientAPI remoteClient); - } } -- cgit v1.1 From 9f3c8035526a85e3a17400139dcd4fe986b98b57 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 26 Aug 2018 08:40:35 +0100 Subject: avoid potencial null refs --- OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 79f4952..2819bc9 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -637,11 +637,11 @@ namespace OpenSim.Framework.Servers.HttpServer { try { + if(request.InputStream != null && request.InputStream.CanRead) + request.InputStream.Close(); byte[] buffer500 = SendHTML500(response); response.OutputStream.Write(buffer500, 0, buffer500.Length); response.Send(); - if(request.InputStream.CanRead) - request.InputStream.Close(); } catch { @@ -829,7 +829,7 @@ namespace OpenSim.Framework.Servers.HttpServer } } - if(request.InputStream.CanRead) + if(request.InputStream != null && request.InputStream.CanRead) request.InputStream.Dispose(); if (buffer != null) @@ -894,7 +894,7 @@ namespace OpenSim.Framework.Servers.HttpServer } finally { - if(request.InputStream.CanRead) + if(request.InputStream != null && request.InputStream.CanRead) request.InputStream.Close(); // Every month or so this will wrap and give bad numbers, not really a problem -- cgit v1.1