Merge branch 'master' of ssh://justincc@opensimulator.org/var/git/opensim

remotes/origin/0.6.7-post-fixes
Justin Clark-Casey (justincc) 2009-09-25 19:19:01 +01:00
commit 0bdf75637f
25 changed files with 910 additions and 443 deletions

View File

@ -58,7 +58,7 @@ namespace OpenSim.Client.Linden
{
if (m_firstScene != null)
{
return m_firstScene.CommsManager.GridService.RegionLoginsEnabled;
return m_firstScene.SceneGridService.RegionLoginsEnabled;
}
else
{

View File

@ -62,7 +62,7 @@ namespace OpenSim.Client.Linden
{
if (m_firstScene != null)
{
return m_firstScene.CommsManager.GridService.RegionLoginsEnabled;
return m_firstScene.SceneGridService.RegionLoginsEnabled;
}
else
{

View File

@ -77,7 +77,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
List<RegionData> ret = RunCommand(cmd);
if (ret == null)
if (ret.Count == 0)
return null;
return ret[0];
@ -95,7 +95,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
List<RegionData> ret = RunCommand(cmd);
if (ret == null)
if (ret.Count == 0)
return null;
return ret[0];
@ -170,10 +170,7 @@ namespace OpenSim.Data.MySQL
result.Close();
CloseReaderCommand(cmd);
if (retList.Count > 0)
return retList;
return null;
return retList;
}
public bool Store(RegionData data)
@ -182,12 +179,6 @@ namespace OpenSim.Data.MySQL
data.Data.Remove("uuid");
if (data.Data.ContainsKey("ScopeID"))
data.Data.Remove("ScopeID");
if (data.Data.ContainsKey("regionName"))
data.Data.Remove("regionName");
if (data.Data.ContainsKey("posX"))
data.Data.Remove("posX");
if (data.Data.ContainsKey("posY"))
data.Data.Remove("posY");
string[] fields = new List<string>(data.Data.Keys).ToArray();

View File

@ -101,10 +101,7 @@ namespace OpenSim.Data.Null
ret.Add(r);
}
if (ret.Count > 0)
return ret;
return null;
return ret;
}
public bool Store(RegionData data)

View File

@ -56,14 +56,14 @@ namespace OpenSim.Framework.Servers.HttpServer
request.ContentType = "text/www-form-urlencoded";
MemoryStream buffer = new MemoryStream();
int length = 0;
using (StreamWriter writer = new StreamWriter(buffer))
{
writer.WriteLine(obj);
writer.Flush();
length = (int)buffer.Length;
}
int length = (int) buffer.Length;
request.ContentLength = length;
Stream requestStream = request.GetRequestStream();

View File

@ -557,7 +557,7 @@ namespace OpenSim
/// <param name="cmd"></param>
private void HandleLoginStatus(string module, string[] cmd)
{
if (m_commsManager.GridService.RegionLoginsEnabled == false)
if (m_sceneManager.CurrentOrFirstScene.SceneGridService.RegionLoginsEnabled == false)
m_log.Info("[ Login ] Login are disabled ");
else

View File

@ -209,9 +209,9 @@ namespace OpenSim
}
// Only enable logins to the regions once we have completely finished starting up (apart from scripts)
if ((m_commsManager != null) && (m_commsManager.GridService != null))
if ((SceneManager.CurrentOrFirstScene != null) && (SceneManager.CurrentOrFirstScene.SceneGridService != null))
{
m_commsManager.GridService.RegionLoginsEnabled = true;
SceneManager.CurrentOrFirstScene.SceneGridService.RegionLoginsEnabled = true;
}
AddPluginCommands();
@ -299,12 +299,12 @@ namespace OpenSim
if (LoginEnabled)
{
m_log.Info("[LOGIN]: Login is now enabled.");
m_commsManager.GridService.RegionLoginsEnabled = true;
SceneManager.CurrentOrFirstScene.SceneGridService.RegionLoginsEnabled = true;
}
else
{
m_log.Info("[LOGIN]: Login is now disabled.");
m_commsManager.GridService.RegionLoginsEnabled = false;
SceneManager.CurrentOrFirstScene.SceneGridService.RegionLoginsEnabled = false;
}
}

View File

@ -142,7 +142,7 @@ namespace Flotsam.RegionModules.AssetCache
m_CacheDirectory = assetConfig.GetString("CacheDirectory", m_DefaultCacheDirectory);
m_log.InfoFormat("[FLOTSAM ASSET CACHE]: Cache Directory", m_DefaultCacheDirectory);
m_MemoryCacheEnabled = assetConfig.GetBoolean("MemoryCacheEnabled", true);
m_MemoryCacheEnabled = assetConfig.GetBoolean("MemoryCacheEnabled", false);
m_MemoryExpiration = TimeSpan.FromHours(assetConfig.GetDouble("MemoryCacheTimeout", m_DefaultMemoryExpiration));
#if WAIT_ON_INPROGRESS_REQUESTS
@ -150,7 +150,7 @@ namespace Flotsam.RegionModules.AssetCache
#endif
m_LogLevel = assetConfig.GetInt("LogLevel", 1);
m_HitRateDisplay = (ulong)assetConfig.GetInt("HitRateDisplay", 1);
m_HitRateDisplay = (ulong)assetConfig.GetInt("HitRateDisplay", 1000);
m_FileExpiration = TimeSpan.FromHours(assetConfig.GetDouble("FileCacheTimeout", m_DefaultFileExpiration));
m_FileExpirationCleanupTimer = TimeSpan.FromHours(assetConfig.GetDouble("FileCleanupTimer", m_DefaultFileExpiration));

View File

