From 644db1e5400504ec70b22c3e928873948f1247c3 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Mon, 17 Aug 2009 09:40:38 +0100
Subject: Add System.Xml reference to the console project
---
.../Region/ClientStack/LindenUDP/LLClientView.cs | 77 +++++++++++++++-------
.../Region/Communications/OGS1/OGS1GridServices.cs | 2 +-
.../Region/CoreModules/Avatar/Chat/ChatModule.cs | 13 ++++
.../World/Estate/EstateManagementModule.cs | 3 +-
OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 38 ++++++++---
5 files changed, 101 insertions(+), 32 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 12c2d86..e1d6f1b 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -1435,6 +1435,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// heightmap
public virtual void SendLayerData(float[] map)
{
+ DoSendLayerData((object)map);
ThreadPool.QueueUserWorkItem(DoSendLayerData, map);
}
@@ -1450,16 +1451,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
for (int y = 0; y < 16; y++)
{
- // For some terrains, sending more than one terrain patch at once results in a libsecondlife exception
- // see http://opensimulator.org/mantis/view.php?id=1662
- //for (int x = 0; x < 16; x += 4)
- //{
- // SendLayerPacket(map, y, x);
- // Thread.Sleep(150);
- //}
- for (int x = 0; x < 16; x++)
- {
- SendLayerData(x, y, LLHeightFieldMoronize(map));
+ for (int x = 0; x < 16; x += 4)
+ {
+ SendLayerPacket(LLHeightFieldMoronize(map), y, x);
Thread.Sleep(35);
}
}
@@ -1476,17 +1470,54 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// heightmap
/// X coordinate for patches 0..12
/// Y coordinate for patches 0..15
- // private void SendLayerPacket(float[] map, int y, int x)
- // {
- // int[] patches = new int[4];
- // patches[0] = x + 0 + y * 16;
- // patches[1] = x + 1 + y * 16;
- // patches[2] = x + 2 + y * 16;
- // patches[3] = x + 3 + y * 16;
-
- // Packet layerpack = LLClientView.TerrainManager.CreateLandPacket(map, patches);
- // OutPacket(layerpack, ThrottleOutPacketType.Land);
- // }
+ private void SendLayerPacket(float[] map, int y, int x)
+ {
+ int[] patches = new int[4];
+ patches[0] = x + 0 + y * 16;
+ patches[1] = x + 1 + y * 16;
+ patches[2] = x + 2 + y * 16;
+ patches[3] = x + 3 + y * 16;
+
+ LayerDataPacket layerpack;
+ try
+ {
+ layerpack = TerrainCompressor.CreateLandPacket(map, patches);
+ layerpack.Header.Zerocoded = true;
+ layerpack.Header.Reliable = true;
+
+ if (layerpack.Length > 1000) // Oversize packet was created
+ {
+ for (int xa = 0 ; xa < 4 ; xa++)
+ {
+ // Send oversize packet in individual patches
+ //
+ SendLayerData(x+xa, y, map);
+ }
+ }
+ else
+ {
+ OutPacket(layerpack, ThrottleOutPacketType.Land);
+ }
+ }
+ catch (OverflowException e)
+ {
+ for (int xa = 0 ; xa < 4 ; xa++)
+ {
+ // Send oversize packet in individual patches
+ //
+ SendLayerData(x+xa, y, map);
+ }
+ }
+ catch (IndexOutOfRangeException e)
+ {
+ for (int xa = 0 ; xa < 4 ; xa++)
+ {
+ // Bad terrain, send individual chunks
+ //
+ SendLayerData(x+xa, y, map);
+ }
+ }
+ }
///
/// Sends a specified patch to a client
@@ -1507,6 +1538,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(((map.Length==65536)? map : LLHeightFieldMoronize(map)), patches);
layerpack.Header.Zerocoded = true;
+ layerpack.Header.Reliable = true;
OutPacket(layerpack, ThrottleOutPacketType.Land);
@@ -1556,7 +1588,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// 16x16 array of wind speeds
public virtual void SendWindData(Vector2[] windSpeeds)
{
- ThreadPool.QueueUserWorkItem(new WaitCallback(DoSendWindData), (object)windSpeeds);
+ DoSendWindData((object)windSpeeds);
+ // ThreadPool.QueueUserWorkItem(new WaitCallback(DoSendWindData), (object)windSpeeds);
}
///
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
index aef1b94..47c7fe4 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
@@ -147,7 +147,7 @@ namespace OpenSim.Region.Communications.OGS1
{
// The timeout should always be significantly larger than the timeout for the grid server to request
// the initial status of the region before confirming registration.
- GridResp = GridReq.Send(serversInfo.GridURL, 90000);
+ GridResp = GridReq.Send(serversInfo.GridURL, 9999999);
}
catch (Exception e)
{
diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
index fcc2673..2426393 100644
--- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
@@ -48,6 +48,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
private int m_saydistance = 30;
private int m_shoutdistance = 100;
private int m_whisperdistance = 10;
+ private string m_adminprefix = String.Empty;
private List m_scenes = new List();
internal object m_syncy = new object();
@@ -76,6 +77,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
m_whisperdistance = config.Configs["Chat"].GetInt("whisper_distance", m_whisperdistance);
m_saydistance = config.Configs["Chat"].GetInt("say_distance", m_saydistance);
m_shoutdistance = config.Configs["Chat"].GetInt("shout_distance", m_shoutdistance);
+ m_adminprefix = config.Configs["Chat"].GetString("admin_prefix", m_adminprefix);
}
public virtual void AddRegion(Scene scene)
@@ -207,6 +209,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
fromPos = avatar.AbsolutePosition;
fromName = avatar.Name;
fromID = c.Sender.AgentId;
+ if (avatar.GodLevel > 100)
+ fromName = m_adminprefix + fromName;
break;
@@ -255,14 +259,23 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
string fromName = c.From;
UUID fromID = UUID.Zero;
+ UUID ownerID = UUID.Zero;
ChatSourceType sourceType = ChatSourceType.Object;
if (null != c.Sender)
{
ScenePresence avatar = (c.Scene as Scene).GetScenePresence(c.Sender.AgentId);
fromID = c.Sender.AgentId;
+ ownerID = c.Sender.AgentId;
fromName = avatar.Name;
sourceType = ChatSourceType.Agent;
}
+ if (c.SenderObject != null)
+ {
+ SceneObjectPart senderObject = (SceneObjectPart)c.SenderObject;
+ fromID = senderObject.UUID;
+ ownerID = senderObject.OwnerID;
+ fromName = senderObject.Name;
+ }
// m_log.DebugFormat("[CHAT] Broadcast: fromID {0} fromName {1}, cType {2}, sType {3}", fromID, fromName, cType, sourceType);
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
index 75b3fe6..61ef20e 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
@@ -214,7 +214,8 @@ namespace OpenSim.Region.CoreModules.World.Estate
private void handleEstateRestartSimRequest(IClientAPI remoteClient, int timeInSeconds)
{
- m_scene.Restart(timeInSeconds);
+// m_scene.Restart(timeInSeconds);
+ remoteClient.SendBlueBoxMessage(UUID.Zero, "System", "Restart is not available");
}
private void handleChangeEstateCovenantRequest(IClientAPI remoteClient, UUID estateCovenantID)
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index b7030f1..80d7598 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -156,10 +156,10 @@ namespace OpenSim.Region.Physics.OdePlugin
private const uint m_regionWidth = Constants.RegionSize;
private const uint m_regionHeight = Constants.RegionSize;
-
+ private bool IsLocked = false;
private float ODE_STEPSIZE = 0.020f;
private float metersInSpace = 29.9f;
-
+ private List RemoveQueue;
public float gravityx = 0f;
public float gravityy = 0f;
public float gravityz = -9.8f;
@@ -376,6 +376,7 @@ namespace OpenSim.Region.Physics.OdePlugin
// Initialize the mesh plugin
public override void Initialise(IMesher meshmerizer, IConfigSource config)
{
+ RemoveQueue = new List();
mesher = meshmerizer;
m_config = config;
// Defaults
@@ -2047,13 +2048,21 @@ namespace OpenSim.Region.Physics.OdePlugin
{
if (prim is OdePrim)
{
- lock (OdeLock)
+ if (!IsLocked) //Fix a deadlock situation.. have we been locked by Simulate?
{
- OdePrim p = (OdePrim) prim;
+ lock (OdeLock)
+ {
+ OdePrim p = (OdePrim)prim;
- p.setPrimForRemoval();
- AddPhysicsActorTaint(prim);
- //RemovePrimThreadLocked(p);
+ p.setPrimForRemoval();
+ AddPhysicsActorTaint(prim);
+ //RemovePrimThreadLocked(p);
+ }
+ }
+ else
+ {
+ //Add the prim to a queue which will be removed when Simulate has finished what it's doing.
+ RemoveQueue.Add(prim);
}
}
}
@@ -2575,7 +2584,7 @@ namespace OpenSim.Region.Physics.OdePlugin
DeleteRequestedJoints(); // this must be outside of the lock (OdeLock) to avoid deadlocks
CreateRequestedJoints(); // this must be outside of the lock (OdeLock) to avoid deadlocks
}
-
+ IsLocked = true;
lock (OdeLock)
{
// Process 10 frames if the sim is running normal..
@@ -2988,6 +2997,19 @@ namespace OpenSim.Region.Physics.OdePlugin
d.WorldExportDIF(world, fname, physics_logging_append_existing_logfile, prefix);
}
}
+ IsLocked = false;
+ if (RemoveQueue.Count > 0)
+ {
+ do
+ {
+ if (RemoveQueue[0] != null)
+ {
+ RemovePrimThreadLocked((OdePrim)RemoveQueue[0]);
+ }
+ RemoveQueue.RemoveAt(0);
+ }
+ while (RemoveQueue.Count > 0);
+ }
return fps;
}
--
cgit v1.1