Merge branch 'master' into httptests

httptests
UbitUmarov 2017-05-21 02:20:40 +01:00
commit e520dba717
7 changed files with 67 additions and 89 deletions

View File

@ -52,7 +52,7 @@ namespace OpenSim.Framework.Servers.HttpServer
public enum EventType : int
{
LongPoll = 0,
Poll = 0,
LslHttp = 1,
Inventory = 2,
Texture = 3,
@ -85,7 +85,7 @@ namespace OpenSim.Framework.Servers.HttpServer
Drop = pDrop;
Id = pId;
TimeOutms = pTimeOutms;
Type = EventType.LongPoll;
Type = EventType.Poll;
}
}
}

View File

@ -48,7 +48,6 @@ namespace OpenSim.Framework.Servers.HttpServer
private Dictionary<PollServiceHttpRequest, Queue<PollServiceHttpRequest>> m_bycontext;
private BlockingQueue<PollServiceHttpRequest> m_requests = new BlockingQueue<PollServiceHttpRequest>();
private static Queue<PollServiceHttpRequest> m_slowRequests = new Queue<PollServiceHttpRequest>();
private static Queue<PollServiceHttpRequest> m_retryRequests = new Queue<PollServiceHttpRequest>();
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()
@ -176,18 +172,8 @@ 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);
}
}
}
private void CheckRetries()
{
@ -201,17 +187,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());
}
}
}
}
@ -244,13 +219,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

View File

@ -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;
_finished = true;
}
}
}
public void Stop()

View File

@ -2456,6 +2456,8 @@ namespace OpenSim.Region.Framework.Scenes
// This is irritating. Really.
if (!AbsolutePosition.IsFinite())
{
bool isphysical = PhysicsActor != null;
if(isphysical)
RemoveFromPhysicalScene();
m_log.Error("[AVATAR]: NonFinite Avatar position detected... Reset Position. Mantis this please. Error #9999902");
@ -2468,6 +2470,7 @@ namespace OpenSim.Region.Framework.Scenes
m_log.Error("[AVATAR]: NonFinite Avatar position detected... Reset Position. Mantis this please. Error #9999903");
}
if(isphysical)
AddToPhysicalScene(false);
}
else

View File

@ -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

View File

@ -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)
{

View File

@ -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);
@ -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:
@ -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;