@ -61,7 +61,7 @@ namespace OpenSim.Region.CoreModules.Hypergrid
{
if (m_firstScene != null)
{
return m_firstScene.CommsManager.GridService.RegionLoginsEnabled;
return m_firstScene.SceneGridService.RegionLoginsEnabled;
}
else
{

View File

@ -63,6 +63,13 @@ namespace OpenSim.Region.Framework.Scenes
protected List<UUID> m_agentsInTransit;
public bool RegionLoginsEnabled
{
get { return m_regionLoginsEnabled; }
set { m_regionLoginsEnabled = value; }
}
private bool m_regionLoginsEnabled = false;
/// <summary>
/// An agent is crossing into this region
/// </summary>

View File

@ -204,7 +204,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
tempAngularVelocity2 = new btVector3(0, 0, 0);
tempInertia1 = new btVector3(0, 0, 0);
tempInertia2 = new btVector3(0, 0, 0);
tempOrientation1 = new btQuaternion(0,0,0,1);
tempOrientation1 = new btQuaternion(0, 0, 0, 1);
tempOrientation2 = new btQuaternion(0, 0, 0, 1);
_parent_scene = parent_scene;
tempTransform1 = new btTransform(_parent_scene.QuatIdentity, _parent_scene.VectorZero);
@ -216,10 +216,10 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
tempMotionState2 = new btDefaultMotionState(_parent_scene.TransZero);
tempMotionState3 = new btDefaultMotionState(_parent_scene.TransZero);
AxisLockLinearLow = new btVector3(-1 * (int)Constants.RegionSize, -1 * (int)Constants.RegionSize, -1 * (int)Constants.RegionSize);
int regionsize = (int) Constants.RegionSize;
int regionsize = (int)Constants.RegionSize;
if (regionsize == 256)
regionsize = 512;
@ -611,7 +611,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
DisableAxisMotor();
DisposeOfBody();
SetCollisionShape(null);
if (tempMotionState3 != null && tempMotionState3.Handle != IntPtr.Zero)
{
tempMotionState3.Dispose();
@ -677,8 +677,8 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
tempInertia2.Dispose();
tempInertia1 = null;
}
if (tempAngularVelocity2 != null && tempAngularVelocity2.Handle != IntPtr.Zero)
{
tempAngularVelocity2.Dispose();
@ -802,7 +802,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
changesize(timestep);
}
//
//
if (m_taintshape)
{
@ -1001,7 +1001,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
else
SetBody(0);
changeSelectedStatus(timestep);
resetCollisionAccounting();
m_taintPhysics = m_isphysical;
}
@ -1012,7 +1012,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
{
if (_parent_scene.needsMeshing(_pbs))
{
ProcessGeomCreationAsTriMesh(PhysicsVector.Zero,Quaternion.Identity);
ProcessGeomCreationAsTriMesh(PhysicsVector.Zero, Quaternion.Identity);
// createmesh returns null when it doesn't mesh.
CreateGeom(IntPtr.Zero, _mesh);
}
@ -1038,32 +1038,32 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
meshlod = _parent_scene.MeshSculptphysicalLOD;
IMesh mesh = _parent_scene.mesher.CreateMesh(SOPName, _pbs, _size, meshlod, IsPhysical);
if (!positionOffset.IsIdentical(PhysicsVector.Zero,0.001f) || orientation != Quaternion.Identity)
if (!positionOffset.IsIdentical(PhysicsVector.Zero, 0.001f) || orientation != Quaternion.Identity)
{
float[] xyz = new float[3];
xyz[0] = positionOffset.X;
xyz[1] = positionOffset.Y;
xyz[2] = positionOffset.Z;
Matrix4 m4 = Matrix4.CreateFromQuaternion(orientation);
float[] xyz = new float[3];
xyz[0] = positionOffset.X;
xyz[1] = positionOffset.Y;
xyz[2] = positionOffset.Z;
float[,] matrix = new float[3,3];
Matrix4 m4 = Matrix4.CreateFromQuaternion(orientation);
float[,] matrix = new float[3, 3];
matrix[0, 0] = m4.M11;
matrix[0, 1] = m4.M12;
matrix[0, 2] = m4.M13;
matrix[1, 0] = m4.M21;
matrix[1, 1] = m4.M22;
matrix[1, 2] = m4.M23;
matrix[2, 0] = m4.M31;
matrix[2, 1] = m4.M32;
matrix[2, 2] = m4.M33;
mesh.TransformLinear(matrix, xyz);
matrix[0, 0] = m4.M11;
matrix[0, 1] = m4.M12;
matrix[0, 2] = m4.M13;
matrix[1, 0] = m4.M21;
matrix[1, 1] = m4.M22;
matrix[1, 2] = m4.M23;
matrix[2, 0] = m4.M31;
matrix[2, 1] = m4.M32;
matrix[2, 2] = m4.M33;
mesh.TransformLinear(matrix, xyz);
}
@ -1088,12 +1088,12 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
SetCollisionShape(null);
// Construction of new prim
ProcessGeomCreation();
if (IsPhysical)
SetBody(Mass);
else
SetBody(0);
m_taintsize = _size;
}
@ -1136,7 +1136,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
//prim_geom = IntPtr.Zero;
m_log.Error("[PHYSICS]: PrimGeom dead");
}
// we don't need to do space calculation because the client sends a position update also.
if (_size.X <= 0) _size.X = 0.01f;
if (_size.Y <= 0) _size.Y = 0.01f;
@ -1153,8 +1153,8 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
tempTransform1.Dispose();
tempTransform1 = new btTransform(tempOrientation1, tempPosition1);
//d.GeomBoxSetLengths(prim_geom, _size.X, _size.Y, _size.Z);
if (IsPhysical)
@ -1162,7 +1162,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
SetBody(Mass);
// Re creates body on size.
// EnableBody also does setMass()
}
else
{
@ -1179,7 +1179,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
}
}
resetCollisionAccounting();
m_taintshape = false;
}
@ -1291,7 +1291,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
{
Body.setCollisionFlags((int)ContactFlags.CF_NO_CONTACT_RESPONSE);
disableBodySoft();
}
else
{
@ -1299,7 +1299,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
enableBodySoft();
}
m_isSelected = m_taintselected;
}
private void changevelocity(float timestep)
@ -1368,7 +1368,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
_parent = m_taintparent;
m_taintPhysics = m_isphysical;
}
private void changefloatonwater(float timestep)
@ -1627,7 +1627,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
{
if (m_zeroPosition == null)
m_zeroPosition = new PhysicsVector(0, 0, 0);
m_zeroPosition.setValues(_position.X,_position.Y,_position.Z);
m_zeroPosition.setValues(_position.X, _position.Y, _position.Z);
return;
}
}
@ -1981,7 +1981,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
//_mesh = _parent_scene.mesher.CreateMesh(m_primName, _pbs, _size, _parent_scene.meshSculptLOD, IsPhysical);
_mesh = p_mesh;
setMesh(_parent_scene, _mesh);
}
else
{
@ -1994,15 +1994,15 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
//SetGeom to a Regular Sphere
if (tempSize1 == null)
tempSize1 = new btVector3(0, 0, 0);
tempSize1.setValue(_size.X * 0.5f,_size.Y * 0.5f, _size.Z * 0.5f);
SetCollisionShape(new btSphereShape(_size.X*0.5f));
tempSize1.setValue(_size.X * 0.5f, _size.Y * 0.5f, _size.Z * 0.5f);
SetCollisionShape(new btSphereShape(_size.X * 0.5f));
}
else
{
// uses halfextents
if (tempSize1 == null)
tempSize1 = new btVector3(0, 0, 0);
tempSize1.setValue(_size.X*0.5f, _size.Y*0.5f, _size.Z*0.5f);
tempSize1.setValue(_size.X * 0.5f, _size.Y * 0.5f, _size.Z * 0.5f);
SetCollisionShape(new btBoxShape(tempSize1));
}
}
@ -2052,14 +2052,24 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
}
}
//IMesh oldMesh = primMesh;
//primMesh = mesh;
//float[] vertexList = primMesh.getVertexListAsFloatLocked(); // Note, that vertextList is pinned in memory
//int[] indexList = primMesh.getIndexListAsIntLocked(); // Also pinned, needs release after usage
////Array.Reverse(indexList);
//primMesh.releaseSourceMeshData(); // free up the original mesh data to save memory
IMesh oldMesh = primMesh;
primMesh = mesh;
float[] vertexList = primMesh.getVertexListAsFloatLocked(); // Note, that vertextList is pinned in memory
int[] indexList = primMesh.getIndexListAsIntLocked(); // Also pinned, needs release after usage
float[] vertexList = mesh.getVertexListAsFloatLocked(); // Note, that vertextList is pinned in memory
int[] indexList = mesh.getIndexListAsIntLocked(); // Also pinned, needs release after usage
//Array.Reverse(indexList);
primMesh.releaseSourceMeshData(); // free up the original mesh data to save memory
mesh.releaseSourceMeshData(); // free up the original mesh data to save memory
int VertexCount = vertexList.GetLength(0) / 3;
int IndexCount = indexList.GetLength(0);
@ -2068,17 +2078,17 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
btshapeArray.Dispose();
//Array.Reverse(indexList);
btshapeArray = new btTriangleIndexVertexArray(IndexCount / 3, indexList, (3 * sizeof(int)),
VertexCount, vertexList, 3*sizeof (float));
VertexCount, vertexList, 3 * sizeof(float));
SetCollisionShape(new btGImpactMeshShape(btshapeArray));
//((btGImpactMeshShape) prim_geom).updateBound();
((btGImpactMeshShape)prim_geom).setLocalScaling(new btVector3(1,1, 1));
((btGImpactMeshShape)prim_geom).setLocalScaling(new btVector3(1, 1, 1));
((btGImpactMeshShape)prim_geom).updateBound();
_parent_scene.SetUsingGImpact();
if (oldMesh != null)
{
oldMesh.releasePinned();
oldMesh = null;
}
//if (oldMesh != null)
//{
// oldMesh.releasePinned();
// oldMesh = null;
//}
}
@ -2102,7 +2112,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
}
*/
prim_geom = shape;
//Body.set
}
@ -2143,8 +2153,8 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
if (prim_geom is btGImpactMeshShape)
{
((btGImpactMeshShape) prim_geom).setLocalScaling(new btVector3(1, 1, 1));
((btGImpactMeshShape) prim_geom).updateBound();
((btGImpactMeshShape)prim_geom).setLocalScaling(new btVector3(1, 1, 1));
((btGImpactMeshShape)prim_geom).updateBound();
}
//Body.setCollisionFlags(Body.getCollisionFlags() | (int)ContactFlags.CF_CUSTOM_MATERIAL_CALLBACK);
//Body.setUserPointer((IntPtr) (int)m_localID);
@ -2159,7 +2169,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
{
if (chld == null)
continue;
// if (chld.NeedsMeshing())
// hasTrimesh = true;
}
@ -2167,40 +2177,40 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
//if (hasTrimesh)
//{
ProcessGeomCreationAsTriMesh(PhysicsVector.Zero, Quaternion.Identity);
// createmesh returns null when it doesn't mesh.
/*
if (_mesh is Mesh)
{
}
else
{
m_log.Warn("[PHYSICS]: Can't link a OpenSim.Region.Physics.Meshing.Mesh object");
return;
}
*/
ProcessGeomCreationAsTriMesh(PhysicsVector.Zero, Quaternion.Identity);
// createmesh returns null when it doesn't mesh.
foreach (BulletDotNETPrim chld in childrenPrim)
{
if (chld == null)
continue;
PhysicsVector offset = chld.Position - Position;
Vector3 pos = new Vector3(offset.X, offset.Y, offset.Z);
pos *= Quaternion.Inverse(Orientation);
//pos *= Orientation;
offset.setValues(pos.X, pos.Y, pos.Z);
chld.ProcessGeomCreationAsTriMesh(offset, chld.Orientation);
_mesh.Append(chld._mesh);
/*
if (_mesh is Mesh)
{
}
else
{
m_log.Warn("[PHYSICS]: Can't link a OpenSim.Region.Physics.Meshing.Mesh object");
return;
}
*/
}
setMesh(_parent_scene, _mesh);
//}
foreach (BulletDotNETPrim chld in childrenPrim)
{
if (chld == null)
continue;
PhysicsVector offset = chld.Position - Position;
Vector3 pos = new Vector3(offset.X, offset.Y, offset.Z);
pos *= Quaternion.Inverse(Orientation);
//pos *= Orientation;
offset.setValues(pos.X, pos.Y, pos.Z);
chld.ProcessGeomCreationAsTriMesh(offset, chld.Orientation);
_mesh.Append(chld._mesh);
}
setMesh(_parent_scene, _mesh);
//}
if (tempMotionState1 != null && tempMotionState1.Handle != IntPtr.Zero)
tempMotionState1.Dispose();
@ -2238,7 +2248,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
((btGImpactMeshShape)prim_geom).updateBound();
}
_parent_scene.AddPrimToScene(this);
}
if (IsPhysical)
@ -2252,7 +2262,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
if (Body.Handle != IntPtr.Zero)
{
DisableAxisMotor();
_parent_scene.removeFromWorld(this,Body);
_parent_scene.removeFromWorld(this, Body);
Body.Dispose();
}
Body = null;
@ -2305,7 +2315,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
return;
lock (childrenPrim)
{
if (!childrenPrim.Contains(prm))
@ -2313,8 +2323,8 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
childrenPrim.Add(prm);
}
}
}
public void disableBody()
@ -2386,7 +2396,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
{
Body.clearForces();
Body.forceActivationState(0);
}
}
@ -2400,7 +2410,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
Body.clearForces();
Body.forceActivationState(4);
forceenable = true;
}
m_disabled = false;
}
@ -2415,7 +2425,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
SetBody(Mass);
else
SetBody(0);
// TODO: Set Collision Category Bits and Flags
// TODO: Set Auto Disable data
@ -2587,10 +2597,10 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
_velocity.Y = tempLinearVelocity1.getY();
_velocity.Z = tempLinearVelocity1.getZ();
_acceleration = ((_velocity - m_lastVelocity)/0.1f);
_acceleration = new PhysicsVector(_velocity.X - m_lastVelocity.X/0.1f,
_velocity.Y - m_lastVelocity.Y/0.1f,
_velocity.Z - m_lastVelocity.Z/0.1f);
_acceleration = ((_velocity - m_lastVelocity) / 0.1f);
_acceleration = new PhysicsVector(_velocity.X - m_lastVelocity.X / 0.1f,
_velocity.Y - m_lastVelocity.Y / 0.1f,
_velocity.Z - m_lastVelocity.Z / 0.1f);
//m_log.Info("[PHYSICS]: V1: " + _velocity + " V2: " + m_lastVelocity + " Acceleration: " + _acceleration.ToString());
if (_velocity.IsIdentical(pv, 0.5f))
@ -2669,7 +2679,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
if (AxisLockAngleHigh != null && AxisLockAngleHigh.Handle != IntPtr.Zero)
AxisLockAngleHigh.Dispose();
m_aMotor = new btGeneric6DofConstraint(Body, _parent_scene.TerrainBody, _parent_scene.TransZero,
_parent_scene.TransZero, false);
@ -2683,7 +2693,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
m_aMotor.setLinearUpperLimit(AxisLockLinearHigh);
_parent_scene.getBulletWorld().addConstraint((btTypedConstraint)m_aMotor);
//m_aMotor.
}
internal void DisableAxisMotor()
@ -2698,4 +2708,4 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
}
}

