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 public enum EventType : int
{ {
LongPoll = 0, Poll = 0,
LslHttp = 1, LslHttp = 1,
Inventory = 2, Inventory = 2,
Texture = 3, Texture = 3,
@ -85,7 +85,7 @@ namespace OpenSim.Framework.Servers.HttpServer
Drop = pDrop; Drop = pDrop;
Id = pId; Id = pId;
TimeOutms = pTimeOutms; 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 Dictionary<PollServiceHttpRequest, Queue<PollServiceHttpRequest>> m_bycontext;
private BlockingQueue<PollServiceHttpRequest> m_requests = new BlockingQueue<PollServiceHttpRequest>(); 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 static Queue<PollServiceHttpRequest> m_retryRequests = new Queue<PollServiceHttpRequest>();
private uint m_WorkerThreadCount = 0; private uint m_WorkerThreadCount = 0;
@ -56,11 +55,9 @@ namespace OpenSim.Framework.Servers.HttpServer
private Thread m_retrysThread; private Thread m_retrysThread;
private bool m_running = false; private bool m_running = false;
private int slowCount = 0;
private SmartThreadPool m_threadPool; private SmartThreadPool m_threadPool;
public PollServiceRequestManager( public PollServiceRequestManager(
BaseHttpServer pSrv, bool performResponsesAsync, uint pWorkerThreadCount, int pTimeout) BaseHttpServer pSrv, bool performResponsesAsync, uint pWorkerThreadCount, int pTimeout)
{ {
@ -80,7 +77,6 @@ namespace OpenSim.Framework.Servers.HttpServer
startInfo.ThreadPoolName = "PoolService"; startInfo.ThreadPoolName = "PoolService";
m_threadPool = new SmartThreadPool(startInfo); m_threadPool = new SmartThreadPool(startInfo);
} }
public void Start() public void Start()
@ -176,18 +172,8 @@ namespace OpenSim.Framework.Servers.HttpServer
public void EnqueueInt(PollServiceHttpRequest req) public void EnqueueInt(PollServiceHttpRequest req)
{ {
if (m_running) if (m_running)
{
if (req.PollServiceArgs.Type != PollServiceEventArgs.EventType.LongPoll)
{
m_requests.Enqueue(req); m_requests.Enqueue(req);
} }
else
{
lock (m_slowRequests)
m_slowRequests.Enqueue(req);
}
}
}
private void CheckRetries() private void CheckRetries()
{ {
@ -201,17 +187,6 @@ namespace OpenSim.Framework.Servers.HttpServer
while (m_retryRequests.Count > 0 && m_running) while (m_retryRequests.Count > 0 && m_running)
m_requests.Enqueue(m_retryRequests.Dequeue()); 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; PollServiceHttpRequest wreq;
m_retryRequests.Clear(); m_retryRequests.Clear();
lock (m_slowRequests)
{
while (m_slowRequests.Count > 0)
m_requests.Enqueue(m_slowRequests.Dequeue());
}
while (m_requests.Count() > 0) while (m_requests.Count() > 0)
{ {
try try

View File

@ -663,12 +663,6 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
Status = (int)OSHttpStatusCode.ClientErrorJoker; Status = (int)OSHttpStatusCode.ClientErrorJoker;
ResponseBody = e.Message; ResponseBody = e.Message;
} }
if (ResponseBody == null)
ResponseBody = String.Empty;
_finished = true;
return;
} }
catch (Exception e) catch (Exception e)
{ {
@ -727,13 +721,10 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
else else
{ {
_finished = true; _finished = true;
}
}
if (ResponseBody == null) if (ResponseBody == null)
ResponseBody = String.Empty; ResponseBody = String.Empty;
}
_finished = true; }
} }
public void Stop() public void Stop()

View File

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

View File

