From 49d42ee08afc1d01ccab3ce08f0daebf69c236cd Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 20 May 2017 17:56:04 +0100 Subject: mantis 8171 fix redirection on llHttpRequest --- .../Scripting/HttpRequest/ScriptsHttpRequests.cs | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs index 035097f..ae5e175 100644 --- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs +++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs @@ -663,12 +663,6 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest Status = (int)OSHttpStatusCode.ClientErrorJoker; ResponseBody = e.Message; } - - if (ResponseBody == null) - ResponseBody = String.Empty; - - _finished = true; - return; } catch (Exception e) { @@ -727,13 +721,10 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest else { _finished = true; + if (ResponseBody == null) + ResponseBody = String.Empty; } } - - if (ResponseBody == null) - ResponseBody = String.Empty; - - _finished = true; } public void Stop() -- cgit v1.1 From 02a4298b02bbc8439eaafb3c39cdefd5761317f9 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 20 May 2017 21:29:33 +0100 Subject: mantis 8172: fix llList2Json() in case of vector or rotation types --- .../Shared/Api/Implementation/LSL_Api.cs | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index d5f2e78..86ea437 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -16794,7 +16794,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case LitJson.JsonType.Boolean: return ((bool)elem ? (LSL_String)ScriptBaseClass.JSON_TRUE : (LSL_String)ScriptBaseClass.JSON_FALSE); case LitJson.JsonType.Double: - return (new LSL_Float((float)elem)); + return (new LSL_Float((double)elem)); case LitJson.JsonType.None: return ((LSL_String)ScriptBaseClass.JSON_NULL); case LitJson.JsonType.String: @@ -16804,7 +16804,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api string s = LitJson.JsonMapper.ToJson(elem); return (LSL_String)s; default: - throw new Exception(ScriptBaseClass.JSON_INVALID); + throw new Exception(ScriptBaseClass.JSON_INVALID); } } @@ -16879,9 +16879,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return i.ToString(); } if (o is LSL_Rotation) - return ((LSL_Rotation)o).ToString(); + { + StringBuilder sb = new StringBuilder(128); + sb.Append("\""); + LSL_Rotation r = (LSL_Rotation)o; + sb.Append(r.ToString()); + sb.Append("\""); + return sb.ToString(); + } if (o is LSL_Vector) - return ((LSL_Vector)o).ToString(); + { + StringBuilder sb = new StringBuilder(128); + sb.Append("\""); + LSL_Vector v = (LSL_Vector)o; + sb.Append(v.ToString()); + sb.Append("\""); + return sb.ToString(); + } if (o is LSL_String || o is string) { string str; -- cgit v1.1 From 046ec66ff9f5a3721d7135c8a472a36293940912 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 20 May 2017 22:21:27 +0100 Subject: fix a cast that makes LitJson unhappy --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 86ea437..af88e4f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -16756,7 +16756,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api retl.Add((LSL_String)((bool)elem ? ScriptBaseClass.JSON_TRUE : ScriptBaseClass.JSON_FALSE)); return retl; case LitJson.JsonType.Double: - retl.Add(new LSL_Float((float)elem)); + retl.Add(new LSL_Float((double)elem)); return retl; case LitJson.JsonType.None: retl.Add((LSL_String)ScriptBaseClass.JSON_NULL); -- cgit v1.1 From a5e3aab57551b362b69dd8173ea88608fe07a646 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 20 May 2017 23:37:14 +0100 Subject: fix a null ref in ubOde character --- .../Region/PhysicsModules/ubOde/ODECharacter.cs | 70 +++++++++++----------- 1 file changed, 34 insertions(+), 36 deletions(-) diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs index 9cef3d5..de7e879 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs @@ -138,7 +138,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde ); // we do land collisions not ode | CollisionCategories.Land); public IntPtr Body = IntPtr.Zero; - private ODEScene _parent_scene; + private ODEScene m_parent_scene; private IntPtr capsule = IntPtr.Zero; public IntPtr collider = IntPtr.Zero; @@ -169,6 +169,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde { m_uuid = UUID.Random(); m_localID = localID; + m_parent_scene = parent_scene; timeStep = parent_scene.ODE_STEPSIZE; invtimeStep = 1 / timeStep; @@ -187,13 +188,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde } else { - _position = new Vector3(((float)_parent_scene.WorldExtents.X * 0.5f), ((float)_parent_scene.WorldExtents.Y * 0.5f), parent_scene.GetTerrainHeightAtXY(128f, 128f) + 10f); + _position = new Vector3(((float)m_parent_scene.WorldExtents.X * 0.5f), ((float)m_parent_scene.WorldExtents.Y * 0.5f), parent_scene.GetTerrainHeightAtXY(128f, 128f) + 10f); m_log.Warn("[PHYSICS]: Got NaN Position on Character Create"); } - _parent_scene = parent_scene; - - m_size.X = pSize.X; m_size.Y = pSize.Y; m_size.Z = pSize.Z; @@ -213,7 +211,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde // force lower density for testing m_density = 3.0f; - mu = parent_scene.AvatarFriction; + mu = m_parent_scene.AvatarFriction; walkDivisor = walk_divisor; runDivisor = rundivisor; @@ -437,11 +435,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde { if (value.Z > 9999999f) { - value.Z = _parent_scene.GetTerrainHeightAtXY(127, 127) + 5; + value.Z = m_parent_scene.GetTerrainHeightAtXY(127, 127) + 5; } if (value.Z < -100f) { - value.Z = _parent_scene.GetTerrainHeightAtXY(127, 127) + 5; + value.Z = m_parent_scene.GetTerrainHeightAtXY(127, 127) + 5; } AddChange(changes.Position, value); } @@ -704,7 +702,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde { if (pushforce) { - AddChange(changes.Force, force * m_density / (_parent_scene.ODE_STEPSIZE * 28f)); + AddChange(changes.Force, force * m_density / (m_parent_scene.ODE_STEPSIZE * 28f)); } else { @@ -751,9 +749,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde AvaAvaSizeYsq = 0.5f * sy; AvaAvaSizeYsq *= AvaAvaSizeYsq; - _parent_scene.waitForSpaceUnlock(_parent_scene.CharsSpace); + m_parent_scene.waitForSpaceUnlock(m_parent_scene.CharsSpace); - collider = d.HashSpaceCreate(_parent_scene.CharsSpace); + collider = d.HashSpaceCreate(m_parent_scene.CharsSpace); d.HashSpaceSetLevels(collider, -4, 3); d.SpaceSetSublevel(collider, 3); d.SpaceSetCleanup(collider, false); @@ -772,10 +770,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde d.MassSetBoxTotal(out ShellMass, m_mass, m_size.X, m_size.Y, m_size.Z); - PID_D = basePID_D * m_mass / _parent_scene.ODE_STEPSIZE; - PID_P = basePID_P * m_mass / _parent_scene.ODE_STEPSIZE; + PID_D = basePID_D * m_mass / m_parent_scene.ODE_STEPSIZE; + PID_P = basePID_P * m_mass / m_parent_scene.ODE_STEPSIZE; - Body = d.BodyCreate(_parent_scene.world); + Body = d.BodyCreate(m_parent_scene.world); _zeroFlag = false; m_pidControllerActive = true; @@ -795,7 +793,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde // The purpose of the AMotor here is to keep the avatar's physical // surrogate from rotating while moving - Amotor = d.JointCreateAMotor(_parent_scene.world, IntPtr.Zero); + Amotor = d.JointCreateAMotor(m_parent_scene.world, IntPtr.Zero); d.JointAttach(Amotor, Body, IntPtr.Zero); d.JointSetAMotorMode(Amotor, 0); @@ -854,8 +852,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde //kill the Geoms if (capsule != IntPtr.Zero) { - _parent_scene.actor_name_map.Remove(capsule); - _parent_scene.waitForSpaceUnlock(collider); + m_parent_scene.actor_name_map.Remove(capsule); + m_parent_scene.waitForSpaceUnlock(collider); d.GeomDestroy(capsule); capsule = IntPtr.Zero; } @@ -1049,20 +1047,20 @@ namespace OpenSim.Region.PhysicsModule.ubOde fixbody = true; localpos.X = 0.1f; } - else if (localpos.X > _parent_scene.WorldExtents.X - 0.1f) + else if (localpos.X > m_parent_scene.WorldExtents.X - 0.1f) { fixbody = true; - localpos.X = _parent_scene.WorldExtents.X - 0.1f; + localpos.X = m_parent_scene.WorldExtents.X - 0.1f; } if (localpos.Y < 0.0f) { fixbody = true; localpos.Y = 0.1f; } - else if (localpos.Y > _parent_scene.WorldExtents.Y - 0.1) + else if (localpos.Y > m_parent_scene.WorldExtents.Y - 0.1) { fixbody = true; - localpos.Y = _parent_scene.WorldExtents.Y - 0.1f; + localpos.Y = m_parent_scene.WorldExtents.Y - 0.1f; } if (fixbody) { @@ -1107,7 +1105,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde posch.Y += vel.Y * ftmp; } - float terrainheight = _parent_scene.GetTerrainHeightAtXY(posch.X, posch.Y); + float terrainheight = m_parent_scene.GetTerrainHeightAtXY(posch.X, posch.Y); if (chrminZ < terrainheight) { if (ctz.Z < 0) @@ -1119,7 +1117,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde m_haveLastFallVel = true; } - Vector3 n = _parent_scene.GetTerrainNormalAtXY(posch.X, posch.Y); + Vector3 n = m_parent_scene.GetTerrainNormalAtXY(posch.X, posch.Y); float depth = terrainheight - chrminZ; vec.Z = depth * PID_P * 50; @@ -1215,7 +1213,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde break; case PIDHoverType.GroundAndWater: - float waterHeight = _parent_scene.GetWaterLevel(); + float waterHeight = m_parent_scene.GetWaterLevel(); if (terrainheight > waterHeight) m_targetHoverHeight = terrainheight + m_PIDHoverHeight; else @@ -1381,7 +1379,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde vec.Y += (ctz.Y - vel.Y) * PID_D * 0.833f; // hack for breaking on fall if (ctz.Z == -9999f) - vec.Z += -vel.Z * PID_D - _parent_scene.gravityz * m_mass; + vec.Z += -vel.Z * PID_D - m_parent_scene.gravityz * m_mass; } } } @@ -1407,7 +1405,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde if (flying || hoverPIDActive) { - vec.Z -= _parent_scene.gravityz * m_mass; + vec.Z -= m_parent_scene.gravityz * m_mass; if(!hoverPIDActive) { @@ -1585,7 +1583,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde public override void UnSubscribeEvents() { m_eventsubscription = 0; - _parent_scene.RemoveCollisionEventReporting(this); + m_parent_scene.RemoveCollisionEventReporting(this); lock(CollisionEventsThisFrame) CollisionEventsThisFrame.Clear(); } @@ -1594,7 +1592,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde { lock(CollisionEventsThisFrame) CollisionEventsThisFrame.AddCollider(CollidedWith, contact); - _parent_scene.AddCollisionEventReporting(this); + m_parent_scene.AddCollisionEventReporting(this); } public void SendCollisions(int timestep) @@ -1645,14 +1643,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde AvatarGeomAndBodyCreation(_position.X, _position.Y, _position.Z); - _parent_scene.actor_name_map[collider] = (PhysicsActor)this; - _parent_scene.actor_name_map[capsule] = (PhysicsActor)this; - _parent_scene.AddCharacter(this); + m_parent_scene.actor_name_map[collider] = (PhysicsActor)this; + m_parent_scene.actor_name_map[capsule] = (PhysicsActor)this; + m_parent_scene.AddCharacter(this); } else { - _parent_scene.RemoveCollisionEventReporting(this); - _parent_scene.RemoveCharacter(this); + m_parent_scene.RemoveCollisionEventReporting(this); + m_parent_scene.RemoveCharacter(this); // destroy avatar capsule and related ODE data AvatarGeomAndBodyDestroy(); } @@ -1699,8 +1697,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde // Velocity = Vector3.Zero; m_targetVelocity = Vector3.Zero; - _parent_scene.actor_name_map[collider] = (PhysicsActor)this; - _parent_scene.actor_name_map[capsule] = (PhysicsActor)this; + m_parent_scene.actor_name_map[collider] = (PhysicsActor)this; + m_parent_scene.actor_name_map[capsule] = (PhysicsActor)this; } m_freemove = false; m_pidControllerActive = true; @@ -2008,7 +2006,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde public void AddChange(changes what, object arg) { - _parent_scene.AddChange((PhysicsActor)this, what, arg); + m_parent_scene.AddChange((PhysicsActor)this, what, arg); } private struct strAvatarSize -- cgit v1.1 From c7fdb2ec53b67ac4c72d0f0643fb5beb116cb2fc Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 21 May 2017 00:52:18 +0100 Subject: on recover form nom finite avatar pos, don't add it physics it it had none --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 2731274..474378d 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2456,7 +2456,9 @@ namespace OpenSim.Region.Framework.Scenes // This is irritating. Really. if (!AbsolutePosition.IsFinite()) { - RemoveFromPhysicalScene(); + bool isphysical = PhysicsActor != null; + if(isphysical) + RemoveFromPhysicalScene(); m_log.Error("[AVATAR]: NonFinite Avatar position detected... Reset Position. Mantis this please. Error #9999902"); m_pos = m_LastFinitePos; @@ -2468,7 +2470,8 @@ namespace OpenSim.Region.Framework.Scenes m_log.Error("[AVATAR]: NonFinite Avatar position detected... Reset Position. Mantis this please. Error #9999903"); } - AddToPhysicalScene(false); + if(isphysical) + AddToPhysicalScene(false); } else { -- cgit v1.1 From 319ccf17c8cb20233e82ea0a49c4427aaefd7ac9 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 21 May 2017 01:52:27 +0100 Subject: add a bit more protection for broken scripts like ingen-e3s-v1.33 --- OpenSim/Region/PhysicsModules/ubOde/ODEDynamics.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEDynamics.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEDynamics.cs index 63bef7c..2e6a7db 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEDynamics.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEDynamics.cs @@ -243,6 +243,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde internal void ProcessFloatVehicleParam(Vehicle pParam, float pValue) { float len; + if(float.IsNaN(pValue) || float.IsInfinity(pValue)) + return; switch (pParam) { @@ -374,6 +376,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde internal void ProcessVectorVehicleParam(Vehicle pParam, Vector3 pValue) { float len; + if(!pValue.IsFinite()) + return; switch (pParam) { -- 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(-) 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