View File

@ -40,7 +40,6 @@ namespace OpenSim.Region.Physics.Meshing
private List<Triangle> triangles;
GCHandle pinnedVirtexes;
GCHandle pinnedIndex;
public PrimMesh primMesh = null;
public float[] normals;
public Mesh()
@ -63,6 +62,8 @@ namespace OpenSim.Region.Physics.Meshing
public void Add(Triangle triangle)
{
if (pinnedIndex.IsAllocated || pinnedVirtexes.IsAllocated)
throw new NotSupportedException("Attempt to Add to a pinned Mesh");
// If a vertex of the triangle is not yet in the vertices list,
// add it and set its index to the current index count
if (!vertices.ContainsKey(triangle.v1))
@ -148,40 +149,22 @@ namespace OpenSim.Region.Physics.Meshing
public float[] getVertexListAsFloatLocked()
{
if( pinnedVirtexes.IsAllocated )
return (float[])(pinnedVirtexes.Target);
float[] result;
if (primMesh == null)
//m_log.WarnFormat("vertices.Count = {0}", vertices.Count);
result = new float[vertices.Count * 3];
foreach (KeyValuePair<Vertex, int> kvp in vertices)
{
//m_log.WarnFormat("vertices.Count = {0}", vertices.Count);
result = new float[vertices.Count * 3];
foreach (KeyValuePair<Vertex, int> kvp in vertices)
{
Vertex v = kvp.Key;
int i = kvp.Value;
//m_log.WarnFormat("kvp.Value = {0}", i);
result[3 * i + 0] = v.X;
result[3 * i + 1] = v.Y;
result[3 * i + 2] = v.Z;
}
pinnedVirtexes = GCHandle.Alloc(result, GCHandleType.Pinned);
}
else
{
int count = primMesh.coords.Count;
result = new float[count * 3];
for (int i = 0; i < count; i++)
{
Coord c = primMesh.coords[i];
{
int resultIndex = 3 * i;
result[resultIndex] = c.X;
result[resultIndex + 1] = c.Y;
result[resultIndex + 2] = c.Z;
}
}
pinnedVirtexes = GCHandle.Alloc(result, GCHandleType.Pinned);
Vertex v = kvp.Key;
int i = kvp.Value;
//m_log.WarnFormat("kvp.Value = {0}", i);
result[3 * i + 0] = v.X;
result[3 * i + 1] = v.Y;
result[3 * i + 2] = v.Z;
}
pinnedVirtexes = GCHandle.Alloc(result, GCHandleType.Pinned);
return result;
}
@ -189,33 +172,13 @@ namespace OpenSim.Region.Physics.Meshing
{
int[] result;
if (primMesh == null)
result = new int[triangles.Count * 3];
for (int i = 0; i < triangles.Count; i++)
{
result = new int[triangles.Count * 3];
for (int i = 0; i < triangles.Count; i++)
{
Triangle t = triangles[i];
result[3 * i + 0] = vertices[t.v1];
result[3 * i + 1] = vertices[t.v2];
result[3 * i + 2] = vertices[t.v3];
}
}
else
{
int numFaces = primMesh.faces.Count;
result = new int[numFaces * 3];
for (int i = 0; i < numFaces; i++)
{
Face f = primMesh.faces[i];
// Coord c1 = primMesh.coords[f.v1];
// Coord c2 = primMesh.coords[f.v2];
// Coord c3 = primMesh.coords[f.v3];
int resultIndex = i * 3;
result[resultIndex] = f.v1;
result[resultIndex + 1] = f.v2;
result[resultIndex + 2] = f.v3;
}
Triangle t = triangles[i];
result[3 * i + 0] = vertices[t.v1];
result[3 * i + 1] = vertices[t.v2];
result[3 * i + 2] = vertices[t.v3];
}
return result;
}
@ -226,6 +189,9 @@ namespace OpenSim.Region.Physics.Meshing
/// <returns></returns>
public int[] getIndexListAsIntLocked()
{
if (pinnedIndex.IsAllocated)
return (int[])(pinnedIndex.Target);
int[] result = getIndexListAsInt();
pinnedIndex = GCHandle.Alloc(result, GCHandleType.Pinned);
@ -245,11 +211,13 @@ namespace OpenSim.Region.Physics.Meshing
{
triangles = null;
vertices = null;
primMesh = null;
}
public void Append(IMesh newMesh)
{
if (pinnedIndex.IsAllocated || pinnedVirtexes.IsAllocated)
throw new NotSupportedException("Attempt to Append to a pinned Mesh");
if (!(newMesh is Mesh))
return;
@ -260,6 +228,9 @@ namespace OpenSim.Region.Physics.Meshing
// Do a linear transformation of mesh.
public void TransformLinear(float[,] matrix, float[] offset)
{
if (pinnedIndex.IsAllocated || pinnedVirtexes.IsAllocated)
throw new NotSupportedException("Attempt to TransformLinear a pinned Mesh");
foreach (Vertex v in vertices.Keys)
{
if (v == null)

View File

@ -76,6 +76,7 @@ namespace OpenSim.Region.Physics.Meshing
private float minSizeForComplexMesh = 0.2f; // prims with all dimensions smaller than this will have a bounding box mesh
private Dictionary<ulong, Mesh> m_uniqueMeshes = new Dictionary<ulong, Mesh>();
/// <summary>
/// creates a simple box mesh of the specified size. This mesh is of very low vertex count and may
@ -170,9 +171,62 @@ namespace OpenSim.Region.Physics.Meshing
}
public Mesh CreateMeshFromPrimMesher(string primName, PrimitiveBaseShape primShape, PhysicsVector size, float lod)
private ulong GetMeshKey( PrimitiveBaseShape pbs, PhysicsVector size, float lod )
{
ulong hash = 5381;
hash = djb2(hash, pbs.PathCurve);
hash = djb2(hash, (byte)((byte)pbs.HollowShape | (byte)pbs.ProfileShape));
hash = djb2(hash, pbs.PathBegin);
hash = djb2(hash, pbs.PathEnd);
hash = djb2(hash, pbs.PathScaleX);
hash = djb2(hash, pbs.PathScaleY);
hash = djb2(hash, pbs.PathShearX);
hash = djb2(hash, pbs.PathShearY);
hash = djb2(hash, (byte)pbs.PathTwist);
hash = djb2(hash, (byte)pbs.PathTwistBegin);
hash = djb2(hash, (byte)pbs.PathRadiusOffset);
hash = djb2(hash, (byte)pbs.PathTaperX);
hash = djb2(hash, (byte)pbs.PathTaperY);
hash = djb2(hash, pbs.PathRevolutions);
hash = djb2(hash, (byte)pbs.PathSkew);
hash = djb2(hash, pbs.ProfileBegin);
hash = djb2(hash, pbs.ProfileEnd);
hash = djb2(hash, pbs.ProfileHollow);
// TODO: Separate scale out from the primitive shape data (after
// scaling is supported at the physics engine level)
byte[] scaleBytes = size.GetBytes();
for (int i = 0; i < scaleBytes.Length; i++)
hash = djb2(hash, scaleBytes[i]);
// Include LOD in hash, accounting for endianness
byte[] lodBytes = new byte[4];
Buffer.BlockCopy(BitConverter.GetBytes(lod), 0, lodBytes, 0, 4);
if (!BitConverter.IsLittleEndian)
{
Array.Reverse(lodBytes, 0, 4);
}
for (int i = 0; i < lodBytes.Length; i++)
hash = djb2(hash, lodBytes[i]);
return hash;
}
private ulong djb2(ulong hash, byte c)
{
return ((hash << 5) + hash) + (ulong)c;
}
private ulong djb2(ulong hash, ushort c)
{
hash = ((hash << 5) + hash) + (ulong)((byte)c);
return ((hash << 5) + hash) + (ulong)(c >> 8);
}
private Mesh CreateMeshFromPrimMesher(string primName, PrimitiveBaseShape primShape, PhysicsVector size, float lod)
{
Mesh mesh = new Mesh();
PrimMesh primMesh;
PrimMesher.SculptMesh sculptMesh;
@ -385,8 +439,6 @@ namespace OpenSim.Region.Physics.Meshing
coords = primMesh.coords;
faces = primMesh.faces;
}
@ -401,13 +453,13 @@ namespace OpenSim.Region.Physics.Meshing
vertices.Add(new Vertex(c.X, c.Y, c.Z));
}
Mesh mesh = new Mesh();
// Add the corresponding triangles to the mesh
for (int i = 0; i < numFaces; i++)
{
Face f = faces[i];
mesh.Add(new Triangle(vertices[f.v1], vertices[f.v2], vertices[f.v3]));
}
return mesh;
}
@ -418,7 +470,12 @@ namespace OpenSim.Region.Physics.Meshing
public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, PhysicsVector size, float lod, bool isPhysical)
{
// If this mesh has been created already, return it instead of creating another copy
// For large regions with 100k+ prims and hundreds of copies of each, this can save a GB or more of memory
ulong key = GetMeshKey(primShape, size, lod);
Mesh mesh = null;
if (m_uniqueMeshes.TryGetValue(key, out mesh))
return mesh;
if (size.X < 0.01f) size.X = 0.01f;
if (size.Y < 0.01f) size.Y = 0.01f;
@ -441,7 +498,7 @@ namespace OpenSim.Region.Physics.Meshing
// trim the vertex and triangle lists to free up memory
mesh.TrimExcess();
}
m_uniqueMeshes.Add(key, mesh);
return mesh;
}
}