@ -138,7 +138,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
); );
// we do land collisions not ode | CollisionCategories.Land); // we do land collisions not ode | CollisionCategories.Land);
public IntPtr Body = IntPtr.Zero; public IntPtr Body = IntPtr.Zero;
private ODEScene _parent_scene; private ODEScene m_parent_scene;
private IntPtr capsule = IntPtr.Zero; private IntPtr capsule = IntPtr.Zero;
public IntPtr collider = IntPtr.Zero; public IntPtr collider = IntPtr.Zero;
@ -169,6 +169,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
{ {
m_uuid = UUID.Random(); m_uuid = UUID.Random();
m_localID = localID; m_localID = localID;
m_parent_scene = parent_scene;
timeStep = parent_scene.ODE_STEPSIZE; timeStep = parent_scene.ODE_STEPSIZE;
invtimeStep = 1 / timeStep; invtimeStep = 1 / timeStep;
@ -187,13 +188,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde
} }
else 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"); m_log.Warn("[PHYSICS]: Got NaN Position on Character Create");
} }
_parent_scene = parent_scene;
m_size.X = pSize.X; m_size.X = pSize.X;
m_size.Y = pSize.Y; m_size.Y = pSize.Y;
m_size.Z = pSize.Z; m_size.Z = pSize.Z;
@ -213,7 +211,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
// force lower density for testing // force lower density for testing
m_density = 3.0f; m_density = 3.0f;
mu = parent_scene.AvatarFriction; mu = m_parent_scene.AvatarFriction;
walkDivisor = walk_divisor; walkDivisor = walk_divisor;
runDivisor = rundivisor; runDivisor = rundivisor;
@ -437,11 +435,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde
{ {
if (value.Z > 9999999f) 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) 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); AddChange(changes.Position, value);
} }
@ -704,7 +702,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
{ {
if (pushforce) 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 else
{ {
@ -751,9 +749,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
AvaAvaSizeYsq = 0.5f * sy; AvaAvaSizeYsq = 0.5f * sy;
AvaAvaSizeYsq *= AvaAvaSizeYsq; 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.HashSpaceSetLevels(collider, -4, 3);
d.SpaceSetSublevel(collider, 3); d.SpaceSetSublevel(collider, 3);
d.SpaceSetCleanup(collider, false); 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); 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_D = basePID_D * m_mass / m_parent_scene.ODE_STEPSIZE;
PID_P = basePID_P * m_mass / _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; _zeroFlag = false;
m_pidControllerActive = true; 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 // The purpose of the AMotor here is to keep the avatar's physical
// surrogate from rotating while moving // 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.JointAttach(Amotor, Body, IntPtr.Zero);
d.JointSetAMotorMode(Amotor, 0); d.JointSetAMotorMode(Amotor, 0);
@ -854,8 +852,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
//kill the Geoms //kill the Geoms
if (capsule != IntPtr.Zero) if (capsule != IntPtr.Zero)
{ {
_parent_scene.actor_name_map.Remove(capsule); m_parent_scene.actor_name_map.Remove(capsule);
_parent_scene.waitForSpaceUnlock(collider); m_parent_scene.waitForSpaceUnlock(collider);
d.GeomDestroy(capsule); d.GeomDestroy(capsule);
capsule = IntPtr.Zero; capsule = IntPtr.Zero;
} }
@ -1049,20 +1047,20 @@ namespace OpenSim.Region.PhysicsModule.ubOde
fixbody = true; fixbody = true;
localpos.X = 0.1f; 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; fixbody = true;
localpos.X = _parent_scene.WorldExtents.X - 0.1f; localpos.X = m_parent_scene.WorldExtents.X - 0.1f;
} }
if (localpos.Y < 0.0f) if (localpos.Y < 0.0f)
{ {
fixbody = true; fixbody = true;
localpos.Y = 0.1f; 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; fixbody = true;
localpos.Y = _parent_scene.WorldExtents.Y - 0.1f; localpos.Y = m_parent_scene.WorldExtents.Y - 0.1f;
} }
if (fixbody) if (fixbody)
{ {
@ -1107,7 +1105,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
posch.Y += vel.Y * ftmp; 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 (chrminZ < terrainheight)
{ {
if (ctz.Z < 0) if (ctz.Z < 0)
@ -1119,7 +1117,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
m_haveLastFallVel = true; 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; float depth = terrainheight - chrminZ;
vec.Z = depth * PID_P * 50; vec.Z = depth * PID_P * 50;
@ -1215,7 +1213,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
break; break;
case PIDHoverType.GroundAndWater: case PIDHoverType.GroundAndWater:
float waterHeight = _parent_scene.GetWaterLevel(); float waterHeight = m_parent_scene.GetWaterLevel();
if (terrainheight > waterHeight) if (terrainheight > waterHeight)
m_targetHoverHeight = terrainheight + m_PIDHoverHeight; m_targetHoverHeight = terrainheight + m_PIDHoverHeight;
else else
@ -1381,7 +1379,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
vec.Y += (ctz.Y - vel.Y) * PID_D * 0.833f; vec.Y += (ctz.Y - vel.Y) * PID_D * 0.833f;
// hack for breaking on fall // hack for breaking on fall
if (ctz.Z == -9999f) 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) if (flying || hoverPIDActive)
{ {
vec.Z -= _parent_scene.gravityz * m_mass; vec.Z -= m_parent_scene.gravityz * m_mass;
if(!hoverPIDActive) if(!hoverPIDActive)
{ {
@ -1585,7 +1583,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
public override void UnSubscribeEvents() public override void UnSubscribeEvents()
{ {
m_eventsubscription = 0; m_eventsubscription = 0;
_parent_scene.RemoveCollisionEventReporting(this); m_parent_scene.RemoveCollisionEventReporting(this);
lock(CollisionEventsThisFrame) lock(CollisionEventsThisFrame)
CollisionEventsThisFrame.Clear(); CollisionEventsThisFrame.Clear();
} }
@ -1594,7 +1592,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
{ {
lock(CollisionEventsThisFrame) lock(CollisionEventsThisFrame)
CollisionEventsThisFrame.AddCollider(CollidedWith, contact); CollisionEventsThisFrame.AddCollider(CollidedWith, contact);
_parent_scene.AddCollisionEventReporting(this); m_parent_scene.AddCollisionEventReporting(this);
} }
public void SendCollisions(int timestep) public void SendCollisions(int timestep)
@ -1645,14 +1643,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde
AvatarGeomAndBodyCreation(_position.X, _position.Y, _position.Z); AvatarGeomAndBodyCreation(_position.X, _position.Y, _position.Z);
_parent_scene.actor_name_map[collider] = (PhysicsActor)this; m_parent_scene.actor_name_map[collider] = (PhysicsActor)this;
_parent_scene.actor_name_map[capsule] = (PhysicsActor)this; m_parent_scene.actor_name_map[capsule] = (PhysicsActor)this;
_parent_scene.AddCharacter(this); m_parent_scene.AddCharacter(this);
} }
else else
{ {
_parent_scene.RemoveCollisionEventReporting(this); m_parent_scene.RemoveCollisionEventReporting(this);
_parent_scene.RemoveCharacter(this); m_parent_scene.RemoveCharacter(this);
// destroy avatar capsule and related ODE data // destroy avatar capsule and related ODE data
AvatarGeomAndBodyDestroy(); AvatarGeomAndBodyDestroy();
} }
@ -1699,8 +1697,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
// Velocity = Vector3.Zero; // Velocity = Vector3.Zero;
m_targetVelocity = Vector3.Zero; m_targetVelocity = Vector3.Zero;
_parent_scene.actor_name_map[collider] = (PhysicsActor)this; m_parent_scene.actor_name_map[collider] = (PhysicsActor)this;
_parent_scene.actor_name_map[capsule] = (PhysicsActor)this; m_parent_scene.actor_name_map[capsule] = (PhysicsActor)this;
} }
m_freemove = false; m_freemove = false;
m_pidControllerActive = true; m_pidControllerActive = true;
@ -2008,7 +2006,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
public void AddChange(changes what, object arg) 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 private struct strAvatarSize

View File

@ -243,6 +243,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
internal void ProcessFloatVehicleParam(Vehicle pParam, float pValue) internal void ProcessFloatVehicleParam(Vehicle pParam, float pValue)
{ {
float len; float len;
if(float.IsNaN(pValue) || float.IsInfinity(pValue))
return;
switch (pParam) switch (pParam)
{ {
@ -374,6 +376,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
internal void ProcessVectorVehicleParam(Vehicle pParam, Vector3 pValue) internal void ProcessVectorVehicleParam(Vehicle pParam, Vector3 pValue)
{ {
float len; float len;
if(!pValue.IsFinite())
return;
switch (pParam) 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)); retl.Add((LSL_String)((bool)elem ? ScriptBaseClass.JSON_TRUE : ScriptBaseClass.JSON_FALSE));
return retl; return retl;
case LitJson.JsonType.Double: case LitJson.JsonType.Double:
retl.Add(new LSL_Float((float)elem)); retl.Add(new LSL_Float((double)elem));
return retl; return retl;
case LitJson.JsonType.None: case LitJson.JsonType.None:
retl.Add((LSL_String)ScriptBaseClass.JSON_NULL); retl.Add((LSL_String)ScriptBaseClass.JSON_NULL);
@ -16794,7 +16794,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
case LitJson.JsonType.Boolean: case LitJson.JsonType.Boolean:
return ((bool)elem ? (LSL_String)ScriptBaseClass.JSON_TRUE : (LSL_String)ScriptBaseClass.JSON_FALSE); return ((bool)elem ? (LSL_String)ScriptBaseClass.JSON_TRUE : (LSL_String)ScriptBaseClass.JSON_FALSE);
case LitJson.JsonType.Double: case LitJson.JsonType.Double:
return (new LSL_Float((float)elem)); return (new LSL_Float((double)elem));
case LitJson.JsonType.None: case LitJson.JsonType.None:
return ((LSL_String)ScriptBaseClass.JSON_NULL); return ((LSL_String)ScriptBaseClass.JSON_NULL);
case LitJson.JsonType.String: case LitJson.JsonType.String:
@ -16879,9 +16879,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return i.ToString(); return i.ToString();
} }
if (o is LSL_Rotation) 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) 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) if (o is LSL_String || o is string)
{ {
string str; string str;