From 4234c64147cd59c284276a5408702c31860a5928 Mon Sep 17 00:00:00 2001 From: dahlia Date: Wed, 2 Dec 2009 04:10:53 -0800 Subject: handle a condition where the http headers apparently have multiple remote ports designated --- OpenSim/Framework/Servers/HttpServer/OSHttpRequest.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/OpenSim/Framework/Servers/HttpServer/OSHttpRequest.cs b/OpenSim/Framework/Servers/HttpServer/OSHttpRequest.cs index c53160f..bcfb0a4 100644 --- a/OpenSim/Framework/Servers/HttpServer/OSHttpRequest.cs +++ b/OpenSim/Framework/Servers/HttpServer/OSHttpRequest.cs @@ -188,7 +188,15 @@ namespace OpenSim.Framework.Servers.HttpServer try { IPAddress addr = IPAddress.Parse(req.Headers["remote_addr"]); - int port = Int32.Parse(req.Headers["remote_port"]); + // sometimes req.Headers["remote_port"] returns a comma separated list, so use + // the first one in the list and log it + string[] strPorts = req.Headers["remote_port"].Split(new char[] { ',' }); + if (strPorts.Length > 1) + { + _log.ErrorFormat("[OSHttpRequest]: format exception on addr/port {0}:{1}, ignoring", + req.Headers["remote_addr"], req.Headers["remote_port"]); + } + int port = Int32.Parse(strPorts[0]); _remoteIPEndPoint = new IPEndPoint(addr, port); } catch (FormatException) -- cgit v1.1 From 30fe88b80892e4538dc2b6f71992c3f51d35e95a Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Thu, 3 Dec 2009 02:44:12 +1100 Subject: * Terrain uploads via the Estate Tools now support a multitude of file formats. Specifically: . bmp, .raw, .r32 & .r64. (in ascending order of precision) * It uses file length as the detection routine (as each of these formats has a distinct size in bytes for a 256x256 array.) - more formats should be possible to add. --- .../World/Estate/EstateManagementModule.cs | 50 ++++++++++++++-------- 1 file changed, 31 insertions(+), 19 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index e3a395e..b1dcb14 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -471,20 +471,45 @@ namespace OpenSim.Region.CoreModules.World.Estate if (terr != null) { m_log.Warn("[CLIENT]: Got Request to Send Terrain in region " + m_scene.RegionInfo.RegionName); - if (File.Exists(Util.dataDir() + "/terrain.raw")) - { - File.Delete(Util.dataDir() + "/terrain.raw"); - } + try { - FileStream input = new FileStream(Util.dataDir() + "/terrain.raw", FileMode.CreateNew); + + string localfilename = "terrain.raw"; + + if (terrainData.Length == 851968) + { + localfilename = Path.Combine(Util.dataDir(),"terrain.raw"); // It's a .LLRAW + } + + if (terrainData.Length == 196662) // 24-bit 256x256 Bitmap + localfilename = Path.Combine(Util.dataDir(), "terrain.bmp"); + + if (terrainData.Length == 256 * 256 * 4) // It's a .R32 + localfilename = Path.Combine(Util.dataDir(), "terrain.r32"); + + if (terrainData.Length == 256 * 256 * 8) // It's a .R64 + localfilename = Path.Combine(Util.dataDir(), "terrain.r64"); + + if (File.Exists(localfilename)) + { + File.Delete(localfilename); + } + + FileStream input = new FileStream(localfilename, FileMode.CreateNew); input.Write(terrainData, 0, terrainData.Length); input.Close(); + + FileInfo x = new FileInfo(localfilename); + + terr.LoadFromFile(localfilename); + remoteClient.SendAlertMessage("Your terrain was loaded as a ." + x.Extension + " file. It may take a few moments to appear."); + } catch (IOException e) { m_log.ErrorFormat("[TERRAIN]: Error Saving a terrain file uploaded via the estate tools. It gave us the following error: {0}", e.ToString()); - remoteClient.SendAlertMessage("There was an IO Exception loading your terrain. Please check free space"); + remoteClient.SendAlertMessage("There was an IO Exception loading your terrain. Please check free space."); return; } @@ -502,29 +527,16 @@ namespace OpenSim.Region.CoreModules.World.Estate return; } - - - - - try - { - terr.LoadFromFile(Util.dataDir() + "/terrain.raw"); - remoteClient.SendAlertMessage("Your terrain was loaded. Give it a minute or two to apply"); - } catch (Exception e) { m_log.ErrorFormat("[TERRAIN]: Error loading a terrain file uploaded via the estate tools. It gave us the following error: {0}", e.ToString()); remoteClient.SendAlertMessage("There was a general error loading your terrain. Please fix the terrain file and try again"); } - } else { remoteClient.SendAlertMessage("Unable to apply terrain. Cannot get an instance of the terrain module"); } - - - } private void handleUploadTerrain(IClientAPI remote_client, string clientFileName) -- cgit v1.1 From f7b2f0e61e2a8bb397fd4bf97103a4bac8d17b23 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 2 Dec 2009 17:55:56 +0000 Subject: Add position and region of prim items with missing assets in log reports --- .../Framework/Scenes/SceneObjectPartInventory.cs | 25 +++++++++++++--------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 7a0d7b7..22eedba 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -259,8 +259,9 @@ namespace OpenSim.Region.Framework.Scenes { m_log.ErrorFormat( "[PRIM INVENTORY]: " + - "Couldn't start script {0}, {1} since asset ID {2} could not be found", - item.Name, item.ItemID, item.AssetID); + "Couldn't start script {0}, {1} at {2} in {3} since asset ID {4} could not be found", + item.Name, item.ItemID, m_part.AbsolutePosition, + m_part.ParentGroup.Scene.RegionInfo.RegionName, item.AssetID); } else { @@ -312,8 +313,9 @@ namespace OpenSim.Region.Framework.Scenes { m_log.ErrorFormat( "[PRIM INVENTORY]: " + - "Couldn't start script with ID {0} since it couldn't be found for prim {1}, {2}", - itemId, m_part.Name, m_part.UUID); + "Couldn't start script with ID {0} since it couldn't be found for prim {1}, {2} at {3} in {4}", + itemId, m_part.Name, m_part.UUID, + m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName); } } } @@ -333,8 +335,9 @@ namespace OpenSim.Region.Framework.Scenes { m_log.ErrorFormat( "[PRIM INVENTORY]: " + - "Couldn't stop script with ID {0} since it couldn't be found for prim {1}, {2}", - itemId, m_part.Name, m_part.UUID); + "Couldn't stop script with ID {0} since it couldn't be found for prim {1}, {2} at {3} in {4}", + itemId, m_part.Name, m_part.UUID, + m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName); } } @@ -522,8 +525,9 @@ namespace OpenSim.Region.Framework.Scenes { m_log.ErrorFormat( "[PRIM INVENTORY]: " + - "Tried to retrieve item ID {0} from prim {1}, {2} but the item does not exist in this inventory", - item.ItemID, m_part.Name, m_part.UUID); + "Tried to retrieve item ID {0} from prim {1}, {2} at {3} in {4} but the item does not exist in this inventory", + item.ItemID, m_part.Name, m_part.UUID, + m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName); } } @@ -579,8 +583,9 @@ namespace OpenSim.Region.Framework.Scenes { m_log.ErrorFormat( "[PRIM INVENTORY]: " + - "Tried to remove item ID {0} from prim {1}, {2} but the item does not exist in this inventory", - itemID, m_part.Name, m_part.UUID); + "Tried to remove item ID {0} from prim {1}, {2} at {3} in {4} but the item does not exist in this inventory", + itemID, m_part.Name, m_part.UUID, + m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName); } } -- cgit v1.1 From c58d30616be81df0714ce232de9dcdd955b61011 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 2 Dec 2009 18:53:08 +0000 Subject: Log old position and region information when an orphaned child prim is found --- OpenSim/Data/MySQL/MySQLLegacyRegionData.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs index c49153f..aecfaa3 100644 --- a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs @@ -479,7 +479,9 @@ namespace OpenSim.Data.MySQL } else { - m_log.Warn("[REGION DB]: Database contains an orphan child prim " + prim.UUID + " pointing to missing parent " + prim.ParentUUID); + m_log.WarnFormat( + "[REGION DB]: Database contains an orphan child prim {0} {1} at {2} in region {3} pointing to missing parent {4}. This prim will not be loaded.", + prim.Name, prim.UUID, prim.AbsolutePosition, regionID, prim.ParentUUID); } } } -- cgit v1.1 From af04cd1ae00c5533df5b6be6333bd58ce13aa1a9 Mon Sep 17 00:00:00 2001 From: Teravus Ovares (Dan Olivares) Date: Thu, 3 Dec 2009 01:50:54 -0500 Subject: * If the position that comes in on Scene.SetHomeRezPoint has a component that is 255.5, replace the component with the user's position in the simulator. * Fixes mantis 4414: http://opensimulator.org/mantis/view.php?id=4414 --- OpenSim/Region/Framework/Scenes/Scene.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 8788ced..08b7115 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3034,6 +3034,25 @@ namespace OpenSim.Region.Framework.Scenes // TODO: The next line can be removed, as soon as only homeRegionID based UserServers are around. // TODO: The HomeRegion property can be removed then, too UserProfile.HomeRegion = RegionInfo.RegionHandle; + + // Linden Client limitation.. + if (position.X == 255.5f || position.Y == 255.5f) + { + ScenePresence avatar = null; + if (TryGetAvatar(remoteClient.AgentId, out avatar)) + { + if (position.X == 255.5f) + { + position.X = avatar.AbsolutePosition.X; + } + if (position.Y == 255.5f) + { + position.Y = avatar.AbsolutePosition.Y; + } + } + + } + UserProfile.HomeLocation = position; UserProfile.HomeLookAt = lookAt; CommsManager.UserService.UpdateUserProfile(UserProfile); -- cgit v1.1 From d9a20edfb0ec916f40a6dc116955f966c86d83c8 Mon Sep 17 00:00:00 2001 From: Teravus Ovares (Dan Olivares) Date: Thu, 3 Dec 2009 02:02:04 -0500 Subject: * Move code from that last commit to LLClientView since it's a linden client specific limitation, it moves to the Linden Specific client handler. --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 18 ++++++++++++++++++ OpenSim/Region/Framework/Scenes/Scene.cs | 18 ------------------ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index c2aa8e2..ffe6fe9 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -5521,6 +5521,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (avSetStartLocationRequestPacket.AgentData.AgentID == AgentId && avSetStartLocationRequestPacket.AgentData.SessionID == SessionId) { + // Linden Client limitation.. + if (avSetStartLocationRequestPacket.StartLocationData.LocationPos.X == 255.5f + || avSetStartLocationRequestPacket.StartLocationData.LocationPos.Y == 255.5f) + { + ScenePresence avatar = null; + if (((Scene)m_scene).TryGetAvatar(AgentId, out avatar)) + { + if (avSetStartLocationRequestPacket.StartLocationData.LocationPos.X == 255.5f) + { + avSetStartLocationRequestPacket.StartLocationData.LocationPos.X = avatar.AbsolutePosition.X; + } + if (avSetStartLocationRequestPacket.StartLocationData.LocationPos.Y == 255.5f) + { + avSetStartLocationRequestPacket.StartLocationData.LocationPos.Y = avatar.AbsolutePosition.Y; + } + } + + } TeleportLocationRequest handlerSetStartLocationRequest = OnSetStartLocationRequest; if (handlerSetStartLocationRequest != null) { diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 08b7115..a22fb5f 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3034,24 +3034,6 @@ namespace OpenSim.Region.Framework.Scenes // TODO: The next line can be removed, as soon as only homeRegionID based UserServers are around. // TODO: The HomeRegion property can be removed then, too UserProfile.HomeRegion = RegionInfo.RegionHandle; - - // Linden Client limitation.. - if (position.X == 255.5f || position.Y == 255.5f) - { - ScenePresence avatar = null; - if (TryGetAvatar(remoteClient.AgentId, out avatar)) - { - if (position.X == 255.5f) - { - position.X = avatar.AbsolutePosition.X; - } - if (position.Y == 255.5f) - { - position.Y = avatar.AbsolutePosition.Y; - } - } - - } UserProfile.HomeLocation = position; UserProfile.HomeLookAt = lookAt; -- cgit v1.1 From 504bfd87d5a769aaea3f7a8469254b6340487442 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 3 Dec 2009 17:57:29 +0000 Subject: if an xml rpc method throws an exception, log as an error to the console as well as returning the exception to the caller --- OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 14 +++++++++++--- OpenSim/Grid/UserServer.Modules/MessageServersConnector.cs | 1 + 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index bec5ed3..7de5c4c 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -723,13 +723,21 @@ namespace OpenSim.Framework.Servers.HttpServer xmlRpcResponse = method(xmlRprcRequest, request.RemoteIPEndPoint); } catch(Exception e) - { + { + string errorMessage + = String.Format( + "Requested method [{0}] from {1} threw exception: {2} {3}", + methodName, request.RemoteIPEndPoint.Address, e.Message, e.StackTrace); + + m_log.ErrorFormat("[BASE HTTP SERVER]: {0}", errorMessage); + // if the registered XmlRpc method threw an exception, we pass a fault-code along xmlRpcResponse = new XmlRpcResponse(); + // Code probably set in accordance with http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php - xmlRpcResponse.SetFault(-32603, String.Format("Requested method [{0}] threw exception: {1}", - methodName, e.Message)); + xmlRpcResponse.SetFault(-32603, errorMessage); } + // if the method wasn't found, we can't determine KeepAlive state anyway, so lets do it only here response.KeepAlive = m_rpcHandlersKeepAlive[methodName]; } diff --git a/OpenSim/Grid/UserServer.Modules/MessageServersConnector.cs b/OpenSim/Grid/UserServer.Modules/MessageServersConnector.cs index f24cef6..3384952 100644 --- a/OpenSim/Grid/UserServer.Modules/MessageServersConnector.cs +++ b/OpenSim/Grid/UserServer.Modules/MessageServersConnector.cs @@ -201,6 +201,7 @@ namespace OpenSim.Grid.UserServer.Modules } return response; } + public XmlRpcResponse XmlRPCUserMovedtoRegion(XmlRpcRequest request, IPEndPoint remoteClient) { XmlRpcResponse response = new XmlRpcResponse(); -- cgit v1.1 From 781db43a7665cf0c219889e85eadd7cdc4e8b79b Mon Sep 17 00:00:00 2001 From: Teravus Ovares (Dan Olivares) Date: Thu, 3 Dec 2009 20:21:10 -0500 Subject: * Fixes the 10x10x10 hard physics limitation. (wierdly, you have to set this for each region in your Regions.ini[PhysicalPrimMax = 10(default)]) * Adds a configurable maximum object mass before the mass is clamped. Default is 10000.01. Configurable by changing maximum_mass_object in the [ODEPhysicsSettings] section. * Clamping the mass is important for limiting the amount of CPU an object can consume in physics calculations. Too high, and the object overcomes restitution forces by gravity alone. This generates more collisions potentially leading to 'deep think'. --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 4 +++- OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 3 +++ OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 2 ++ bin/OpenSim.ini.example | 3 +++ 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 7359011..6badaf5 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2589,7 +2589,9 @@ namespace OpenSim.Region.Framework.Scenes { foreach (SceneObjectPart part in m_parts.Values) { - if (part.Scale.X > 10.0 || part.Scale.Y > 10.0 || part.Scale.Z > 10.0) + if (part.Scale.X > m_scene.RegionInfo.PhysPrimMax || + part.Scale.Y > m_scene.RegionInfo.PhysPrimMax || + part.Scale.Z > m_scene.RegionInfo.PhysPrimMax) { UsePhysics = false; // Reset physics break; diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index 9e9c36f..d241574 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs @@ -723,6 +723,8 @@ namespace OpenSim.Region.Physics.OdePlugin break; } } + if (returnMass > _parent_scene.maximumMassObject) + returnMass = _parent_scene.maximumMassObject; return returnMass; }// end CalculateMass @@ -733,6 +735,7 @@ namespace OpenSim.Region.Physics.OdePlugin if (Body != (IntPtr) 0) { float newmass = CalculateMass(); + //m_log.Info("[PHYSICS]: New Mass: " + newmass.ToString()); d.MassSetBoxTotal(out pMass, newmass, _size.X, _size.Y, _size.Z); diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index a0aba2a..0384d6e 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs @@ -207,6 +207,7 @@ namespace OpenSim.Region.Physics.OdePlugin private float avMovementDivisorWalk = 1.3f; private float avMovementDivisorRun = 0.8f; private float minimumGroundFlightOffset = 3f; + public float maximumMassObject = 10000.01f; public bool meshSculptedPrim = true; public bool forceSimplePrimMeshing = false; @@ -480,6 +481,7 @@ namespace OpenSim.Region.Physics.OdePlugin m_NINJA_physics_joints_enabled = physicsconfig.GetBoolean("use_NINJA_physics_joints", false); minimumGroundFlightOffset = physicsconfig.GetFloat("minimum_ground_flight_offset", 3f); + maximumMassObject = physicsconfig.GetFloat("maximum_mass_object", 10000.01f); } } diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 3accee0..8efbcb4 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -594,6 +594,9 @@ body_motor_joint_maxforce_tensor_linux = 5 body_motor_joint_maxforce_tensor_win = 5 + ; Maximum mass an object can be before it is clamped + maximum_mass_object = 10000.01 + ; ## ; ## Sculpted Prim settings ; ## -- cgit v1.1 From 07786786fcdc93e01286ccd15aaf539d2579a329 Mon Sep 17 00:00:00 2001 From: Teravus Ovares (Dan Olivares) Date: Thu, 3 Dec 2009 20:30:40 -0500 Subject: * Clarifies that the PrimMaxPhys in OpenSim.ini.example does nothing. Tells user to set it in Regions.ini. Melanie might want to take a look at this and see if it should be removed altogether. --- bin/OpenSim.ini.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 8efbcb4..4351b3f 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -91,7 +91,7 @@ ; Maximum total size, and maximum size where a prim can be physical NonPhysicalPrimMax = 256 - PhysicalPrimMax = 10 + PhysicalPrimMax = 10 ; (I think this was moved to the Regions.ini!) ClampPrimSize = false ; Region crossing -- cgit v1.1 From c0f3a4c8332f235e998714214011c5412bdcacf0 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 4 Dec 2009 18:26:58 +0000 Subject: Allow terrain heightmaps to be loaded directly from URIs via the remote admin plugin See http://opensimulator.org/mantis/view.php?id=4418 Thanks StrawberryFride See --- .../RemoteController/RemoteAdminPlugin.cs | 17 ++++++++++-- .../CoreModules/World/Terrain/TerrainModule.cs | 32 +++++++++++++++++++++- .../Region/Framework/Interfaces/ITerrainModule.cs | 2 +- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 6 ++++ 4 files changed, 53 insertions(+), 4 deletions(-) diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index 3149eaa..adf7967 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs @@ -315,8 +315,21 @@ namespace OpenSim.ApplicationPlugins.RemoteController ITerrainModule terrainModule = region.RequestModuleInterface(); if (null == terrainModule) throw new Exception("terrain module not available"); - terrainModule.LoadFromFile(file); - + if (Uri.IsWellFormedUriString(file, UriKind.Absolute)) + { + m_log.Info("[RADMIN]: Terrain path is URL"); + Uri result; + if (Uri.TryCreate(file, UriKind.RelativeOrAbsolute, out result)) + { + // the url is valid + string fileType = file.Substring(file.LastIndexOf('/') + 1); + terrainModule.LoadFromStream(fileType, result); + } + } + else + { + terrainModule.LoadFromFile(file); + } responseData["success"] = false; response.Value = responseData; diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs index ba271fd..a40828b 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs @@ -29,6 +29,7 @@ using System; using System.Collections.Generic; using System.IO; using System.Reflection; +using System.Net; using log4net; using Nini.Config; using OpenMetaverse; @@ -259,6 +260,16 @@ namespace OpenSim.Region.CoreModules.World.Terrain } /// + /// Loads a terrain file from the specified URI + /// + /// The name of the terrain to load + /// The URI to the terrain height map + public void LoadFromStream(string filename, Uri pathToTerrainHeightmap) + { + LoadFromStream(filename, URIFetch(pathToTerrainHeightmap)); + } + + /// /// Loads a terrain file from a stream and installs it in the scene. /// /// Filename to terrain file. Type is determined by extension. @@ -267,7 +278,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain { foreach (KeyValuePair loader in m_loaders) { - if (@filename.EndsWith(loader.Key)) + if (filename.EndsWith(loader.Key)) { lock (m_scene) { @@ -295,6 +306,25 @@ namespace OpenSim.Region.CoreModules.World.Terrain throw new TerrainException(String.Format("unable to load heightmap from file {0}: no loader available for that format", filename)); } + private static Stream URIFetch(Uri uri) + { + HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); + + // request.Credentials = credentials; + + request.ContentLength = 0; + request.KeepAlive = false; + + WebResponse response = request.GetResponse(); + Stream file = response.GetResponseStream(); + + if (response.ContentLength == 0) + throw new Exception(String.Format("{0} returned an empty file", uri.ToString())); + + // return new BufferedStream(file, (int) response.ContentLength); + return new BufferedStream(file, 1000000); + } + /// /// Modify Land /// diff --git a/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs b/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs index 2dcba0c..7caac55 100644 --- a/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs +++ b/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs @@ -51,7 +51,7 @@ namespace OpenSim.Region.Framework.Interfaces /// /// void LoadFromStream(string filename, Stream stream); - + void LoadFromStream(string filename, System.Uri pathToTerrainHeightmap); /// /// Save a terrain to a stream. /// diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 09d02f4..0b0c205 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -2393,6 +2393,12 @@ namespace OpenSim.Region.Framework.Scenes InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); item = InventoryService.GetItem(item); presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/); + + if (m_AvatarFactory != null) + { + m_AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); + } + } } -- cgit v1.1 From c4b6010fb34268c9426f7241a38ba892b93780d1 Mon Sep 17 00:00:00 2001 From: Teravus Ovares (Dan Olivares) Date: Sat, 5 Dec 2009 13:01:21 -0500 Subject: * Fixes mantis 4416. Animator is dereferenced on logout --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 5 +++-- OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index b2cd249..a3ceecb 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2932,14 +2932,15 @@ namespace OpenSim.Region.Framework.Scenes //if ((Math.Abs(Velocity.X) > 0.1e-9f) || (Math.Abs(Velocity.Y) > 0.1e-9f)) // The Physics Scene will send updates every 500 ms grep: m_physicsActor.SubscribeEvents( // as of this comment the interval is set in AddToPhysicalScene - Animator.UpdateMovementAnimations(); + if (Animator!=null) + Animator.UpdateMovementAnimations(); CollisionEventUpdate collisionData = (CollisionEventUpdate)e; Dictionary coldata = collisionData.m_objCollisionList; CollisionPlane = Vector4.UnitW; - if (coldata.Count != 0) + if (coldata.Count != 0 && Animator != null) { switch (Animator.CurrentMovementAnimation) { diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index 1bc4a25..40fbde1 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs @@ -1221,7 +1221,10 @@ namespace OpenSim.Region.Physics.OdePlugin { if (m_eventsubscription > m_requestedUpdateFrequency) { - base.SendCollisionUpdate(CollisionEventsThisFrame); + if (CollisionEventsThisFrame != null) + { + base.SendCollisionUpdate(CollisionEventsThisFrame); + } CollisionEventsThisFrame = new CollisionEventUpdate(); m_eventsubscription = 0; } -- cgit v1.1 From 8e089b6d8d0d5b20cce6c812d987f77bc3957435 Mon Sep 17 00:00:00 2001 From: Teravus Ovares (Dan Olivares) Date: Sat, 5 Dec 2009 13:23:05 -0500 Subject: * Fix line endings in BaseHttpServer.cs --- OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 7de5c4c..75cdeb4 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -723,12 +723,12 @@ namespace OpenSim.Framework.Servers.HttpServer xmlRpcResponse = method(xmlRprcRequest, request.RemoteIPEndPoint); } catch(Exception e) - { - string errorMessage - = String.Format( - "Requested method [{0}] from {1} threw exception: {2} {3}", - methodName, request.RemoteIPEndPoint.Address, e.Message, e.StackTrace); - + { + string errorMessage + = String.Format( + "Requested method [{0}] from {1} threw exception: {2} {3}", + methodName, request.RemoteIPEndPoint.Address, e.Message, e.StackTrace); + m_log.ErrorFormat("[BASE HTTP SERVER]: {0}", errorMessage); // if the registered XmlRpc method threw an exception, we pass a fault-code along -- cgit v1.1