View File

@ -82,7 +82,6 @@ namespace OpenSim.Region.Physics.OdePlugin
// private float m_tensor = 5f;
private int body_autodisable_frames = 20;
private IMesh primMesh = null;
private const CollisionCategories m_default_collisionFlags = (CollisionCategories.Geom
@ -814,14 +813,10 @@ namespace OpenSim.Region.Physics.OdePlugin
}
}
IMesh oldMesh = primMesh;
float[] vertexList = mesh.getVertexListAsFloatLocked(); // Note, that vertextList is pinned in memory
int[] indexList = mesh.getIndexListAsIntLocked(); // Also pinned, needs release after usage
primMesh = mesh;
float[] vertexList = primMesh.getVertexListAsFloatLocked(); // Note, that vertextList is pinned in memory
int[] indexList = primMesh.getIndexListAsIntLocked(); // Also pinned, needs release after usage
primMesh.releaseSourceMeshData(); // free up the original mesh data to save memory
mesh.releaseSourceMeshData(); // free up the original mesh data to save memory
int VertexCount = vertexList.GetLength(0)/3;
int IndexCount = indexList.GetLength(0);
@ -847,12 +842,6 @@ namespace OpenSim.Region.Physics.OdePlugin
return;
}
if (oldMesh != null)
{
oldMesh.releasePinned();
oldMesh = null;
}
// if (IsPhysical && Body == (IntPtr) 0)
// {
// Recreate the body

View File

@ -258,6 +258,8 @@ namespace OpenSim.Server.Base
public static Dictionary<string, object> ParseXmlResponse(string data)
{
//m_log.DebugFormat("[XXX]: received xml string: {0}", data);
Dictionary<string, object> ret = new Dictionary<string, object>();
XmlDocument doc = new XmlDocument();
@ -284,7 +286,7 @@ namespace OpenSim.Server.Base
foreach (XmlNode part in partL)
{
XmlNode type = part.Attributes.GetNamedItem("Type");
XmlNode type = part.Attributes.GetNamedItem("type");
if (type == null || type.Value != "List")
{
ret[part.Name] = part.InnerText;

View File

@ -45,7 +45,7 @@ namespace OpenSim.Server.Handlers.Grid
if (serverConfig == null)
throw new Exception("No section 'Server' in config file");
string gridService = serverConfig.GetString("GridServiceModule",
string gridService = serverConfig.GetString("LocalServiceModule",
String.Empty);
if (gridService == String.Empty)

View File

@ -63,7 +63,10 @@ namespace OpenSim.Server.Handlers.Grid
StreamReader sr = new StreamReader(requestData);
string body = sr.ReadToEnd();
sr.Close();
body = body.Trim();
//m_log.DebugFormat("[XXX]: query String: {0}", body);
Dictionary<string, string> request =
ServerUtils.ParseQueryString(body);
@ -98,11 +101,11 @@ namespace OpenSim.Server.Handlers.Grid
case "get_region_range":
return GetRegionRange(request);
default:
m_log.DebugFormat("[GRID HANDLER]: unknown method request {0}", method);
return FailureResult();
}
m_log.DebugFormat("[GRID HANDLER]: unknown method {0} request {1}", method.Length, method);
return FailureResult();
}
#region Method-specific handlers
@ -155,22 +158,29 @@ namespace OpenSim.Server.Handlers.Grid
UUID regionID = UUID.Zero;
if (request["REGIONID"] != null)
UUID.TryParse(request["REGIONID"], out scopeID);
UUID.TryParse(request["REGIONID"], out regionID);
else
m_log.WarnFormat("[GRID HANDLER]: no regionID in request to get neighbours");
List<GridRegion> rinfos = m_GridService.GetNeighbours(scopeID, regionID);
//m_log.DebugFormat("[GRID HANDLER]: neighbours for region {0}: {1}", regionID, rinfos.Count);
Dictionary<string, object> result = new Dictionary<string, object>();
int i = 0;
foreach (GridRegion rinfo in rinfos)
if ((rinfos == null) || ((rinfos != null) && (rinfos.Count == 0)))
result["result"] = "null";
else
{
Dictionary<string, object> rinfoDict = rinfo.ToKeyValuePairs();
result["region" + i] = rinfoDict;
i++;
int i = 0;
foreach (GridRegion rinfo in rinfos)
{
Dictionary<string, object> rinfoDict = rinfo.ToKeyValuePairs();
result["region" + i] = rinfoDict;
i++;
}
}
string xmlString = ServerUtils.BuildXmlResponse(result);
//m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString);
UTF8Encoding encoding = new UTF8Encoding();
return encoding.GetBytes(xmlString);
@ -178,32 +188,185 @@ namespace OpenSim.Server.Handlers.Grid
byte[] GetRegionByUUID(Dictionary<string, string> request)
{
// TODO
return new byte[0];
UUID scopeID = UUID.Zero;
if (request["SCOPEID"] != null)
UUID.TryParse(request["SCOPEID"], out scopeID);
else
m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get neighbours");
UUID regionID = UUID.Zero;
if (request["REGIONID"] != null)
UUID.TryParse(request["REGIONID"], out regionID);
else
m_log.WarnFormat("[GRID HANDLER]: no regionID in request to get neighbours");
GridRegion rinfo = m_GridService.GetRegionByUUID(scopeID, regionID);
//m_log.DebugFormat("[GRID HANDLER]: neighbours for region {0}: {1}", regionID, rinfos.Count);
Dictionary<string, object> result = new Dictionary<string, object>();
if (rinfo == null)
result["result"] = "null";
else
result["result"] = rinfo.ToKeyValuePairs();
string xmlString = ServerUtils.BuildXmlResponse(result);
//m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString);
UTF8Encoding encoding = new UTF8Encoding();
return encoding.GetBytes(xmlString);
}
byte[] GetRegionByPosition(Dictionary<string, string> request)
{
// TODO
return new byte[0];
UUID scopeID = UUID.Zero;
if (request["SCOPEID"] != null)
UUID.TryParse(request["SCOPEID"], out scopeID);
else
m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get region by position");
int x = 0, y = 0;
if (request["X"] != null)
Int32.TryParse(request["X"], out x);
else
m_log.WarnFormat("[GRID HANDLER]: no X in request to get region by position");
if (request["Y"] != null)
Int32.TryParse(request["Y"], out y);
else
m_log.WarnFormat("[GRID HANDLER]: no Y in request to get region by position");
GridRegion rinfo = m_GridService.GetRegionByPosition(scopeID, x, y);
//m_log.DebugFormat("[GRID HANDLER]: neighbours for region {0}: {1}", regionID, rinfos.Count);
Dictionary<string, object> result = new Dictionary<string, object>();
if (rinfo == null)
result["result"] = "null";
else
result["result"] = rinfo.ToKeyValuePairs();
string xmlString = ServerUtils.BuildXmlResponse(result);
//m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString);
UTF8Encoding encoding = new UTF8Encoding();
return encoding.GetBytes(xmlString);
}
byte[] GetRegionByName(Dictionary<string, string> request)
{
// TODO
return new byte[0];
UUID scopeID = UUID.Zero;
if (request["SCOPEID"] != null)
UUID.TryParse(request["SCOPEID"], out scopeID);
else
m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get region by name");
string regionName = string.Empty;
if (request["NAME"] != null)
regionName = request["NAME"];
else
m_log.WarnFormat("[GRID HANDLER]: no name in request to get region by name");
GridRegion rinfo = m_GridService.GetRegionByName(scopeID, regionName);
//m_log.DebugFormat("[GRID HANDLER]: neighbours for region {0}: {1}", regionID, rinfos.Count);
Dictionary<string, object> result = new Dictionary<string, object>();
if (rinfo == null)
result["result"] = "null";
else
result["result"] = rinfo.ToKeyValuePairs();
string xmlString = ServerUtils.BuildXmlResponse(result);
//m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString);
UTF8Encoding encoding = new UTF8Encoding();
return encoding.GetBytes(xmlString);
}
byte[] GetRegionsByName(Dictionary<string, string> request)
{
// TODO
return new byte[0];
UUID scopeID = UUID.Zero;
if (request["SCOPEID"] != null)
UUID.TryParse(request["SCOPEID"], out scopeID);
else
m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get regions by name");
string regionName = string.Empty;
if (request["NAME"] != null)
regionName = request["NAME"];
else
m_log.WarnFormat("[GRID HANDLER]: no NAME in request to get regions by name");
int max = 0;
if (request["MAX"] != null)
Int32.TryParse(request["MAX"], out max);
else
m_log.WarnFormat("[GRID HANDLER]: no MAX in request to get regions by name");
List<GridRegion> rinfos = m_GridService.GetRegionsByName(scopeID, regionName, max);
//m_log.DebugFormat("[GRID HANDLER]: neighbours for region {0}: {1}", regionID, rinfos.Count);
Dictionary<string, object> result = new Dictionary<string, object>();
if ((rinfos == null) || ((rinfos != null) && (rinfos.Count == 0)))
result["result"] = "null";
else
{
int i = 0;
foreach (GridRegion rinfo in rinfos)
{
Dictionary<string, object> rinfoDict = rinfo.ToKeyValuePairs();
result["region" + i] = rinfoDict;
i++;
}
}
string xmlString = ServerUtils.BuildXmlResponse(result);
//m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString);
UTF8Encoding encoding = new UTF8Encoding();
return encoding.GetBytes(xmlString);
}
byte[] GetRegionRange(Dictionary<string, string> request)
{
// TODO
return new byte[0];
//m_log.DebugFormat("[GRID HANDLER]: GetRegionRange");
UUID scopeID = UUID.Zero;
if (request.ContainsKey("SCOPEID"))
UUID.TryParse(request["SCOPEID"], out scopeID);
else
m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get region range");
int xmin = 0, xmax = 0, ymin = 0, ymax = 0;
if (request.ContainsKey("XMIN"))
Int32.TryParse(request["XMIN"], out xmin);
else
m_log.WarnFormat("[GRID HANDLER]: no XMIN in request to get region range");
if (request.ContainsKey("XMAX"))
Int32.TryParse(request["XMAX"], out xmax);
else
m_log.WarnFormat("[GRID HANDLER]: no XMAX in request to get region range");
if (request.ContainsKey("YMIN"))
Int32.TryParse(request["YMIN"], out ymin);
else
m_log.WarnFormat("[GRID HANDLER]: no YMIN in request to get region range");
if (request.ContainsKey("YMAX"))
Int32.TryParse(request["YMAX"], out ymax);
else
m_log.WarnFormat("[GRID HANDLER]: no YMAX in request to get region range");
List<GridRegion> rinfos = m_GridService.GetRegionRange(scopeID, xmin, xmax, ymin, ymax);
Dictionary<string, object> result = new Dictionary<string, object>();
if ((rinfos == null) || ((rinfos != null) && (rinfos.Count == 0)))
result["result"] = "null";
else
{
int i = 0;
foreach (GridRegion rinfo in rinfos)
{
Dictionary<string, object> rinfoDict = rinfo.ToKeyValuePairs();
result["region" + i] = rinfoDict;
i++;
}
}
string xmlString = ServerUtils.BuildXmlResponse(result);
//m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString);
UTF8Encoding encoding = new UTF8Encoding();
return encoding.GetBytes(xmlString);
}
#endregion

View File

@ -97,14 +97,27 @@ namespace OpenSim.Services.Connectors
sendData["METHOD"] = "register";
string reply = SynchronousRestFormsRequester.MakeRequest("POST",
m_ServerURI + "/grid",
ServerUtils.BuildQueryString(sendData));
string reqString = ServerUtils.BuildQueryString(sendData);
//m_log.DebugFormat("[GRID CONNECTOR]: queryString = {0}", reqString);
try
{
string reply = SynchronousRestFormsRequester.MakeRequest("POST",
m_ServerURI + "/grid",
reqString);
if (reply != string.Empty)
{
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
if ((replyData["Result"] != null) && (replyData["Result"].ToString().ToLower() == "success"))
return true;
if ((replyData["Result"] != null) && (replyData["Result"].ToString().ToLower() == "success"))
return true;
}
else
m_log.DebugFormat("[GRID CONNECTOR]: RegisterRegion received null reply");
}
catch (Exception e)
{
m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message);
}
return false;
}
@ -117,14 +130,26 @@ namespace OpenSim.Services.Connectors
sendData["METHOD"] = "deregister";
string reply = SynchronousRestFormsRequester.MakeRequest("POST",
m_ServerURI + "/grid",
ServerUtils.BuildQueryString(sendData));
try
{
string reply = SynchronousRestFormsRequester.MakeRequest("POST",
m_ServerURI + "/grid",
ServerUtils.BuildQueryString(sendData));
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
if (reply != string.Empty)
{
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
if ((replyData["Result"] != null) && (replyData["Result"].ToString().ToLower() == "success"))
return true;
if ((replyData["Result"] != null) && (replyData["Result"].ToString().ToLower() == "success"))
return true;
}
else
m_log.DebugFormat("[GRID CONNECTOR]: DeregisterRegion received null reply");
}
catch (Exception e)
{
m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message);
}
return false;
}
@ -138,16 +163,28 @@ namespace OpenSim.Services.Connectors
sendData["METHOD"] = "get_neighbours";
string reply = SynchronousRestFormsRequester.MakeRequest("POST",
m_ServerURI + "/grid",
ServerUtils.BuildQueryString(sendData));
List<GridRegion> rinfos = new List<GridRegion>();
string reqString = ServerUtils.BuildQueryString(sendData);
string reply = string.Empty;
try
{
reply = SynchronousRestFormsRequester.MakeRequest("POST",
m_ServerURI + "/grid",
reqString);
}
catch (Exception e)
{
m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message);
return rinfos;
}
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
List<GridRegion> rinfos = new List<GridRegion>();
if (replyData != null)
{
Dictionary<string, object>.ValueCollection rinfosList = replyData.Values;
//m_log.DebugFormat("[GRID CONNECTOR]: get neighbours returned {0} elements", rinfosList.Count);
foreach (object r in rinfosList)
{
if (r is Dictionary<string, object>)
@ -156,8 +193,8 @@ namespace OpenSim.Services.Connectors
rinfos.Add(rinfo);
}
else
m_log.DebugFormat("[GRID CONNECTOR]: GetNeighbours {0}, {1} received invalid response",
scopeID, regionID);
m_log.DebugFormat("[GRID CONNECTOR]: GetNeighbours {0}, {1} received invalid response type {2}",
scopeID, regionID, r.GetType());
}
}
else
@ -176,24 +213,39 @@ namespace OpenSim.Services.Connectors
sendData["METHOD"] = "get_region_by_uuid";
string reply = SynchronousRestFormsRequester.MakeRequest("POST",
m_ServerURI + "/grid",
ServerUtils.BuildQueryString(sendData));
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
string reply = string.Empty;
try
{
reply = SynchronousRestFormsRequester.MakeRequest("POST",
m_ServerURI + "/grid",
ServerUtils.BuildQueryString(sendData));
}
catch (Exception e)
{
m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message);
return null;
}
GridRegion rinfo = null;
if ((replyData != null) && (replyData["result"] != null))
if (reply != string.Empty)
{
if (replyData["result"] is Dictionary<string, object>)
rinfo = new GridRegion((Dictionary<string, object>)replyData["result"]);
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
if ((replyData != null) && (replyData["result"] != null))
{
if (replyData["result"] is Dictionary<string, object>)
rinfo = new GridRegion((Dictionary<string, object>)replyData["result"]);
//else
// m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByUUID {0}, {1} received null response",
// scopeID, regionID);
}
else
m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByUUID {0}, {1} received invalid response",
m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByUUID {0}, {1} received null response",
scopeID, regionID);
}
else
m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByUUID {0}, {1} received null response",
scopeID, regionID);
m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByUUID received null reply");
return rinfo;
}
@ -207,25 +259,38 @@ namespace OpenSim.Services.Connectors
sendData["Y"] = y.ToString();
sendData["METHOD"] = "get_region_by_position";
string reply = SynchronousRestFormsRequester.MakeRequest("POST",
m_ServerURI + "/grid",
ServerUtils.BuildQueryString(sendData));
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
string reply = string.Empty;
try
{
reply = SynchronousRestFormsRequester.MakeRequest("POST",
m_ServerURI + "/grid",
ServerUtils.BuildQueryString(sendData));
}
catch (Exception e)
{
m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message);
return null;
}
GridRegion rinfo = null;
if ((replyData != null) && (replyData["result"] != null))
if (reply != string.Empty)
{
if (replyData["result"] is Dictionary<string, object>)
rinfo = new GridRegion((Dictionary<string, object>)replyData["result"]);
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
if ((replyData != null) && (replyData["result"] != null))
{
if (replyData["result"] is Dictionary<string, object>)
rinfo = new GridRegion((Dictionary<string, object>)replyData["result"]);
else
m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition {0}, {1}-{2} received invalid response",
scopeID, x, y);
}
else
m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition {0}, {1}-{2} received invalid response",
m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition {0}, {1}-{2} received null response",
scopeID, x, y);
}
else
m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition {0}, {1}-{2} received null response",
scopeID, x, y);
m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition received null reply");
return rinfo;
}
@ -238,25 +303,35 @@ namespace OpenSim.Services.Connectors
sendData["NAME"] = regionName;
sendData["METHOD"] = "get_region_by_name";
string reply = SynchronousRestFormsRequester.MakeRequest("POST",
m_ServerURI + "/grid",
ServerUtils.BuildQueryString(sendData));
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
string reply = string.Empty;
try
{
reply = SynchronousRestFormsRequester.MakeRequest("POST",
m_ServerURI + "/grid",
ServerUtils.BuildQueryString(sendData));
}
catch (Exception e)
{
m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message);
return null;
}
GridRegion rinfo = null;
if ((replyData != null) && (replyData["result"] != null))
if (reply != string.Empty)
{
if (replyData["result"] is Dictionary<string, object>)
rinfo = new GridRegion((Dictionary<string, object>)replyData["result"]);
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
if ((replyData != null) && (replyData["result"] != null))
{
if (replyData["result"] is Dictionary<string, object>)
rinfo = new GridRegion((Dictionary<string, object>)replyData["result"]);
}
else
m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition {0}, {1} received invalid response",
m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition {0}, {1} received null response",
scopeID, regionName);
}
else
m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition {0}, {1} received null response",
scopeID, regionName);
m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByName received null reply");
return rinfo;
}
@ -270,32 +345,45 @@ namespace OpenSim.Services.Connectors
sendData["MAX"] = maxNumber.ToString();
sendData["METHOD"] = "get_regions_by_name";
string reply = SynchronousRestFormsRequester.MakeRequest("POST",
m_ServerURI + "/grid",
ServerUtils.BuildQueryString(sendData));
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
List<GridRegion> rinfos = new List<GridRegion>();
if (replyData != null)
string reply = string.Empty;
try
{
Dictionary<string, object>.ValueCollection rinfosList = replyData.Values;
foreach (object r in rinfosList)
reply = SynchronousRestFormsRequester.MakeRequest("POST",
m_ServerURI + "/grid",
ServerUtils.BuildQueryString(sendData));
}
catch (Exception e)
{
m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message);
return rinfos;
}
if (reply != string.Empty)
{
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
if (replyData != null)
{
if (r is Dictionary<string, object>)
Dictionary<string, object>.ValueCollection rinfosList = replyData.Values;
foreach (object r in rinfosList)
{
GridRegion rinfo = new GridRegion((Dictionary<string, object>)r);
rinfos.Add(rinfo);
if (r is Dictionary<string, object>)
{
GridRegion rinfo = new GridRegion((Dictionary<string, object>)r);
rinfos.Add(rinfo);
}
else
m_log.DebugFormat("[GRID CONNECTOR]: GetRegionsByName {0}, {1}, {2} received invalid response",
scopeID, name, maxNumber);
}
else
m_log.DebugFormat("[GRID CONNECTOR]: GetRegionsByName {0}, {1}, {2} received invalid response",
scopeID, name, maxNumber);
}
else
m_log.DebugFormat("[GRID CONNECTOR]: GetRegionsByName {0}, {1}, {2} received null response",
scopeID, name, maxNumber);
}
else
m_log.DebugFormat("[GRID CONNECTOR]: GetRegionsByName {0}, {1}, {2} received null response",
scopeID, name, maxNumber);
m_log.DebugFormat("[GRID CONNECTOR]: GetRegionsByName received null reply");
return rinfos;
}
@ -312,31 +400,44 @@ namespace OpenSim.Services.Connectors
sendData["METHOD"] = "get_region_range";
string reply = SynchronousRestFormsRequester.MakeRequest("POST",
m_ServerURI + "/grid",
ServerUtils.BuildQueryString(sendData));
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
List<GridRegion> rinfos = new List<GridRegion>();
if (replyData != null)
string reply = string.Empty;
try
{
Dictionary<string, object>.ValueCollection rinfosList = replyData.Values;
foreach (object r in rinfosList)
reply = SynchronousRestFormsRequester.MakeRequest("POST",
m_ServerURI + "/grid",
ServerUtils.BuildQueryString(sendData));
//m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply);
}
catch (Exception e)
{
m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message);
return rinfos;
}
if (reply != string.Empty)
{
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
if (replyData != null)
{
if (r is Dictionary<string, object>)
Dictionary<string, object>.ValueCollection rinfosList = replyData.Values;
foreach (object r in rinfosList)
{
GridRegion rinfo = new GridRegion((Dictionary<string, object>)r);
rinfos.Add(rinfo);
if (r is Dictionary<string, object>)
{
GridRegion rinfo = new GridRegion((Dictionary<string, object>)r);
rinfos.Add(rinfo);
}
}
else
m_log.DebugFormat("[GRID CONNECTOR]: GetRegionRange {0}, {1}-{2} {3}-{4} received invalid response",
scopeID, xmin, xmax, ymin, ymax);
}
else
m_log.DebugFormat("[GRID CONNECTOR]: GetRegionRange {0}, {1}-{2} {3}-{4} received null response",
scopeID, xmin, xmax, ymin, ymax);
}
else
m_log.DebugFormat("[GRID CONNECTOR]: GetRegionRange {0}, {1}-{2} {3}-{4} received null response",
scopeID, xmin, xmax, ymin, ymax);
m_log.DebugFormat("[GRID CONNECTOR]: GetRegionRange received null reply");
return rinfos;
}

View File

@ -50,35 +50,27 @@ namespace OpenSim.Services.GridService
: base(config)
{
m_log.DebugFormat("[GRID SERVICE]: Starting...");
MainConsole.Instance.Commands.AddCommand("kfs", false,
"show digest",
"show digest <ID>",
"Show asset digest", HandleShowDigest);
MainConsole.Instance.Commands.AddCommand("kfs", false,
"delete asset",
"delete asset <ID>",
"Delete asset from database", HandleDeleteAsset);
}
#region IGridService
public bool RegisterRegion(UUID scopeID, GridRegion regionInfos)
{
if (m_Database.Get(regionInfos.RegionID, scopeID) != null)
{
m_log.WarnFormat("[GRID SERVICE]: Region {0} already registered in scope {1}.", regionInfos.RegionID, scopeID);
return false;
}
// This needs better sanity testing. What if regionInfo is registering in
// overlapping coords?
if (m_Database.Get(regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID) != null)
RegionData region = m_Database.Get(regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID);
if ((region != null) && (region.RegionID != regionInfos.RegionID))
{
m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register in coordinates {1}, {2} which are already in use in scope {3}.",
regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID);
return false;
}
if ((region != null) && (region.RegionID == regionInfos.RegionID) &&
((region.posX != regionInfos.RegionLocX) || (region.posY != regionInfos.RegionLocY)))
{
// Region reregistering in other coordinates. Delete the old entry
m_Database.Delete(regionInfos.RegionID);
}
// Everything is ok, let's register
RegionData rdata = RegionInfo2RegionData(regionInfos);
@ -183,9 +175,9 @@ namespace OpenSim.Services.GridService
rdata.posX = (int)rinfo.RegionLocX;
rdata.posY = (int)rinfo.RegionLocY;
rdata.RegionID = rinfo.RegionID;
rdata.Data = rinfo.ToKeyValuePairs();
rdata.RegionName = rinfo.RegionName;
rdata.Data = rinfo.ToKeyValuePairs();
rdata.Data["regionHandle"] = Utils.UIntsToLong((uint)rdata.posX, (uint)rdata.posY);
return rdata;
}
@ -196,73 +188,12 @@ namespace OpenSim.Services.GridService
rinfo.RegionLocY = rdata.posY;
rinfo.RegionID = rdata.RegionID;
rinfo.RegionName = rdata.RegionName;
rinfo.ScopeID = rdata.ScopeID;
return rinfo;
}
#endregion
void HandleShowDigest(string module, string[] args)
{
//if (args.Length < 3)
//{
// MainConsole.Instance.Output("Syntax: show digest <ID>");
// return;
//}
//AssetBase asset = Get(args[2]);
//if (asset == null || asset.Data.Length == 0)
//{
// MainConsole.Instance.Output("Asset not found");
// return;
//}
//int i;
//MainConsole.Instance.Output(String.Format("Name: {0}", asset.Name));
//MainConsole.Instance.Output(String.Format("Description: {0}", asset.Description));
//MainConsole.Instance.Output(String.Format("Type: {0}", asset.Type));
//MainConsole.Instance.Output(String.Format("Content-type: {0}", asset.Metadata.ContentType));
//for (i = 0 ; i < 5 ; i++)
//{
// int off = i * 16;
// if (asset.Data.Length <= off)
// break;
// int len = 16;
// if (asset.Data.Length < off + len)
// len = asset.Data.Length - off;
// byte[] line = new byte[len];
// Array.Copy(asset.Data, off, line, 0, len);
// string text = BitConverter.ToString(line);
// MainConsole.Instance.Output(String.Format("{0:x4}: {1}", off, text));
//}
}
void HandleDeleteAsset(string module, string[] args)
{
//if (args.Length < 3)
//{
// MainConsole.Instance.Output("Syntax: delete asset <ID>");
// return;
//}
//AssetBase asset = Get(args[2]);
//if (asset == null || asset.Data.Length == 0)
// MainConsole.Instance.Output("Asset not found");
// return;
//}
//Delete(args[2]);
////MainConsole.Instance.Output("Asset deleted");
//// TODO: Implement this
//MainConsole.Instance.Output("Asset deletion not supported by database");
}
}
}

View File

@ -263,59 +263,55 @@ namespace OpenSim.Services.Interfaces
kvp["uuid"] = RegionID.ToString();
kvp["locX"] = RegionLocX.ToString();
kvp["locY"] = RegionLocY.ToString();
kvp["external_ip_address"] = ExternalEndPoint.Address.ToString();
kvp["external_port"] = ExternalEndPoint.Port.ToString();
kvp["external_host_name"] = ExternalHostName;
kvp["http_port"] = HttpPort.ToString();
kvp["internal_ip_address"] = InternalEndPoint.Address.ToString();
kvp["internal_port"] = InternalEndPoint.Port.ToString();
kvp["alternate_ports"] = m_allow_alternate_ports.ToString();
kvp["server_uri"] = ServerURI;
kvp["regionName"] = RegionName;
kvp["serverIP"] = ExternalHostName; //ExternalEndPoint.Address.ToString();
kvp["serverHttpPort"] = HttpPort.ToString();
kvp["serverURI"] = ServerURI;
kvp["serverPort"] = InternalEndPoint.Port.ToString();
return kvp;
}
public GridRegion(Dictionary<string, object> kvp)
{
if ((kvp["external_ip_address"] != null) && (kvp["external_port"] != null))
if (kvp.ContainsKey("uuid"))
RegionID = new UUID((string)kvp["uuid"]);
if (kvp.ContainsKey("locX"))
RegionLocX = Convert.ToInt32((string)kvp["locX"]);
if (kvp.ContainsKey("locY"))
RegionLocY = Convert.ToInt32((string)kvp["locY"]);
if (kvp.ContainsKey("regionName"))
RegionName = (string)kvp["regionName"];
if (kvp.ContainsKey("serverIP"))
{
int port = 0;
Int32.TryParse((string)kvp["external_port"], out port);
IPEndPoint ep = new IPEndPoint(IPAddress.Parse((string)kvp["external_ip_address"]), port);
ExternalEndPoint = ep;
//int port = 0;
//Int32.TryParse((string)kvp["serverPort"], out port);
//IPEndPoint ep = new IPEndPoint(IPAddress.Parse((string)kvp["serverIP"]), port);
ExternalHostName = (string)kvp["serverIP"];
}
else
ExternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0);
ExternalHostName = "127.0.0.1";
if (kvp["external_host_name"] != null)
ExternalHostName = (string)kvp["external_host_name"];
if (kvp.ContainsKey("serverPort"))
{
Int32 port = 0;
Int32.TryParse((string)kvp["serverPort"], out port);
InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), port);
}
if (kvp["http_port"] != null)
if (kvp.ContainsKey("serverHttpPort"))
{
UInt32 port = 0;
UInt32.TryParse((string)kvp["http_port"], out port);
UInt32.TryParse((string)kvp["serverHttpPort"], out port);
HttpPort = port;
}
if ((kvp["internal_ip_address"] != null) && (kvp["internal_port"] != null))
{
int port = 0;
Int32.TryParse((string)kvp["internal_port"], out port);
IPEndPoint ep = new IPEndPoint(IPAddress.Parse((string)kvp["internal_ip_address"]), port);
InternalEndPoint = ep;
}
else
InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0);
if (kvp["alternate_ports"] != null)
{
bool alts = false;
Boolean.TryParse((string)kvp["alternate_ports"], out alts);
m_allow_alternate_ports = alts;
}
if (kvp["server_uri"] != null)
ServerURI = (string)kvp["server_uri"];
if (kvp.ContainsKey("serverURI"))
ServerURI = (string)kvp["serverURI"];
}
}

View File

@ -0,0 +1,177 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
using OpenMetaverse;
using log4net;
using log4net.Appender;
using log4net.Layout;
using OpenSim.Framework;
using OpenSim.Services.Interfaces;
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
using OpenSim.Services.Connectors;
namespace OpenSim.Tests.Clients.GridClient
{
public class GridClient
{
private static readonly ILog m_log =
LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType);
public static void Main(string[] args)
{
ConsoleAppender consoleAppender = new ConsoleAppender();
consoleAppender.Layout =
new PatternLayout("%date [%thread] %-5level %logger [%property{NDC}] - %message%newline");
log4net.Config.BasicConfigurator.Configure(consoleAppender);
string serverURI = "http://127.0.0.1:8002";
GridServicesConnector m_Connector = new GridServicesConnector(serverURI);
GridRegion r1 = CreateRegion("Test Region 1", 1000, 1000);
GridRegion r2 = CreateRegion("Test Region 2", 1001, 1000);
GridRegion r3 = CreateRegion("Test Region 3", 1005, 1000);
Console.WriteLine("[GRID CLIENT]: *** Registering region 1");
bool success = m_Connector.RegisterRegion(UUID.Zero, r1);
if (success)
Console.WriteLine("[GRID CLIENT]: Successfully registered region 1");
else
Console.WriteLine("[GRID CLIENT]: region 1 failed to register");
Console.WriteLine("[GRID CLIENT]: *** Registering region 2");
success = m_Connector.RegisterRegion(UUID.Zero, r2);
if (success)
Console.WriteLine("[GRID CLIENT]: Successfully registered region 2");
else
Console.WriteLine("[GRID CLIENT]: region 2 failed to register");
Console.WriteLine("[GRID CLIENT]: *** Registering region 3");
success = m_Connector.RegisterRegion(UUID.Zero, r3);
if (success)
Console.WriteLine("[GRID CLIENT]: Successfully registered region 3");
else
Console.WriteLine("[GRID CLIENT]: region 3 failed to register");
Console.WriteLine("[GRID CLIENT]: *** Deregistering region 3");
success = m_Connector.DeregisterRegion(r3.RegionID);
if (success)
Console.WriteLine("[GRID CLIENT]: Successfully deregistered region 3");
else
Console.WriteLine("[GRID CLIENT]: region 3 failed to deregister");
Console.WriteLine("[GRID CLIENT]: *** Registering region 3 again");
success = m_Connector.RegisterRegion(UUID.Zero, r3);
if (success)
Console.WriteLine("[GRID CLIENT]: Successfully registered region 3");
else
Console.WriteLine("[GRID CLIENT]: region 3 failed to register");
Console.WriteLine("[GRID CLIENT]: *** GetNeighbours of region 1");
List<GridRegion> regions = m_Connector.GetNeighbours(UUID.Zero, r1.RegionID);
if (regions == null)
Console.WriteLine("[GRID CLIENT]: GetNeighbours of region 1 failed");
else if (regions.Count > 0)
{
if (regions.Count != 1)
Console.WriteLine("[GRID CLIENT]: GetNeighbours of region 1 returned more neighbours than expected: " + regions.Count);
else
Console.WriteLine("[GRID CLIENT]: GetNeighbours of region 1 returned the right neighbour " + regions[0].RegionName);
}
else
Console.WriteLine("[GRID CLIENT]: GetNeighbours of region 1 returned 0 neighbours");
Console.WriteLine("[GRID CLIENT]: *** GetRegionByUUID of region 2 (this should succeed)");
GridRegion region = m_Connector.GetRegionByUUID(UUID.Zero, r2.RegionID);
if (region == null)
Console.WriteLine("[GRID CLIENT]: GetRegionByUUID returned null");
else
Console.WriteLine("[GRID CLIENT]: GetRegionByUUID returned region " + region.RegionName);
Console.WriteLine("[GRID CLIENT]: *** GetRegionByUUID of non-existent region (this should fail)");
region = m_Connector.GetRegionByUUID(UUID.Zero, UUID.Random());
if (region == null)
Console.WriteLine("[GRID CLIENT]: GetRegionByUUID returned null");
else
Console.WriteLine("[GRID CLIENT]: GetRegionByUUID returned region " + region.RegionName);
Console.WriteLine("[GRID CLIENT]: *** GetRegionByName of region 3 (this should succeed)");
region = m_Connector.GetRegionByName(UUID.Zero, r3.RegionName);
if (region == null)
Console.WriteLine("[GRID CLIENT]: GetRegionByName returned null");
else
Console.WriteLine("[GRID CLIENT]: GetRegionByName returned region " + region.RegionName);
Console.WriteLine("[GRID CLIENT]: *** GetRegionByName of non-existent region (this should fail)");
region = m_Connector.GetRegionByName(UUID.Zero, "Foo");
if (region == null)
Console.WriteLine("[GRID CLIENT]: GetRegionByName returned null");
else
Console.WriteLine("[GRID CLIENT]: GetRegionByName returned region " + region.RegionName);
Console.WriteLine("[GRID CLIENT]: *** GetRegionsByName (this should return 3 regions)");
regions = m_Connector.GetRegionsByName(UUID.Zero, "Test", 10);
if (regions == null)
Console.WriteLine("[GRID CLIENT]: GetRegionsByName returned null");
else
Console.WriteLine("[GRID CLIENT]: GetRegionsByName returned " + regions.Count + " regions");
Console.WriteLine("[GRID CLIENT]: *** GetRegionRange (this should return 2 regions)");
regions = m_Connector.GetRegionRange(UUID.Zero,
900 * (int)Constants.RegionSize, 1002 * (int) Constants.RegionSize,
900 * (int)Constants.RegionSize, 1002 * (int) Constants.RegionSize);
if (regions == null)
Console.WriteLine("[GRID CLIENT]: GetRegionRange returned null");
else
Console.WriteLine("[GRID CLIENT]: GetRegionRange returned " + regions.Count + " regions");
Console.WriteLine("[GRID CLIENT]: *** GetRegionRange (this should return 0 regions)");
regions = m_Connector.GetRegionRange(UUID.Zero,
900 * (int)Constants.RegionSize, 950 * (int)Constants.RegionSize,
900 * (int)Constants.RegionSize, 950 * (int)Constants.RegionSize);
if (regions == null)
Console.WriteLine("[GRID CLIENT]: GetRegionRange returned null");
else
Console.WriteLine("[GRID CLIENT]: GetRegionRange returned " + regions.Count + " regions");
Console.Write("Proceed to deregister? Press enter...");
Console.ReadLine();
// Deregister them all
Console.WriteLine("[GRID CLIENT]: *** Deregistering region 1");
success = m_Connector.DeregisterRegion(r1.RegionID);
if (success)
Console.WriteLine("[GRID CLIENT]: Successfully deregistered region 1");
else
Console.WriteLine("[GRID CLIENT]: region 1 failed to deregister");
Console.WriteLine("[GRID CLIENT]: *** Deregistering region 2");
success = m_Connector.DeregisterRegion(r2.RegionID);
if (success)
Console.WriteLine("[GRID CLIENT]: Successfully deregistered region 2");
else
Console.WriteLine("[GRID CLIENT]: region 2 failed to deregister");
Console.WriteLine("[GRID CLIENT]: *** Deregistering region 3");
success = m_Connector.DeregisterRegion(r3.RegionID);
if (success)
Console.WriteLine("[GRID CLIENT]: Successfully deregistered region 3");
else
Console.WriteLine("[GRID CLIENT]: region 3 failed to deregister");
}
private static GridRegion CreateRegion(string name, uint xcell, uint ycell)
{
GridRegion region = new GridRegion(xcell, ycell);
region.RegionName = name;
region.RegionID = UUID.Random();
region.ExternalHostName = "127.0.0.1";
region.HttpPort = 9000;
region.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), 9000);
return region;
}
}
}

View File

@ -0,0 +1,11 @@
<html>
<form name="input" action="http://127.0.0.1:8002/grid" method="post">
xmin:<input type="text" name="XMIN" value="0">
xmax:<input type="text" name="XMAX" value="0">
ymin:<input type="text" name="YMIN" value="0">
ymax:<input type="text" name="YMAX" value="0">
<input type="hidden" name="METHOD" value="get_region_range">
<input type="submit" value="Submit" />
</form>
</html>

View File

@ -0,0 +1,35 @@
; * The startup section lists all the connectors to start up in this server
; * instance. This may be only one, or it may be the entire server suite.
; * Multiple connectors should be seaprated by commas.
; *
; * These are the IN connectors the server uses, the in connectors
; * read this config file and load the needed OUT and database connectors
; *
; *
[Startup]
ServiceConnectors = "OpenSim.Server.Handlers.dll:GridServiceConnector"
; * This is common for all services, it's the network setup for the entire
; * server instance
; *
[Network]
port = 8002
; * The following are for the remote console
; * They have no effect for the local or basic console types
; * Leave commented to diable logins to the console
;ConsoleUser = Test
;ConsolePass = secret
; * As an example, the below configuration precisely mimicks the legacy
; * asset server. It is read by the asset IN connector (defined above)
; * and it then loads the OUT connector (a local database module). That,
; * in turn, reads the asset loader and database connection information
; *
[GridService]
LocalServiceModule = "OpenSim.Services.GridService.dll:GridService"
StorageProvider = "OpenSim.Data.Null.dll:NullRegionData"
;StorageProvider = "OpenSim.Data.MySQL.dll:MySqlRegionData"
;ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=***;"
Realm = "regions"

View File

@ -1311,7 +1311,7 @@
;NoticesEnabled = true
; This makes the Groups modules very chatty on the console.
;DebugEnabled = true
DebugEnabled = false
; Specify which messaging module to use for groups messaging and if it's enabled
;MessagingModule = GroupsMessagingModule

View File

@ -3221,6 +3221,35 @@
</Files>
</Project>
<!-- Test Clients -->
<Project frameworkVersion="v3_5" name="OpenSim.Tests.Clients.GridClient" path="OpenSim/Tests/Clients/Grid" type="Exe">
<Configuration name="Debug">
<Options>
<OutputPath>../../../../bin/</OutputPath>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<OutputPath>../../../../bin/</OutputPath>
</Options>
</Configuration>
<ReferencePath>../../../../bin/</ReferencePath>
<Reference name="System"/>
<Reference name="OpenMetaverseTypes.dll"/>
<Reference name="OpenMetaverse.dll"/>
<Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Services.Interfaces" />
<Reference name="OpenSim.Services.Connectors" />
<Reference name="Nini.dll" />
<Reference name="log4net.dll"/>
<Files>
<Match pattern="*.cs" recurse="true"/>
</Files>
</Project>
<!-- Test assemblies -->
<Project frameworkVersion="v3_5" name="OpenSim.Tests.Common" path="OpenSim/Tests/Common" type="Library">
<Configuration name="Debug">