From 3cd7761d65270531f6db4091a3702179bf41316e Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Mon, 30 Aug 2010 21:23:19 +0100 Subject: [PATCH 01/57] Report exception message as well as stack trace if a region fails to register with the grid service in grid mode --- OpenSim/Region/Application/OpenSimBase.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index b80d17d74c..526d3b59b2 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -356,7 +356,9 @@ namespace OpenSim } catch (Exception e) { - m_log.ErrorFormat("[STARTUP]: Registration of region with grid failed, aborting startup - {0}", e.StackTrace); + m_log.ErrorFormat( + "[STARTUP]: Registration of region with grid failed, aborting startup due to {0} {1}", + e.Message, e.StackTrace); // Carrying on now causes a lot of confusion down the // line - we need to get the user's attention From 7b03cb09e4c441a740f2f956f6c174c9d981c25e Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Mon, 30 Aug 2010 22:33:45 +0100 Subject: [PATCH 02/57] minor: Add some method doc to BaseHttpServer.HandleRequest() --- OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 016ab738bc..95c3e6ca5f 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -338,19 +338,25 @@ namespace OpenSim.Framework.Servers.HttpServer // HandleRequest(request,resp); // } + /// + /// This methods is the start of incoming HTTP request handling. + /// + /// + /// public virtual void HandleRequest(OSHttpRequest request, OSHttpResponse response) { try { +// m_log.Debug("[BASE HTTP SERVER]: Handling request to " + request.RawUrl); + Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true); + // This is the REST agent interface. We require an agent to properly identify // itself. If the REST handler recognizes the prefix it will attempt to // satisfy the request. If it is not recognizable, and no damage has occurred // the request can be passed through to the other handlers. This is a low // probability event; if a request is matched it is normally expected to be // handled -// m_log.Debug("[BASE HTTP SERVER]: Handling request to " + request.RawUrl); - IHttpAgentHandler agentHandler; if (TryGetAgentHandler(request, response, out agentHandler)) From b8c58e5f9f5957ae5b28bc17b2db2eb9f55dcd7b Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 31 Aug 2010 18:27:10 +0100 Subject: [PATCH 03/57] reinsert functionality to debug log more levels of incoming and outgoing client protocol packets These levels correspond to packets that one isn't usually interested in when debugging (e.g. regular outgoing SimStats packets) This is equivalent to what we had a year ago before it was removed. It's extremely crude since it doesn't allow one to pick individual clients or packets. However, it can still be useful when debugging packet race conditions. --- OpenSim/Region/Application/OpenSim.cs | 8 ++- OpenSim/Region/Application/OpenSimBase.cs | 1 - .../ClientStack/LindenUDP/LLClientView.cs | 52 +++++++++++++++---- 3 files changed, 50 insertions(+), 11 deletions(-) diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 683460682f..3c2575df55 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -218,7 +218,13 @@ namespace OpenSim m_console.Commands.AddCommand("region", false, "debug packet", "debug packet ", - "Turn on packet debugging", Debug); + "Turn on packet debugging", + "If level > 255 then all incoming and outgoing packets are logged.\n" + + "If level <= 255 then incoming AgentUpdate and outgoing SimStats and SimulatorViewerTimeMessage packets are not logged.\n" + + "If level <= 200 then incoming RequestImage and outgoing ImagePacket, ImageData, LayerData and CoarseLocationUpdate packets are not logged.\n" + + "If level <= 100 then incoming ViewerEffect and AgentAnimation and outgoing ViewerEffect and AvatarAnimation packets are not logged.\n" + + "If level <= 0 then no packets are logged.", + Debug); m_console.Commands.AddCommand("region", false, "debug scene", "debug scene ", diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 526d3b59b2..d2d2607b39 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -36,7 +36,6 @@ using Nini.Config; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Communications; - using OpenSim.Framework.Console; using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 0d142f4f66..fddb966f9b 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -60,7 +60,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP public class LLClientView : IClientAPI, IClientCore, IClientIM, IClientChat, IClientIPEndpoint, IStatsCollector { /// - /// Debug packet level. At the moment, only 255 does anything (prints out all in and out packets). + /// Debug packet level. See OpenSim.RegisterConsoleCommands() for more details. /// protected int m_debugPacketLevel = 0; @@ -11174,8 +11174,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// handles splitting manually protected void OutPacket(Packet packet, ThrottleOutPacketType throttlePacketType, bool doAutomaticSplitting) { - if (m_debugPacketLevel >= 255) - m_log.DebugFormat("[CLIENT]: Packet OUT {0}", packet.Type); + if (m_debugPacketLevel > 0) + { + bool outputPacket = true; + + if (m_debugPacketLevel <= 255 + && (packet.Type == PacketType.SimStats || packet.Type == PacketType.SimulatorViewerTimeMessage)) + outputPacket = false; + + if (m_debugPacketLevel <= 200 + && + (packet.Type == PacketType.ImagePacket + || packet.Type == PacketType.ImageData + || packet.Type == PacketType.LayerData + || packet.Type == PacketType.CoarseLocationUpdate)) + outputPacket = false; + + if (m_debugPacketLevel <= 100 && (packet.Type == PacketType.AvatarAnimation || packet.Type == PacketType.ViewerEffect)) + outputPacket = false; + + if (outputPacket) + m_log.DebugFormat("[CLIENT]: Packet OUT {0}", packet.Type); + } m_udpServer.SendPacket(m_udpClient, packet, throttlePacketType, doAutomaticSplitting); } @@ -11246,15 +11266,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Entryway from the client to the simulator. All UDP packets from the client will end up here /// /// OpenMetaverse.packet - public void ProcessInPacket(Packet Pack) + public void ProcessInPacket(Packet packet) { - if (m_debugPacketLevel >= 255) - m_log.DebugFormat("[CLIENT]: Packet IN {0}", Pack.Type); + if (m_debugPacketLevel > 0) + { + bool outputPacket = true; + + if (m_debugPacketLevel <= 255 && packet.Type == PacketType.AgentUpdate) + outputPacket = false; + + if (m_debugPacketLevel <= 200 && packet.Type == PacketType.RequestImage) + outputPacket = false; + + if (m_debugPacketLevel <= 100 && (packet.Type == PacketType.ViewerEffect || packet.Type == PacketType.AgentAnimation)) + outputPacket = false; + + if (outputPacket) + m_log.DebugFormat("[CLIENT]: Packet IN {0}", packet.Type); + } - if (!ProcessPacketMethod(Pack)) - m_log.Warn("[CLIENT]: unhandled packet " + Pack.Type); + if (!ProcessPacketMethod(packet)) + m_log.Warn("[CLIENT]: unhandled packet " + packet.Type); - PacketPool.Instance.ReturnPacket(Pack); + PacketPool.Instance.ReturnPacket(packet); } private static PrimitiveBaseShape GetShapeFromAddPacket(ObjectAddPacket addPacket) From 9c1c378aa1b8c4f7738514614cdf8e8b870e7263 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 31 Aug 2010 22:16:23 +0100 Subject: [PATCH 04/57] Add ScenePresence.GetAttachments(uint attachmentPoint) --- .../Region/Framework/Scenes/ScenePresence.cs | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index fbb3177822..339d0c422f 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3383,6 +3383,27 @@ namespace OpenSim.Region.Framework.Scenes m_attachments.Add(gobj); } } + + /// + /// Get the scene object attached to the given point. + /// + /// + /// Returns an empty list if there were no attachments at the point. + public List GetAttachments(uint attachmentPoint) + { + List attachments = new List(); + + lock (m_attachments) + { + foreach (SceneObjectGroup so in m_attachments) + { + if (attachmentPoint == so.RootPart.AttachmentPoint) + attachments.Add(so); + } + } + + return attachments; + } public bool HasAttachments() { From 01276ef43304c3bd9a090e809b7d4f44ecfffcf5 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 31 Aug 2010 22:22:45 +0100 Subject: [PATCH 05/57] refactor: change AttachmentsModule.AttachObject to use sp.GetAttachments rather than filter sp.Attachments list directly --- .../Avatar/Attachments/AttachmentsModule.cs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index d56145a2a5..de654609f9 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -173,16 +173,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments UUID itemID = UUID.Zero; if (sp != null) { - foreach(SceneObjectGroup grp in sp.Attachments) + foreach(SceneObjectGroup grp in sp.GetAttachments(AttachmentPt)) { - if (grp.GetAttachmentPoint() == (byte)AttachmentPt) - { - itemID = grp.GetFromItemID(); - break; - } - } - if (itemID != UUID.Zero) - DetachSingleAttachmentToInv(itemID, remoteClient); + itemID = grp.GetFromItemID(); + if (itemID != UUID.Zero) + DetachSingleAttachmentToInv(itemID, remoteClient); + } } if (group.GetFromItemID() == UUID.Zero) From c47de942637281714c3e85bfc8b3af4405713fd3 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 31 Aug 2010 22:24:11 +0200 Subject: [PATCH 06/57] Adjust the "Magic numbers" we use because we can't reference the actual script state enum to reflect recent changes. --- .../Framework/InventoryAccess/InventoryAccessModule.cs | 2 +- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 2 +- OpenSim/Region/Framework/Scenes/Scene.cs | 2 +- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 6decf54aa9..2ac2324cd9 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -641,7 +641,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess } // Fire on_rez - group.CreateScriptInstances(0, true, m_Scene.DefaultScriptEngine, 0); + group.CreateScriptInstances(0, true, m_Scene.DefaultScriptEngine, 1); rootPart.ParentGroup.ResumeScripts(); rootPart.ScheduleFullUpdate(); diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 2ac46e2a03..0674e62d8b 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -1940,7 +1940,7 @@ namespace OpenSim.Region.Framework.Scenes // We can only call this after adding the scene object, since the scene object references the scene // to find out if scripts should be activated at all. - group.CreateScriptInstances(param, true, DefaultScriptEngine, 2); + group.CreateScriptInstances(param, true, DefaultScriptEngine, 3); group.ScheduleGroupForFullUpdate(); diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index db081cc006..56ac2c2e57 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2376,7 +2376,7 @@ namespace OpenSim.Region.Framework.Scenes return false; } - newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, 1); + newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, 2); newObject.ResumeScripts(); diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 2c242c9497..e7175c5326 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -1845,7 +1845,7 @@ namespace OpenSim.Region.Framework.Scenes copy.UpdateGroupRotationR(rot); } - copy.CreateScriptInstances(0, false, m_parentScene.DefaultScriptEngine, 0); + copy.CreateScriptInstances(0, false, m_parentScene.DefaultScriptEngine, 1); copy.HasGroupChanged = true; copy.ScheduleGroupForFullUpdate(); copy.ResumeScripts(); From 6cbf66827ba3cb878ab70b75fc4e3221b71d820e Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Wed, 1 Sep 2010 01:11:52 +0100 Subject: [PATCH 07/57] refactor: move SOG.AttachToAgent() into AttachmentsModule --- .../Avatar/Attachments/AttachmentsModule.cs | 81 +++++++++++++++++-- .../Framework/Scenes/SceneObjectGroup.cs | 71 ---------------- 2 files changed, 74 insertions(+), 78 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index de654609f9..6555b547de 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -192,12 +192,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments SetAttachmentInventoryStatus(remoteClient, AttachmentPt, itemID, group); - group.AttachToAgent(remoteClient.AgentId, AttachmentPt, attachPos, silent); - - // In case it is later dropped again, don't let - // it get cleaned up - group.RootPart.RemFlag(PrimFlags.TemporaryOnRez); - group.HasGroupChanged = false; + AttachToAgent(sp, group, AttachmentPt, attachPos, silent); } else { @@ -525,6 +520,78 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments remoteClient.SendInventoryItemCreateUpdate(item, 0); } } - } + } + + /// + /// Attach this scene object to the given avatar. + /// + /// + /// This isn't publicly available since attachments should always perform the corresponding inventory + /// operation (to show the attach in user inventory and update the asset with positional information). + /// + /// + /// + /// + /// + /// + protected void AttachToAgent(ScenePresence avatar, SceneObjectGroup so, uint attachmentpoint, Vector3 AttachOffset, bool silent) + { + // don't attach attachments to child agents + if (avatar.IsChildAgent) return; + +// m_log.DebugFormat("[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1}", Name, avatar.Name); + + so.DetachFromBackup(); + + // Remove from database and parcel prim count + m_scene.DeleteFromStorage(so.UUID); + m_scene.EventManager.TriggerParcelPrimCountTainted(); + + so.RootPart.AttachedAvatar = avatar.UUID; + + //Anakin Lohner bug #3839 + lock (so.Children) + { + foreach (SceneObjectPart p in so.Children.Values) + { + p.AttachedAvatar = avatar.UUID; + } + } + + if (so.RootPart.PhysActor != null) + { + m_scene.PhysicsScene.RemovePrim(so.RootPart.PhysActor); + so.RootPart.PhysActor = null; + } + + so.AbsolutePosition = AttachOffset; + so.RootPart.AttachedPos = AttachOffset; + so.RootPart.IsAttachment = true; + + so.RootPart.SetParentLocalId(avatar.LocalId); + so.SetAttachmentPoint(Convert.ToByte(attachmentpoint)); + + avatar.AddAttachment(so); + + if (!silent) + { + // Killing it here will cause the client to deselect it + // It then reappears on the avatar, deselected + // through the full update below + // + if (so.IsSelected) + { + m_scene.SendKillObject(so.RootPart.LocalId); + } + + so.IsSelected = false; // fudge.... + so.ScheduleGroupForFullUpdate(); + } + + // In case it is later dropped again, don't let + // it get cleaned up + so.RootPart.RemFlag(PrimFlags.TemporaryOnRez); + so.HasGroupChanged = false; + } } } \ No newline at end of file diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 40a8f83143..64a6dd57fe 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -977,77 +977,6 @@ namespace OpenSim.Region.Framework.Scenes } } - /// - /// Attach this scene object to the given avatar. - /// - /// - /// - /// - public void AttachToAgent(UUID agentID, uint attachmentpoint, Vector3 AttachOffset, bool silent) - { - ScenePresence avatar = m_scene.GetScenePresence(agentID); - if (avatar != null) - { - // don't attach attachments to child agents - if (avatar.IsChildAgent) return; - -// m_log.DebugFormat("[SOG]: Adding attachment {0} to avatar {1}", Name, avatar.Name); - - DetachFromBackup(); - - // Remove from database and parcel prim count - m_scene.DeleteFromStorage(UUID); - m_scene.EventManager.TriggerParcelPrimCountTainted(); - - m_rootPart.AttachedAvatar = agentID; - - //Anakin Lohner bug #3839 - lock (m_parts) - { - foreach (SceneObjectPart p in m_parts.Values) - { - p.AttachedAvatar = agentID; - } - } - - if (m_rootPart.PhysActor != null) - { - m_scene.PhysicsScene.RemovePrim(m_rootPart.PhysActor); - m_rootPart.PhysActor = null; - } - - AbsolutePosition = AttachOffset; - m_rootPart.AttachedPos = AttachOffset; - m_rootPart.IsAttachment = true; - - m_rootPart.SetParentLocalId(avatar.LocalId); - SetAttachmentPoint(Convert.ToByte(attachmentpoint)); - - avatar.AddAttachment(this); - - if (!silent) - { - // Killing it here will cause the client to deselect it - // It then reappears on the avatar, deselected - // through the full update below - // - if (IsSelected) - { - m_scene.SendKillObject(m_rootPart.LocalId); - } - - IsSelected = false; // fudge.... - ScheduleGroupForFullUpdate(); - } - } - else - { - m_log.WarnFormat( - "[SOG]: Tried to add attachment {0} to avatar with UUID {1} in region {2} but the avatar is not present", - UUID, agentID, Scene.RegionInfo.RegionName); - } - } - public byte GetAttachmentPoint() { return m_rootPart.Shape.State; From b9db495d91b1618c9caf0aeb81f65ad7ef86dc2a Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Wed, 1 Sep 2010 22:06:56 +0100 Subject: [PATCH 08/57] Fix sqlite migration problems by moving migrations in 019_RegionStore.sql and 020 into RegionStore.migrations This shows that panda is still not running the sqlite database tests since this change fixes the test failure in that area when "nant test" is executed locally --- .../Data/SQLite/Resources/019_RegionStore.sql | 5 ----- .../Data/SQLite/Resources/020_RegionStore.sql | 6 ------ .../SQLite/Resources/RegionStore.migrations | 17 ++++++++++++++--- 3 files changed, 14 insertions(+), 14 deletions(-) delete mode 100644 OpenSim/Data/SQLite/Resources/019_RegionStore.sql delete mode 100644 OpenSim/Data/SQLite/Resources/020_RegionStore.sql diff --git a/OpenSim/Data/SQLite/Resources/019_RegionStore.sql b/OpenSim/Data/SQLite/Resources/019_RegionStore.sql deleted file mode 100644 index d62f8484b8..0000000000 --- a/OpenSim/Data/SQLite/Resources/019_RegionStore.sql +++ /dev/null @@ -1,5 +0,0 @@ -BEGIN; - -ALTER TABLE regionsettings ADD COLUMN map_tile_ID varchar(36) NOT NULL default '00000000-0000-0000-0000-000000000000'; - -COMMIT; \ No newline at end of file diff --git a/OpenSim/Data/SQLite/Resources/020_RegionStore.sql b/OpenSim/Data/SQLite/Resources/020_RegionStore.sql deleted file mode 100644 index 39cb752979..0000000000 --- a/OpenSim/Data/SQLite/Resources/020_RegionStore.sql +++ /dev/null @@ -1,6 +0,0 @@ -BEGIN; - -ALTER TABLE prims ADD COLUMN MediaURL varchar(255); -ALTER TABLE primshapes ADD COLUMN Media TEXT; - -COMMIT; \ No newline at end of file diff --git a/OpenSim/Data/SQLite/Resources/RegionStore.migrations b/OpenSim/Data/SQLite/Resources/RegionStore.migrations index 0c421ec037..5e2045b1b9 100644 --- a/OpenSim/Data/SQLite/Resources/RegionStore.migrations +++ b/OpenSim/Data/SQLite/Resources/RegionStore.migrations @@ -448,11 +448,22 @@ update land COMMIT; :VERSION 19 -BEGIN ; -ALTER TABLE `land` ADD COLUMN `MediaType` VARCHAR(32) NOT NULL DEFAULT 'none/none' ; +BEGIN; +ALTER TABLE regionsettings ADD COLUMN map_tile_ID varchar(36) NOT NULL default '00000000-0000-0000-0000-000000000000'; +COMMIT; + +:VERSION 20 +BEGIN; +ALTER TABLE prims ADD COLUMN MediaURL varchar(255); +ALTER TABLE primshapes ADD COLUMN Media TEXT; +COMMIT; + +:VERSION 21 +BEGIN; +ALTER TABLE `land` ADD COLUMN `MediaType` VARCHAR(32) NOT NULL DEFAULT 'none/none'; ALTER TABLE `land` ADD COLUMN `MediaDescription` VARCHAR(255) NOT NULL DEFAULT ''; ALTER TABLE `land` ADD COLUMN `MediaSize` VARCHAR(16) NOT NULL DEFAULT '0,0'; ALTER TABLE `land` ADD COLUMN `MediaLoop` BOOLEAN NOT NULL DEFAULT FALSE; ALTER TABLE `land` ADD COLUMN `ObscureMusic` BOOLEAN NOT NULL DEFAULT FALSE; ALTER TABLE `land` ADD COLUMN `ObscureMedia` BOOLEAN NOT NULL DEFAULT FALSE; -COMMIT ; \ No newline at end of file +COMMIT; \ No newline at end of file From 93edc75147d5a819cc4e30699ecb859820aa9b7f Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 2 Sep 2010 00:00:54 +0100 Subject: [PATCH 09/57] Disallow modification of system folders. Prevent changing the type of folders and prevent resetting the version number --- .../InventoryService/XInventoryService.cs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs index 84306e7296..02d7170244 100644 --- a/OpenSim/Services/InventoryService/XInventoryService.cs +++ b/OpenSim/Services/InventoryService/XInventoryService.cs @@ -293,13 +293,28 @@ namespace OpenSim.Services.InventoryService public virtual bool AddFolder(InventoryFolderBase folder) { + InventoryFolderBase check = GetFolder(folder); + if (check != null) + return false; + XInventoryFolder xFolder = ConvertFromOpenSim(folder); return m_Database.StoreFolder(xFolder); } public virtual bool UpdateFolder(InventoryFolderBase folder) { - return AddFolder(folder); + XInventoryFolder xFolder = ConvertFromOpenSim(folder); + InventoryFolderBase check = GetFolder(folder); + if (check == null) + return AddFolder(folder); + + if (check.Type != -1 || xFolder.type != -1) + return false; + + xFolder.version = check.Version; + xFolder.folderID = check.ID; + + return m_Database.StoreFolder(xFolder); } public virtual bool MoveFolder(InventoryFolderBase folder) From 7efe7feef5cb4bb001387eb3b90e819a61ef9107 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 2 Sep 2010 00:02:07 +0100 Subject: [PATCH 10/57] Update: Allow the version to increase only --- OpenSim/Services/InventoryService/XInventoryService.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs index 02d7170244..febb0afbd2 100644 --- a/OpenSim/Services/InventoryService/XInventoryService.cs +++ b/OpenSim/Services/InventoryService/XInventoryService.cs @@ -311,7 +311,8 @@ namespace OpenSim.Services.InventoryService if (check.Type != -1 || xFolder.type != -1) return false; - xFolder.version = check.Version; + if (xFolder.version < check.Version) + xFolder.version = check.Version; xFolder.folderID = check.ID; return m_Database.StoreFolder(xFolder); From 203b7de2663934ae5e7f88061d97284dac961568 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 2 Sep 2010 00:04:17 +0100 Subject: [PATCH 11/57] Allow increasing the version in system folders --- OpenSim/Services/InventoryService/XInventoryService.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs index febb0afbd2..97af44d51f 100644 --- a/OpenSim/Services/InventoryService/XInventoryService.cs +++ b/OpenSim/Services/InventoryService/XInventoryService.cs @@ -309,7 +309,13 @@ namespace OpenSim.Services.InventoryService return AddFolder(folder); if (check.Type != -1 || xFolder.type != -1) - return false; + { + if (xFolder.version > check.Version) + return false; + check.Version = xFolder.version; + xFolder = ConvertFromOpenSim(check); + return m_Database.StoreFolder(xFolder); + } if (xFolder.version < check.Version) xFolder.version = check.Version; From bbdf6cab50bb5f5486130cf1443087d1f4fb84e2 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 2 Sep 2010 00:20:57 +0100 Subject: [PATCH 12/57] Fix cast issue --- OpenSim/Services/InventoryService/XInventoryService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs index 97af44d51f..fb395ec976 100644 --- a/OpenSim/Services/InventoryService/XInventoryService.cs +++ b/OpenSim/Services/InventoryService/XInventoryService.cs @@ -312,7 +312,7 @@ namespace OpenSim.Services.InventoryService { if (xFolder.version > check.Version) return false; - check.Version = xFolder.version; + check.Version = (ushort)xFolder.version; xFolder = ConvertFromOpenSim(check); return m_Database.StoreFolder(xFolder); } From 7128e1a4bacf811df0268695eaf4c747fd53955b Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Thu, 2 Sep 2010 16:10:44 +0200 Subject: [PATCH 13/57] Implement UploadBakedTexture cap --- OpenSim/Framework/Capabilities/Caps.cs | 105 +++++++++++++++++++++++++ 1 file changed, 105 insertions(+) diff --git a/OpenSim/Framework/Capabilities/Caps.cs b/OpenSim/Framework/Capabilities/Caps.cs index 0db7bb970f..8a339fedc9 100644 --- a/OpenSim/Framework/Capabilities/Caps.cs +++ b/OpenSim/Framework/Capabilities/Caps.cs @@ -44,6 +44,8 @@ namespace OpenSim.Framework.Capabilities string assetName, string description, UUID assetID, UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, string assetType); + public delegate void UploadedBakedTexture(UUID assetID, byte[] data); + public delegate UUID UpdateItem(UUID itemID, byte[] data); public delegate void UpdateTaskScript(UUID itemID, UUID primID, bool isScriptRunning, byte[] data, ref ArrayList errors); @@ -97,6 +99,7 @@ namespace OpenSim.Framework.Capabilities // private static readonly string m_provisionVoiceAccountRequestPath = "0008/";// This is in a module. // private static readonly string m_remoteParcelRequestPath = "0009/";// This is in the LandManagementModule. + private static readonly string m_uploadBakedTexturePath = "0010/";// This is in the LandManagementModule. //private string eventQueue = "0100/"; private IScene m_Scene; @@ -185,6 +188,8 @@ namespace OpenSim.Framework.Capabilities m_capsHandlers["UpdateScriptTaskInventory"] = new RestStreamHandler("POST", capsBase + m_notecardTaskUpdatePath, ScriptTaskInventory); m_capsHandlers["UpdateScriptTask"] = m_capsHandlers["UpdateScriptTaskInventory"]; + m_capsHandlers["UploadBakedTexture"] = + new RestStreamHandler("POST", capsBase + m_uploadBakedTexturePath, UploadBakedTexture); } catch (Exception e) @@ -742,6 +747,50 @@ namespace OpenSim.Framework.Capabilities return null; } + public string UploadBakedTexture(string request, string path, + string param, OSHttpRequest httpRequest, + OSHttpResponse httpResponse) + { + try + { + m_log.Debug("[CAPS]: UploadBakedTexture Request in region: " + + m_regionName); + + string capsBase = "/CAPS/" + m_capsObjectPath; + string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); + + BakedTextureUploader uploader = + new BakedTextureUploader( capsBase + uploaderPath, + m_httpListener); + uploader.OnUpLoad += BakedTextureUploaded; + + m_httpListener.AddStreamHandler( + new BinaryStreamHandler("POST", capsBase + uploaderPath, + uploader.uploaderCaps)); + + string protocol = "http://"; + + if (m_httpListener.UseSSL) + protocol = "https://"; + + string uploaderURL = protocol + m_httpListenerHostName + ":" + + m_httpListenPort.ToString() + capsBase + uploaderPath; + + LLSDAssetUploadResponse uploadResponse = + new LLSDAssetUploadResponse(); + uploadResponse.uploader = uploaderURL; + uploadResponse.state = "upload"; + + return LLSDHelpers.SerialiseLLSDReply(uploadResponse); + } + catch (Exception e) + { + m_log.Error("[CAPS]: " + e.ToString()); + } + + return null; + } + /// /// Called by the notecard update handler. Provides a URL to which the client can upload a new asset. /// @@ -925,6 +974,17 @@ namespace OpenSim.Framework.Capabilities } } + public void BakedTextureUploaded(UUID assetID, byte[] data) + { + m_log.DebugFormat("[CAPS]: Received baked texture {0}", assetID.ToString()); + AssetBase asset; + asset = new AssetBase(assetID, "Baked Texture", (sbyte)AssetType.Texture, m_agentID.ToString()); + asset.Data = data; + asset.Temporary = true; + asset.Local = true; + m_assetCache.Store(asset); + } + /// /// Called when new asset data for an agent inventory item update has been uploaded. /// @@ -1243,5 +1303,50 @@ namespace OpenSim.Framework.Capabilities fs.Close(); } } + + public class BakedTextureUploader + { + public event UploadedBakedTexture OnUpLoad; + private UploadedBakedTexture handlerUpLoad = null; + + private string uploaderPath = String.Empty; + private UUID newAssetID; + private IHttpServer httpListener; + + public BakedTextureUploader(string path, IHttpServer httpServer) + { + newAssetID = UUID.Random(); + uploaderPath = path; + httpListener = httpServer; + } + + /// + /// + /// + /// + /// + /// + /// + public string uploaderCaps(byte[] data, string path, string param) + { + string res = String.Empty; + LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete(); + uploadComplete.new_asset = newAssetID.ToString(); + uploadComplete.new_inventory_item = UUID.Zero; + uploadComplete.state = "complete"; + + res = LLSDHelpers.SerialiseLLSDReply(uploadComplete); + + httpListener.RemoveStreamHandler("POST", uploaderPath); + + handlerUpLoad = OnUpLoad; + if (handlerUpLoad != null) + { + handlerUpLoad(newAssetID, data); + } + + return res; + } + } } } From ed72396d9b796b8bb084e0db68426eae432123d1 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Thu, 2 Sep 2010 19:49:42 +0200 Subject: [PATCH 14/57] Show when appearance is sent to an avatar to help track down failure \to display avatars --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index fddb966f9b..3d4269fe11 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -3408,6 +3408,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP avp.Sender.IsTrial = false; avp.Sender.ID = agentID; + m_log.DebugFormat("[CLIENT]: Sending appearance for {0} to {1}", agentID.ToString(), AgentId.ToString()); OutPacket(avp, ThrottleOutPacketType.Task); } From 7720419fc7e74758125dc401eb3258ba5bd9b4f8 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Thu, 2 Sep 2010 20:08:39 +0200 Subject: [PATCH 15/57] Experimentally comment the sending of unbaked avatars --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 339d0c422f..facbc97d1e 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2464,7 +2464,9 @@ namespace OpenSim.Region.Framework.Scenes m_controllingClient.SendAvatarDataImmediate(this); SendInitialFullUpdateToAllClients(); - SendAppearanceToAllOtherAgents(); + // Experimentally commenting this. We don't have bakes at this time + // and 1.23 will not display an avatar without bakes. + //SendAppearanceToAllOtherAgents(); } /// From 1c8bc9b7b6a62b38d9378ec08853ab2237c7a53a Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Thu, 2 Sep 2010 20:51:27 +0200 Subject: [PATCH 16/57] Remove commented code and the comment, as the change has proven out --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index facbc97d1e..cc9355e031 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2464,9 +2464,6 @@ namespace OpenSim.Region.Framework.Scenes m_controllingClient.SendAvatarDataImmediate(this); SendInitialFullUpdateToAllClients(); - // Experimentally commenting this. We don't have bakes at this time - // and 1.23 will not display an avatar without bakes. - //SendAppearanceToAllOtherAgents(); } /// From d96f5fa57db52c872b8e431bc9a1137f0525cbc5 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 2 Sep 2010 16:36:05 -0700 Subject: [PATCH 17/57] Quick fix for making global references for gatekeepers that are not domain:port work. This needs a serious rewrite, as the assumption domain:port doesn't hold from here on. Just quick-fixing for now. --- .../Hypergrid/GatekeeperServiceConnector.cs | 6 ++-- .../Hypergrid/UserAgentServiceConnector.cs | 7 +++-- .../Simulation/SimulationServiceConnector.cs | 24 +++++++++------ .../Services/GridService/HypergridLinker.cs | 29 ++++++++++--------- 4 files changed, 38 insertions(+), 28 deletions(-) diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs index 024b42d433..77e3b20b22 100644 --- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs @@ -86,8 +86,8 @@ namespace OpenSim.Services.Connectors.Hypergrid paramList.Add(hash); XmlRpcRequest request = new XmlRpcRequest("link_region", paramList); - string uri = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/"; - //m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Linking to " + uri); + string uri = "http://" + ((info.ServerURI == string.Empty) ? info.ExternalEndPoint.Address + ":" + info.HttpPort + "/" : info.ServerURI); + m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Linking to " + uri); XmlRpcResponse response = null; try { @@ -188,7 +188,7 @@ namespace OpenSim.Services.Connectors.Hypergrid paramList.Add(hash); XmlRpcRequest request = new XmlRpcRequest("get_region", paramList); - string uri = "http://" + gatekeeper.ExternalEndPoint.Address + ":" + gatekeeper.HttpPort + "/"; + string uri = "http://" + ((gatekeeper.ServerURI == string.Empty) ? gatekeeper.ExternalEndPoint.Address + ":" + gatekeeper.HttpPort + "/" : gatekeeper.ServerURI); m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: contacting " + uri); XmlRpcResponse response = null; try diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs index 45019373cf..7fa086ac68 100644 --- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs @@ -51,15 +51,16 @@ namespace OpenSim.Services.Connectors.Hypergrid MethodBase.GetCurrentMethod().DeclaringType); string m_ServerURL; - Uri m_Uri; public UserAgentServiceConnector(string url) { m_ServerURL = url; + // Doing this here, because XML-RPC or mono have some strong ideas about + // caching DNS translations. try { - m_Uri = new Uri(m_ServerURL); + Uri m_Uri = new Uri(m_ServerURL); IPAddress ip = Util.GetHostFromDNS(m_Uri.Host); - m_ServerURL = "http://" + ip.ToString() + ":" + m_Uri.Port; + m_ServerURL = m_ServerURL.Replace(m_Uri.Host, ip.ToString()); ; } catch (Exception e) { diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index 2b96b96e30..df818f5084 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs @@ -104,17 +104,23 @@ namespace OpenSim.Services.Connectors.Simulation return false; } - // Eventually, we want to use a caps url instead of the agentID string uri = string.Empty; - try + + // HACK -- Simian grid make it work!!! + if (destination.ServerURI != string.Empty) + uri = "http://" + destination.ServerURI + AgentPath() + aCircuit.AgentID + "/"; + else { - uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + aCircuit.AgentID + "/"; - } - catch (Exception e) - { - m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent create. Reason: " + e.Message); - reason = e.Message; - return false; + try + { + uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + aCircuit.AgentID + "/"; + } + catch (Exception e) + { + m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent create. Reason: " + e.Message); + reason = e.Message; + return false; + } } //Console.WriteLine(" >>> DoCreateChildAgentCall <<< " + uri); diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 3d722eca96..b86fb6f01c 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -158,7 +158,7 @@ namespace OpenSim.Services.GridService string host = "127.0.0.1"; string portstr; string regionName = ""; - uint port = 9000; + uint port = 0; string[] parts = mapName.Split(new char[] { ':' }); if (parts.Length >= 1) { @@ -177,18 +177,16 @@ namespace OpenSim.Services.GridService regionName = parts[2]; } - // Sanity check. - //IPAddress ipaddr = null; - try - { - //ipaddr = Util.GetHostFromDNS(host); - Util.GetHostFromDNS(host); - } - catch - { - reason = "Malformed hostname"; - return null; - } + //// Sanity check. + //try + //{ + // Util.GetHostFromDNS(host); + //} + //catch + //{ + // reason = "Malformed hostname"; + // return null; + //} GridRegion regInfo; bool success = TryCreateLink(scopeID, xloc, yloc, regionName, port, host, out regInfo, out reason); @@ -217,6 +215,11 @@ namespace OpenSim.Services.GridService regInfo.RegionLocY = yloc; regInfo.ScopeID = scopeID; + // Big HACK for Simian Grid !!! + // We need to clean up all URLs used in OpenSim !!! + if (externalHostName.Contains("/")) + regInfo.ServerURI = externalHostName; + try { regInfo.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)0); From 457160afc3cc0878b068486a7cbb8a41a5f18520 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Fri, 3 Sep 2010 03:16:08 +0200 Subject: [PATCH 18/57] Fix an issue with rezzing scripted objects. --- OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index c5994b2397..1959427cf3 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -278,7 +278,7 @@ namespace OpenSim.Region.Framework.Scenes if (!m_part.ParentGroup.Scene.RegionInfo.RegionSettings.DisableScripts) { - if (stateSource == 1 && // Prim crossing + if (stateSource == 2 && // Prim crossing m_part.ParentGroup.Scene.m_trustBinaries) { m_items.LockItemsForWrite(true); @@ -1263,4 +1263,4 @@ namespace OpenSim.Region.Framework.Scenes Items.LockItemsForRead(false); } } -} \ No newline at end of file +} From 17a26c3701f7e8de8a4fc223c2069798223b245d Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Fri, 3 Sep 2010 03:16:08 +0200 Subject: [PATCH 19/57] Fix an issue with rezzing scripted objects. --- OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index d7767bd644..ca089a1b94 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -252,7 +252,7 @@ namespace OpenSim.Region.Framework.Scenes if (!m_part.ParentGroup.Scene.RegionInfo.RegionSettings.DisableScripts) { - if (stateSource == 1 && // Prim crossing + if (stateSource == 2 && // Prim crossing m_part.ParentGroup.Scene.m_trustBinaries) { lock (m_items) @@ -1095,4 +1095,4 @@ namespace OpenSim.Region.Framework.Scenes } } } -} \ No newline at end of file +} From 85e9160552ea72e469863e077d1084da80e12222 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 3 Sep 2010 09:02:08 -0700 Subject: [PATCH 20/57] More tweaks related to my previous commit. Tweaks sux. --- .../Connectors/Hypergrid/GatekeeperServiceConnector.cs | 4 ++-- .../Connectors/Simulation/SimulationServiceConnector.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs index 77e3b20b22..dd156aa206 100644 --- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs @@ -86,7 +86,7 @@ namespace OpenSim.Services.Connectors.Hypergrid paramList.Add(hash); XmlRpcRequest request = new XmlRpcRequest("link_region", paramList); - string uri = "http://" + ((info.ServerURI == string.Empty) ? info.ExternalEndPoint.Address + ":" + info.HttpPort + "/" : info.ServerURI); + string uri = "http://" + ((info.ServerURI == string.Empty && !info.ServerURI.StartsWith("http:")) ? info.ExternalEndPoint.Address + ":" + info.HttpPort + "/" : info.ServerURI); m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Linking to " + uri); XmlRpcResponse response = null; try @@ -188,7 +188,7 @@ namespace OpenSim.Services.Connectors.Hypergrid paramList.Add(hash); XmlRpcRequest request = new XmlRpcRequest("get_region", paramList); - string uri = "http://" + ((gatekeeper.ServerURI == string.Empty) ? gatekeeper.ExternalEndPoint.Address + ":" + gatekeeper.HttpPort + "/" : gatekeeper.ServerURI); + string uri = "http://" + ((gatekeeper.ServerURI == string.Empty && !gatekeeper.ServerURI.StartsWith("http:")) ? gatekeeper.ExternalEndPoint.Address + ":" + gatekeeper.HttpPort + "/" : gatekeeper.ServerURI); m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: contacting " + uri); XmlRpcResponse response = null; try diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index df818f5084..b2dec96ac7 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs @@ -107,7 +107,7 @@ namespace OpenSim.Services.Connectors.Simulation string uri = string.Empty; // HACK -- Simian grid make it work!!! - if (destination.ServerURI != string.Empty) + if (destination.ServerURI != string.Empty && !destination.ServerURI.StartsWith("http:")) uri = "http://" + destination.ServerURI + AgentPath() + aCircuit.AgentID + "/"; else { From 77384eb28b51d89ac73bd76346790e7a6b68a2f3 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 3 Sep 2010 09:26:33 -0700 Subject: [PATCH 21/57] Another tweak. Sux^2 --- .../Connectors/Hypergrid/GatekeeperServiceConnector.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs index dd156aa206..7431f041bd 100644 --- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs @@ -86,7 +86,7 @@ namespace OpenSim.Services.Connectors.Hypergrid paramList.Add(hash); XmlRpcRequest request = new XmlRpcRequest("link_region", paramList); - string uri = "http://" + ((info.ServerURI == string.Empty && !info.ServerURI.StartsWith("http:")) ? info.ExternalEndPoint.Address + ":" + info.HttpPort + "/" : info.ServerURI); + string uri = "http://" + ((info.ServerURI != string.Empty && !info.ServerURI.StartsWith("http:")) ? info.ServerURI : info.ExternalEndPoint.Address + ":" + info.HttpPort + "/" ); m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Linking to " + uri); XmlRpcResponse response = null; try @@ -188,7 +188,7 @@ namespace OpenSim.Services.Connectors.Hypergrid paramList.Add(hash); XmlRpcRequest request = new XmlRpcRequest("get_region", paramList); - string uri = "http://" + ((gatekeeper.ServerURI == string.Empty && !gatekeeper.ServerURI.StartsWith("http:")) ? gatekeeper.ExternalEndPoint.Address + ":" + gatekeeper.HttpPort + "/" : gatekeeper.ServerURI); + string uri = "http://" + ((gatekeeper.ServerURI != string.Empty && !gatekeeper.ServerURI.StartsWith("http:")) ? gatekeeper.ServerURI : gatekeeper.ExternalEndPoint.Address + ":" + gatekeeper.HttpPort + "/" ); m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: contacting " + uri); XmlRpcResponse response = null; try From 5bbf793f9e7c1607d1ebb01e886375c1a74adafb Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 3 Sep 2010 10:01:18 -0700 Subject: [PATCH 22/57] One last tweak, hopefully. --- .../Connectors/Hypergrid/GatekeeperServiceConnector.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs index 7431f041bd..f5b59823e6 100644 --- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs @@ -86,7 +86,7 @@ namespace OpenSim.Services.Connectors.Hypergrid paramList.Add(hash); XmlRpcRequest request = new XmlRpcRequest("link_region", paramList); - string uri = "http://" + ((info.ServerURI != string.Empty && !info.ServerURI.StartsWith("http:")) ? info.ServerURI : info.ExternalEndPoint.Address + ":" + info.HttpPort + "/" ); + string uri = "http://" + ((info.ServerURI != null && info.ServerURI != string.Empty && !info.ServerURI.StartsWith("http:")) ? info.ServerURI : info.ExternalEndPoint.Address + ":" + info.HttpPort + "/" ); m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Linking to " + uri); XmlRpcResponse response = null; try @@ -188,7 +188,7 @@ namespace OpenSim.Services.Connectors.Hypergrid paramList.Add(hash); XmlRpcRequest request = new XmlRpcRequest("get_region", paramList); - string uri = "http://" + ((gatekeeper.ServerURI != string.Empty && !gatekeeper.ServerURI.StartsWith("http:")) ? gatekeeper.ServerURI : gatekeeper.ExternalEndPoint.Address + ":" + gatekeeper.HttpPort + "/" ); + string uri = "http://" + ((gatekeeper.ServerURI != null && gatekeeper.ServerURI != string.Empty && !gatekeeper.ServerURI.StartsWith("http:")) ? gatekeeper.ServerURI : gatekeeper.ExternalEndPoint.Address + ":" + gatekeeper.HttpPort + "/"); m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: contacting " + uri); XmlRpcResponse response = null; try From a5cce8d6d721da5e6f63a9564f531bf27be75320 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 3 Sep 2010 10:13:41 -0700 Subject: [PATCH 23/57] Last+1 tweak. --- .../Connectors/Simulation/SimulationServiceConnector.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index b2dec96ac7..c7d186966b 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs @@ -107,7 +107,7 @@ namespace OpenSim.Services.Connectors.Simulation string uri = string.Empty; // HACK -- Simian grid make it work!!! - if (destination.ServerURI != string.Empty && !destination.ServerURI.StartsWith("http:")) + if (destination != null && destination.ServerURI != string.Empty && !destination.ServerURI.StartsWith("http:")) uri = "http://" + destination.ServerURI + AgentPath() + aCircuit.AgentID + "/"; else { From 0a0f38b23c2674d98ab055b23d4bbd20896cc4fd Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 3 Sep 2010 10:31:16 -0700 Subject: [PATCH 24/57] Last+2 tweak --- .../Connectors/Simulation/SimulationServiceConnector.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index c7d186966b..a5f748f0c4 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs @@ -107,7 +107,7 @@ namespace OpenSim.Services.Connectors.Simulation string uri = string.Empty; // HACK -- Simian grid make it work!!! - if (destination != null && destination.ServerURI != string.Empty && !destination.ServerURI.StartsWith("http:")) + if (destination.ServerURI != null && destination.ServerURI != string.Empty && !destination.ServerURI.StartsWith("http:")) uri = "http://" + destination.ServerURI + AgentPath() + aCircuit.AgentID + "/"; else { From 8daea4d7c005d746989a5635c71bd11cdb034482 Mon Sep 17 00:00:00 2001 From: Micheil Merlin Date: Sat, 28 Aug 2010 22:44:18 -0500 Subject: [PATCH 25/57] llRot2Euler Tests --- .../ScriptEngine/Shared/Tests/LSL_ApiTest.cs | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs index 358ce220b5..dfc9aa3dea 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs @@ -134,5 +134,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests #endregion + [Test] + // llRot2Euler test. + public void TestllRot2Euler() + { + // 180, 90 and zero degree rotations. + CheckllRot2Euler(new LSL_Types.Quaternion(1.0f, 0.0f, 0.0f, 0.0f), new LSL_Types.Vector3(Math.PI, 0.0f, 0.0f)); + CheckllRot2Euler(new LSL_Types.Quaternion(0.0f, 1.0f, 0.0f, 0.0f), new LSL_Types.Vector3(Math.PI, 0.0f, Math.PI)); + CheckllRot2Euler(new LSL_Types.Quaternion(0.0f, 0.0f, 1.0f, 0.0f), new LSL_Types.Vector3(0.0f, 0.0f, Math.PI)); + CheckllRot2Euler(new LSL_Types.Quaternion(0.0f, 0.0f, 0.0f, 1.0f), new LSL_Types.Vector3(0.0f, 0.0f, 0.0f)); + CheckllRot2Euler(new LSL_Types.Quaternion(-0.5f, -0.5f, 0.5f, 0.5f), new LSL_Types.Vector3(0, -Math.PI / 2.0f, Math.PI / 2.0f)); + CheckllRot2Euler(new LSL_Types.Quaternion(-0.707107f, 0.0f, 0.0f, -0.707107f), new LSL_Types.Vector3(Math.PI / 2.0f, 0.0f, 0.0f)); + // A couple of messy rotations. + CheckllRot2Euler(new LSL_Types.Quaternion(1.0f, 5.651f, -3.1f, 67.023f), new LSL_Types.Vector3(0.037818f, 0.166447f, -0.095595f)); + CheckllRot2Euler(new LSL_Types.Quaternion(0.719188f, -0.408934f, -0.363998f, -0.427841f), new LSL_Types.Vector3(-1.954769f, -0.174533f, 1.151917f)); + } + + private void CheckllRot2Euler(LSL_Types.Quaternion rot, LSL_Types.Vector3 eulerCheck) + { + // Call LSL function to convert quaternion rotaion to euler radians. + LSL_Types.Vector3 eulerCalc = m_lslApi.llRot2Euler(rot); + // Check upper and lower bounds of x, y and z. + // This type of check is performed as opposed to comparing for equal numbers, in order to allow slight + // differences in accuracy. + Assert.Greater(eulerCalc.x, eulerCheck.x - ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler X lower bounds check fail"); + Assert.Less(eulerCalc.x, eulerCheck.x + ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler X upper bounds check fail"); + Assert.Greater(eulerCalc.y, eulerCheck.y - ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler Y lower bounds check fail"); + Assert.Less(eulerCalc.y, eulerCheck.y + ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler Y upper bounds check fail"); + Assert.Greater(eulerCalc.z, eulerCheck.z - ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler Z lower bounds check fail"); + Assert.Less(eulerCalc.z, eulerCheck.z + ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler Z upper bounds check fail"); + } } } From 8d2e8b7d5c62cfd024ade222e27274e88c85d7d2 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 3 Sep 2010 21:28:57 +0100 Subject: [PATCH 26/57] minor: remove mono compiler warnings --- .../Inventory/Archiver/InventoryArchiveUtils.cs | 2 +- .../Framework/EventQueue/EventQueueHelper.cs | 12 ++++++------ .../InventoryAccess/HGInventoryAccessModule.cs | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs index 8343091773..47e34dcdd6 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs @@ -41,7 +41,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver /// public static class InventoryArchiveUtils { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); +// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); // Character used for escaping the path delimter ("\/") and itself ("\\") in human escaped strings public static readonly char ESCAPE_CHARACTER = '\\'; diff --git a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs index 6294935215..b62df18c10 100644 --- a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs +++ b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs @@ -54,12 +54,12 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue }; } - private static byte[] uintToByteArray(uint uIntValue) - { - byte[] result = new byte[4]; - Utils.UIntToBytesBig(uIntValue, result, 0); - return result; - } +// private static byte[] uintToByteArray(uint uIntValue) +// { +// byte[] result = new byte[4]; +// Utils.UIntToBytesBig(uIntValue, result, 0); +// return result; +// } public static OSD buildEvent(string eventName, OSD eventBody) { diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs index c673b31bbc..125a397d0e 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs @@ -132,7 +132,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess } // DO NOT OVERRIDE THE BASE METHOD - public virtual UUID DeleteToInventory(DeRezAction action, UUID folderID, + public new virtual UUID DeleteToInventory(DeRezAction action, UUID folderID, SceneObjectGroup objectGroup, IClientAPI remoteClient) { UUID assetID = base.DeleteToInventory(action, folderID, new List() {objectGroup}, remoteClient); From d6deebdd63d16f04a643b1bc26c4ccc4e59f68b7 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 3 Sep 2010 21:34:31 +0100 Subject: [PATCH 27/57] Add another variant of password hash construction to SimianAuthenticationServiceConnector.CheckPassword() This might be unique to the inventory archiver password check, though at the time it was written, hash construction there should have been identical to other parts of opensim This is from patch http://opensimulator.org/mantis/view.php?id=4983. Thanks cmickeyb. --- .../SimianGrid/SimianAuthenticationServiceConnector.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs index 7a96a05dea..9c4718e816 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) Contributors, http://opensimulator.org/ * See CONTRIBUTORS.TXT for a full list of copyright holders. * @@ -253,7 +253,8 @@ namespace OpenSim.Services.Connectors.SimianGrid if (password == simianGridCredential || "$1$" + password == simianGridCredential || "$1$" + Utils.MD5String(password) == simianGridCredential || - Utils.MD5String(password) == simianGridCredential) + Utils.MD5String(password) == simianGridCredential || + "$1$" + Utils.MD5String(password + ":") == simianGridCredential) { authorizeResult = Authorize(userID); return true; From 4f79143f3f058b0570c073b668f4ea088e541a43 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Fri, 3 Sep 2010 13:36:35 -0700 Subject: [PATCH 28/57] * Removed Simian.IsSimianEnabled() call, changed the SimianGrid connectors to handle initialization as graceful as possible with the current broken way region module initialization is done * Added config-include/HyperSimianGrid.ini option for connecting to SimianGrid with HyperGrid enabled (work in progress on the SimianGrid side) --- .../SimianGrid/SimianAssetServiceConnector.cs | 25 +++--- .../SimianAuthenticationServiceConnector.cs | 24 +++--- .../SimianAvatarServiceConnector.cs | 25 +++--- .../Connectors/SimianGrid/SimianGrid.cs | 14 ---- .../SimianGrid/SimianGridServiceConnector.cs | 22 +++--- .../SimianInventoryServiceConnector.cs | 44 +++++------ .../SimianPresenceServiceConnector.cs | 22 +++--- .../Connectors/SimianGrid/SimianProfiles.cs | 42 +++------- .../SimianUserAccountServiceConnector.cs | 25 +++--- bin/OpenSim.ini.example | 11 +-- bin/config-include/HyperSimianGrid.ini | 77 +++++++++++++++++++ 11 files changed, 166 insertions(+), 165 deletions(-) create mode 100644 bin/config-include/HyperSimianGrid.ini diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs index 616b5a7663..3a4f84f69c 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs @@ -85,27 +85,20 @@ namespace OpenSim.Services.Connectors.SimianGrid public void Initialise(IConfigSource source) { - if (Simian.IsSimianEnabled(source, "AssetServices", this.Name)) + IConfig gridConfig = source.Configs["AssetService"]; + if (gridConfig != null) { - IConfig gridConfig = source.Configs["AssetService"]; - if (gridConfig == null) - { - m_log.Error("[SIMIAN ASSET CONNECTOR]: AssetService missing from OpenSim.ini"); - throw new Exception("Asset connector init error"); - } - string serviceUrl = gridConfig.GetString("AssetServerURI"); - if (String.IsNullOrEmpty(serviceUrl)) + if (!String.IsNullOrEmpty(serviceUrl)) { - m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI in section AssetService"); - throw new Exception("Asset connector init error"); + if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) + serviceUrl = serviceUrl + '/'; + m_serverUrl = serviceUrl; } - - if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) - serviceUrl = serviceUrl + '/'; - - m_serverUrl = serviceUrl; } + + if (String.IsNullOrEmpty(m_serverUrl)) + m_log.Info("[SIMIAN ASSET CONNECTOR]: No AssetServerURI specified, disabling connector"); } #region IAssetService diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs index 7a96a05dea..7f48bbd727 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs @@ -73,24 +73,20 @@ namespace OpenSim.Services.Connectors.SimianGrid public void Initialise(IConfigSource source) { - if (Simian.IsSimianEnabled(source, "AuthenticationServices", this.Name)) + IConfig gridConfig = source.Configs["AuthenticationService"]; + if (gridConfig != null) { - IConfig assetConfig = source.Configs["AuthenticationService"]; - if (assetConfig == null) + string serviceUrl = gridConfig.GetString("AuthenticationServerURI"); + if (!String.IsNullOrEmpty(serviceUrl)) { - m_log.Error("[SIMIAN AUTH CONNECTOR]: AuthenticationService missing from OpenSim.ini"); - throw new Exception("Authentication connector init error"); + if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) + serviceUrl = serviceUrl + '/'; + m_serverUrl = serviceUrl; } - - string serviceURI = assetConfig.GetString("AuthenticationServerURI"); - if (String.IsNullOrEmpty(serviceURI)) - { - m_log.Error("[SIMIAN AUTH CONNECTOR]: No Server URI named in section AuthenticationService"); - throw new Exception("Authentication connector init error"); - } - - m_serverUrl = serviceURI; } + + if (String.IsNullOrEmpty(m_serverUrl)) + m_log.Info("[SIMIAN AUTH CONNECTOR]: No AuthenticationServerURI specified, disabling connector"); } public string Authenticate(UUID principalID, string password, int lifetime) diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs index 734bdd2e48..c2e20a3093 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs @@ -78,27 +78,20 @@ namespace OpenSim.Services.Connectors.SimianGrid public void Initialise(IConfigSource source) { - if (Simian.IsSimianEnabled(source, "AvatarServices", this.Name)) + IConfig gridConfig = source.Configs["AvatarService"]; + if (gridConfig != null) { - IConfig gridConfig = source.Configs["AvatarService"]; - if (gridConfig == null) - { - m_log.Error("[SIMIAN AVATAR CONNECTOR]: AvatarService missing from OpenSim.ini"); - throw new Exception("Avatar connector init error"); - } - string serviceUrl = gridConfig.GetString("AvatarServerURI"); - if (String.IsNullOrEmpty(serviceUrl)) + if (!String.IsNullOrEmpty(serviceUrl)) { - m_log.Error("[SIMIAN AVATAR CONNECTOR]: No AvatarServerURI in section AvatarService"); - throw new Exception("Avatar connector init error"); + if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) + serviceUrl = serviceUrl + '/'; + m_serverUrl = serviceUrl; } - - if (!serviceUrl.EndsWith("/")) - serviceUrl = serviceUrl + '/'; - - m_serverUrl = serviceUrl; } + + if (String.IsNullOrEmpty(m_serverUrl)) + m_log.Info("[SIMIAN AVATAR CONNECTOR]: No AvatarServerURI specified, disabling connector"); } #region IAvatarService diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGrid.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGrid.cs index 7d97aaa3e8..847319c25a 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianGrid.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGrid.cs @@ -31,17 +31,3 @@ using Nini.Config; [assembly: Addin("SimianGrid", "1.0")] [assembly: AddinDependency("OpenSim", "0.5")] - -public static class Simian -{ - public static bool IsSimianEnabled(IConfigSource config, string moduleName, string connectorName) - { - if (config.Configs["Modules"] != null) - { - string module = config.Configs["Modules"].GetString(moduleName); - return !String.IsNullOrEmpty(module) && module.EndsWith(connectorName); - } - - return false; - } -} \ No newline at end of file diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs index fefdad6dc5..9d67ccbe51 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs @@ -98,24 +98,20 @@ namespace OpenSim.Services.Connectors.SimianGrid public void Initialise(IConfigSource source) { - if (Simian.IsSimianEnabled(source, "GridServices", this.Name)) + IConfig gridConfig = source.Configs["GridService"]; + if (gridConfig != null) { - IConfig gridConfig = source.Configs["GridService"]; - if (gridConfig == null) - { - m_log.Error("[SIMIAN GRID CONNECTOR]: GridService missing from OpenSim.ini"); - throw new Exception("Grid connector init error"); - } - string serviceUrl = gridConfig.GetString("GridServerURI"); - if (String.IsNullOrEmpty(serviceUrl)) + if (!String.IsNullOrEmpty(serviceUrl)) { - m_log.Error("[SIMIAN GRID CONNECTOR]: No Server URI named in section GridService"); - throw new Exception("Grid connector init error"); + if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) + serviceUrl = serviceUrl + '/'; + m_serverUrl = serviceUrl; } - - m_serverUrl = serviceUrl; } + + if (String.IsNullOrEmpty(m_serverUrl)) + m_log.Info("[SIMIAN GRID CONNECTOR]: No GridServerURI specified, disabling connector"); } #region IGridService diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs index 89c1a5a445..63aaad7bac 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs @@ -92,38 +92,30 @@ namespace OpenSim.Services.Connectors.SimianGrid public void Initialise(IConfigSource source) { - if (Simian.IsSimianEnabled(source, "InventoryServices", this.Name)) + IConfig gridConfig = source.Configs["InventoryService"]; + if (gridConfig != null) { - IConfig gridConfig = source.Configs["InventoryService"]; - if (gridConfig == null) - { - m_log.Error("[SIMIAN INVENTORY CONNECTOR]: InventoryService missing from OpenSim.ini"); - throw new Exception("Inventory connector init error"); - } - string serviceUrl = gridConfig.GetString("InventoryServerURI"); - if (String.IsNullOrEmpty(serviceUrl)) + if (!String.IsNullOrEmpty(serviceUrl)) { - m_log.Error("[SIMIAN INVENTORY CONNECTOR]: No Server URI named in section InventoryService"); - throw new Exception("Inventory connector init error"); - } + if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) + serviceUrl = serviceUrl + '/'; + m_serverUrl = serviceUrl; - m_serverUrl = serviceUrl; - - gridConfig = source.Configs["UserAccountService"]; - if (gridConfig != null) - { - serviceUrl = gridConfig.GetString("UserAccountServerURI"); - if (!String.IsNullOrEmpty(serviceUrl)) - m_userServerUrl = serviceUrl; - else - m_log.Info("[SIMIAN INVENTORY CONNECTOR]: No Server URI named in section UserAccountService"); - } - else - { - m_log.Warn("[SIMIAN INVENTORY CONNECTOR]: UserAccountService missing from OpenSim.ini"); + gridConfig = source.Configs["UserAccountService"]; + if (gridConfig != null) + { + serviceUrl = gridConfig.GetString("UserAccountServerURI"); + if (!String.IsNullOrEmpty(serviceUrl)) + m_userServerUrl = serviceUrl; + } } } + + if (String.IsNullOrEmpty(m_serverUrl)) + m_log.Info("[SIMIAN INVENTORY CONNECTOR]: No InventoryServerURI specified, disabling connector"); + else if (String.IsNullOrEmpty(m_userServerUrl)) + m_log.Info("[SIMIAN INVENTORY CONNECTOR]: No UserAccountServerURI specified, disabling connector"); } /// diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs index ca23e27347..778f3f4c29 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs @@ -103,24 +103,20 @@ namespace OpenSim.Services.Connectors.SimianGrid public void Initialise(IConfigSource source) { - if (Simian.IsSimianEnabled(source, "PresenceServices", this.Name)) + IConfig gridConfig = source.Configs["PresenceService"]; + if (gridConfig != null) { - IConfig gridConfig = source.Configs["PresenceService"]; - if (gridConfig == null) - { - m_log.Error("[SIMIAN PRESENCE CONNECTOR]: PresenceService missing from OpenSim.ini"); - throw new Exception("Presence connector init error"); - } - string serviceUrl = gridConfig.GetString("PresenceServerURI"); - if (String.IsNullOrEmpty(serviceUrl)) + if (!String.IsNullOrEmpty(serviceUrl)) { - m_log.Error("[SIMIAN PRESENCE CONNECTOR]: No PresenceServerURI in section PresenceService"); - throw new Exception("Presence connector init error"); + if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) + serviceUrl = serviceUrl + '/'; + m_serverUrl = serviceUrl; } - - m_serverUrl = serviceUrl; } + + if (String.IsNullOrEmpty(m_serverUrl)) + m_log.Info("[SIMIAN PRESENCE CONNECTOR]: No PresenceServerURI specified, disabling connector"); } #region IPresenceService diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs b/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs index d30d8805de..a817d7c2cd 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs @@ -88,44 +88,20 @@ namespace OpenSim.Services.Connectors.SimianGrid public void Initialise(IConfigSource source) { - if (Simian.IsSimianEnabled(source, "UserAccountServices", "SimianUserAccountServiceConnector")) + IConfig gridConfig = source.Configs["UserAccountService"]; + if (gridConfig != null) { - IConfig gridConfig = source.Configs["UserAccountService"]; - if (gridConfig == null) - { - m_log.Error("[SIMIAN PROFILES]: UserAccountService missing from OpenSim.ini"); - throw new Exception("Profiles init error"); - } - string serviceUrl = gridConfig.GetString("UserAccountServerURI"); - if (String.IsNullOrEmpty(serviceUrl)) + if (!String.IsNullOrEmpty(serviceUrl)) { - m_log.Error("[SIMIAN PROFILES]: No UserAccountServerURI in section UserAccountService"); - throw new Exception("Profiles init error"); - } - - if (!serviceUrl.EndsWith("/")) - serviceUrl = serviceUrl + '/'; - - m_serverUrl = serviceUrl; - IConfig profilesConfig = source.Configs["Profiles"]; - if (profilesConfig == null) - { - // Do not run this module by default. - return; - } - else - { - // if profiles aren't enabled, we're not needed. - // if we're not specified as the connector to use, then we're not wanted - if (profilesConfig.GetString("Module", String.Empty) != Name) - { - - return; - } - m_log.InfoFormat("[SIMIAN ACCOUNT CONNECTOR]: Initializing {0}", this.Name); + if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) + serviceUrl = serviceUrl + '/'; + m_serverUrl = serviceUrl; } } + + if (String.IsNullOrEmpty(m_serverUrl)) + m_log.Info("[SIMIAN PROFILES]: No UserAccountServerURI specified, disabling connector"); } private void ClientConnectHandler(IClientCore clientCore) diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs index 56c73ec7c9..4c8662fe40 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs @@ -77,25 +77,20 @@ namespace OpenSim.Services.Connectors.SimianGrid public void Initialise(IConfigSource source) { - if (Simian.IsSimianEnabled(source, "UserAccountServices", this.Name)) + IConfig gridConfig = source.Configs["UserAccountService"]; + if (gridConfig != null) { - IConfig assetConfig = source.Configs["UserAccountService"]; - if (assetConfig == null) + string serviceUrl = gridConfig.GetString("UserAccountServerURI"); + if (!String.IsNullOrEmpty(serviceUrl)) { - m_log.Error("[SIMIAN ACCOUNT CONNECTOR]: UserAccountService missing from OpenSim.ini"); - throw new Exception("User account connector init error"); + if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) + serviceUrl = serviceUrl + '/'; + m_serverUrl = serviceUrl; } - - string serviceURI = assetConfig.GetString("UserAccountServerURI"); - if (String.IsNullOrEmpty(serviceURI)) - { - m_log.Error("[SIMIAN ACCOUNT CONNECTOR]: No UserAccountServerURI in section UserAccountService, skipping SimianUserAccountServiceConnector"); - throw new Exception("User account connector init error"); - } - - m_accountCache = new ExpiringCache(); - m_serverUrl = serviceURI; } + + if (String.IsNullOrEmpty(m_serverUrl)) + m_log.Info("[SIMIAN ACCOUNT CONNECTOR]: No UserAccountServerURI specified, disabling connector"); } public UserAccount GetUserAccount(UUID scopeID, string firstName, string lastName) diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index dac6477623..71c7e550d0 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -1299,11 +1299,12 @@ [Architecture] ; Choose exactly one and only one of the architectures below. - Include-Standalone = "config-include/Standalone.ini" - ;Include-HGStandalone = "config-include/StandaloneHypergrid.ini" - ;Include-Grid = "config-include/Grid.ini" - ;Include-HGGrid = "config-include/GridHypergrid.ini" - ;Include-SimianGrid = "config-include/SimianGrid.ini" + Include-Standalone = "config-include/Standalone.ini" + ;Include-HGStandalone = "config-include/StandaloneHypergrid.ini" + ;Include-Grid = "config-include/Grid.ini" + ;Include-HGGrid = "config-include/GridHypergrid.ini" + ;Include-SimianGrid = "config-include/SimianGrid.ini" + ;Include-HyperSimianGrid = "config-include/HyperSimianGrid.ini" ; Then choose ; config-include/StandaloneCommon.ini.example (if you're in standlone) OR diff --git a/bin/config-include/HyperSimianGrid.ini b/bin/config-include/HyperSimianGrid.ini new file mode 100644 index 0000000000..87ffe69f0e --- /dev/null +++ b/bin/config-include/HyperSimianGrid.ini @@ -0,0 +1,77 @@ +;; +;; Please don't change this file. +;; All optional settings are in GridCommon.ini.example, +;; which you can copy and change. +;; + +;; +;; In GridCommon.ini, these are the URLs you would use if SimianGrid is +;; installed at http://www.mygrid.com/Grid/ +;; +; AssetServerURI = "http://www.mygrid.com/Grid/?id=" +; InventoryServerURI = "http://www.mygrid.com/Grid/" +; AvatarServerURI = "http://www.mygrid.com/Grid/" +; PresenceServerURI = "http://www.mygrid.com/Grid/" +; UserAccountServerURI = "http://www.mygrid.com/Grid/" +; AuthenticationServerURI = "http://www.mygrid.com/Grid/" +; FriendsServerURI = "http://www.mygrid.com/Grid/" +; GroupsServerURI = "http://www.mygrid.com/Grid/" + +[Includes] + Include-Common = "config-include/GridCommon.ini" + +[Modules] + GridServices = "OpenSim.Services.Connectors.dll:SimianGridServiceConnector" + PresenceServices = "OpenSim.Services.Connectors.dll:SimianPresenceServiceConnector" + UserAccountServices = "OpenSim.Services.Connectors.dll:SimianUserAccountServiceConnector" + AuthenticationServices = "OpenSim.Services.Connectors.dll:SimianAuthenticationServiceConnector" + AssetServices = "HGAssetBroker" + InventoryServices = "HGInventoryBroker" + AvatarServices = "OpenSim.Services.Connectors.dll:SimianAvatarServiceConnector" + + NeighbourServices = "RemoteNeighbourServicesConnector" + SimulationServices = "RemoteSimulationConnectorModule" + EntityTransferModule = "HGEntityTransferModule" + InventoryAccessModule = "HGInventoryAccessModule" + + LandServiceInConnector = true + NeighbourServiceInConnector = true + SimulationServiceInConnector = true + LibraryModule = false + + AssetCaching = "FlotsamAssetCache" + +[Friends] + Connector = "OpenSim.Services.Connectors.dll:SimianFriendsServiceConnector" + +[GridService] + LocalServiceModule = "OpenSim.Services.GridService.dll:GridService" + StorageProvider = "OpenSim.Data.Null.dll:NullRegionData" + + AllowHypergridMapSearch = true + +[LibraryService] + LocalServiceModule = "OpenSim.Services.InventoryService.dll:LibraryService" + LibraryName = "OpenSim Library" + DefaultLibrary = "./inventory/Libraries.xml" + +[AssetService] + DefaultAssetLoader = "OpenSim.Framework.AssetLoader.Filesystem.dll" + LocalGridAssetService = "OpenSim.Services.Connectors.dll:SimianAssetServiceConnector" + HypergridAssetService = "OpenSim.Services.Connectors.dll:HGAssetServiceConnector" + AssetLoaderArgs = "assets/AssetSets.xml" + +[InventoryService] + LocalGridInventoryService = "OpenSim.Services.Connectors.dll:SimianInventoryServiceConnector" + +[Groups] + Enabled = true + Module = GroupsModule + DebugEnabled = false + NoticesEnabled = true + MessagingModule = GroupsMessagingModule + MessagingEnabled = true + ServicesConnectorModule = SimianGroupsServicesConnector + +[Profiles] + Module = SimianProfiles From fe63fad394b89314777f2c2713c349b3a3017256 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 3 Sep 2010 22:26:15 +0100 Subject: [PATCH 29/57] minor: remove mono compiler warning --- OpenSim/Services/InventoryService/HGInventoryService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Services/InventoryService/HGInventoryService.cs b/OpenSim/Services/InventoryService/HGInventoryService.cs index 6e6b019f75..d62c0089a2 100644 --- a/OpenSim/Services/InventoryService/HGInventoryService.cs +++ b/OpenSim/Services/InventoryService/HGInventoryService.cs @@ -44,7 +44,7 @@ namespace OpenSim.Services.InventoryService LogManager.GetLogger( MethodBase.GetCurrentMethod().DeclaringType); - protected IXInventoryData m_Database; + protected new IXInventoryData m_Database; public HGInventoryService(IConfigSource config) : base(config) From b8da15c10448993a0bb81e8d1b1a31250515c1eb Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 3 Sep 2010 22:38:40 +0100 Subject: [PATCH 30/57] In RemoveAdminPlugin, use a .ini file template in XmlRpcCreateRegionMethod rather than an older XML one This is a patch from http://opensimulator.org/mantis/view.php?id=4973. Thanks randomhuman --- .../RemoteController/RemoteAdminPlugin.cs | 30 +++++++++++++++---- OpenSim/Framework/RegionInfo.cs | 15 ++++++---- bin/OpenSim.ini.example | 2 +- 3 files changed, 36 insertions(+), 11 deletions(-) diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index da3d3c2a14..c713e1963d 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs @@ -470,6 +470,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController /// estate_name /// the name of the estate to join (or to create if it doesn't /// already exist) + /// region_file + /// The name of the file to persist the region specifications to. + /// If omitted, the region_file_template setting from OpenSim.ini will be used. (optional) /// /// /// XmlRpcCreateRegionMethod returns @@ -583,7 +586,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController bool persist = Convert.ToBoolean((string) requestData["persist"]); if (persist) { - // default place for region XML files is in the + // default place for region configuration files is in the // Regions directory of the config dir (aka /bin) string regionConfigPath = Path.Combine(Util.configDir(), "Regions"); try @@ -596,19 +599,36 @@ namespace OpenSim.ApplicationPlugins.RemoteController { // No INI setting recorded. } - string regionXmlPath = Path.Combine(regionConfigPath, + + string regionIniPath; + + if (requestData.Contains("region_file")) + { + // Make sure that the file to be created is in a subdirectory of the region storage directory. + string requestedFilePath = Path.Combine(regionConfigPath, (string) requestData["region_file"]); + string requestedDirectory = Path.GetDirectoryName(Path.GetFullPath(requestedFilePath)); + if (requestedDirectory.StartsWith(Path.GetFullPath(regionConfigPath))) + regionIniPath = requestedFilePath; + else + throw new Exception("Invalid location for region file."); + } + else + { + regionIniPath = Path.Combine(regionConfigPath, String.Format( m_config.GetString("region_file_template", - "{0}x{1}-{2}.xml"), + "{0}x{1}-{2}.ini"), region.RegionLocX.ToString(), region.RegionLocY.ToString(), regionID.ToString(), region.InternalEndPoint.Port.ToString(), region.RegionName.Replace(" ", "_").Replace(":", "_"). Replace("/", "_"))); + } + m_log.DebugFormat("[RADMIN] CreateRegion: persisting region {0} to {1}", - region.RegionID, regionXmlPath); - region.SaveRegionToFile("dynamic region", regionXmlPath); + region.RegionID, regionIniPath); + region.SaveRegionToFile("dynamic region", regionIniPath); } else { diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index ea1a5949a6..12c58c3b76 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -805,7 +805,7 @@ namespace OpenSim.Framework IConfig config = source.Configs[RegionName]; if (config != null) - source.Configs.Remove(RegionName); + source.Configs.Remove(config); config = source.AddConfig(RegionName); @@ -864,10 +864,15 @@ namespace OpenSim.Framework return; } - configMember = new ConfigurationMember(filename, description, loadConfigurationOptionsFromMe, - ignoreIncomingConfiguration, false); - configMember.performConfigurationRetrieve(); - RegionFile = filename; + else if (filename.ToLower().EndsWith(".xml")) + { + configMember = new ConfigurationMember(filename, description, loadConfigurationOptionsFromMe, + ignoreIncomingConfiguration, false); + configMember.performConfigurationRetrieve(); + RegionFile = filename; + } + else + throw new Exception("Invalid file type for region persistence."); } public void loadConfigurationOptionsFromMe() diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 71c7e550d0..08726ea8a0 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -640,7 +640,7 @@ ; {2} - region UUID ; {3} - region port ; {4} - region name with " ", ":", "/" mapped to "_" - region_file_template = "{0}x{1}-{2}.xml" + region_file_template = "{0}x{1}-{2}.ini" ; we can limit the number of regions that XmlRpcCreateRegion will ; allow by setting this to a positive, non-0 number: as long as the From fc062a23afab6d5391960240da3953a5865cc12d Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Fri, 3 Sep 2010 14:50:26 -0700 Subject: [PATCH 31/57] Make SimianFriendsServiceConnector initialize like the other connectors and gracefully handle the case where it is loaded but disabled #monoaddinslol --- .../SimianFriendsServiceConnector.cs | 43 +++++++++---------- 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs index 89f3594a94..1afb1e1e99 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs @@ -76,38 +76,29 @@ namespace OpenSim.Services.Connectors.SimianGrid public void Initialise(IConfigSource source) { - bool isSimianEnabled = false; - - if (source.Configs["Friends"] != null) + IConfig gridConfig = source.Configs["FriendsService"]; + if (gridConfig != null) { - string module = source.Configs["Friends"].GetString("Connector"); - isSimianEnabled = !String.IsNullOrEmpty(module) && module.EndsWith(this.Name); + string serviceUrl = gridConfig.GetString("FriendsServerURI"); + if (!String.IsNullOrEmpty(serviceUrl)) + { + if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) + serviceUrl = serviceUrl + '/'; + m_serverUrl = serviceUrl; + } } - if (isSimianEnabled) - { - IConfig assetConfig = source.Configs["FriendsService"]; - if (assetConfig == null) - { - m_log.Error("[SIMIAN FRIENDS CONNECTOR]: FriendsService missing from OpenSim.ini"); - throw new Exception("Friends connector init error"); - } - - string serviceURI = assetConfig.GetString("FriendsServerURI"); - if (String.IsNullOrEmpty(serviceURI)) - { - m_log.Error("[SIMIAN FRIENDS CONNECTOR]: No Server URI named in section FriendsService"); - throw new Exception("Friends connector init error"); - } - - m_serverUrl = serviceURI; - } + if (String.IsNullOrEmpty(m_serverUrl)) + m_log.Info("[SIMIAN FRIENDS CONNECTOR]: No FriendsServerURI specified, disabling connector"); } #region IFriendsService public FriendInfo[] GetFriends(UUID principalID) { + if (String.IsNullOrEmpty(m_serverUrl)) + return new FriendInfo[0]; + Dictionary friends = new Dictionary(); OSDArray friendsArray = GetFriended(principalID); @@ -156,6 +147,9 @@ namespace OpenSim.Services.Connectors.SimianGrid public bool StoreFriend(UUID principalID, string friend, int flags) { + if (String.IsNullOrEmpty(m_serverUrl)) + return true; + NameValueCollection requestArgs = new NameValueCollection { { "RequestMethod", "AddGeneric" }, @@ -176,6 +170,9 @@ namespace OpenSim.Services.Connectors.SimianGrid public bool Delete(UUID principalID, string friend) { + if (String.IsNullOrEmpty(m_serverUrl)) + return true; + NameValueCollection requestArgs = new NameValueCollection { { "RequestMethod", "RemoveGeneric" }, From 63617c79d8b37c4e3a93e8071236c9ba9754ded9 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 3 Sep 2010 23:29:39 +0100 Subject: [PATCH 32/57] minor: remove mono compiler warnings --- .../Client/MXP/ClientStack/MXPClientView.cs | 176 +++++++++--------- .../MXP/PacketHandler/MXPPacketServer.cs | 5 +- .../Inventory/HGInventoryBroker.cs | 2 +- 3 files changed, 91 insertions(+), 92 deletions(-) diff --git a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs index b5b2508035..af9478e5e0 100644 --- a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs +++ b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs @@ -305,94 +305,94 @@ namespace OpenSim.Client.MXP.ClientStack #region MXP Outgoing Message Processing - private void MXPSendPrimitive(uint localID, UUID ownerID, Vector3 acc, Vector3 rvel, PrimitiveBaseShape primShape, Vector3 pos, UUID objectID, Vector3 vel, Quaternion rotation, uint flags, string text, byte[] textColor, uint parentID, byte[] particleSystem, byte clickAction, byte material, byte[] textureanim) - { - String typeName = ToOmType(primShape.PCode); - m_log.Info("[MXP ClientStack] Transmitting Primitive" + typeName); - - PerceptionEventMessage pe = new PerceptionEventMessage(); - pe.ObjectFragment.ObjectId = objectID.Guid; - - pe.ObjectFragment.ParentObjectId = Guid.Empty; - - // Resolving parent UUID. - OpenSim.Region.Framework.Scenes.Scene scene = (OpenSim.Region.Framework.Scenes.Scene)Scene; - if (scene.Entities.ContainsKey(parentID)) - { - pe.ObjectFragment.ParentObjectId = scene.Entities[parentID].UUID.Guid; - } - - pe.ObjectFragment.ObjectIndex = localID; - pe.ObjectFragment.ObjectName = typeName + " Object"; - pe.ObjectFragment.OwnerId = ownerID.Guid; - pe.ObjectFragment.TypeId = Guid.Empty; - pe.ObjectFragment.TypeName = typeName; - pe.ObjectFragment.Acceleration = ToOmVector(acc); - pe.ObjectFragment.AngularAcceleration=new MsdQuaternion4f(); - pe.ObjectFragment.AngularVelocity = ToOmQuaternion(rvel); - pe.ObjectFragment.BoundingSphereRadius = primShape.Scale.Length(); - - pe.ObjectFragment.Location = ToOmVector(pos); - - pe.ObjectFragment.Mass = 1.0f; - pe.ObjectFragment.Orientation = ToOmQuaternion(rotation); - pe.ObjectFragment.Velocity =ToOmVector(vel); - - OmSlPrimitiveExt ext = new OmSlPrimitiveExt(); - - if (!((primShape.PCode == (byte)PCode.NewTree) || (primShape.PCode == (byte)PCode.Tree) || (primShape.PCode == (byte)PCode.Grass))) - { - - ext.PathBegin = primShape.PathBegin; - ext.PathEnd = primShape.PathEnd; - ext.PathScaleX = primShape.PathScaleX; - ext.PathScaleY = primShape.PathScaleY; - ext.PathShearX = primShape.PathShearX; - ext.PathShearY = primShape.PathShearY; - ext.PathSkew = primShape.PathSkew; - ext.ProfileBegin = primShape.ProfileBegin; - ext.ProfileEnd = primShape.ProfileEnd; - ext.PathCurve = primShape.PathCurve; - ext.ProfileCurve = primShape.ProfileCurve; - ext.ProfileHollow = primShape.ProfileHollow; - ext.PathRadiusOffset = primShape.PathRadiusOffset; - ext.PathRevolutions = primShape.PathRevolutions; - ext.PathTaperX = primShape.PathTaperX; - ext.PathTaperY = primShape.PathTaperY; - ext.PathTwist = primShape.PathTwist; - ext.PathTwistBegin = primShape.PathTwistBegin; - - - } - - ext.UpdateFlags = flags; - ext.ExtraParams = primShape.ExtraParams; - ext.State = primShape.State; - ext.TextureEntry = primShape.TextureEntry; - ext.TextureAnim = textureanim; - ext.Scale = ToOmVector(primShape.Scale); - ext.Text = text; - ext.TextColor = ToOmColor(textColor); - ext.PSBlock = particleSystem; - ext.ClickAction = clickAction; - ext.Material = material; - - pe.SetExtension(ext); - - Session.Send(pe); - - if (m_objectsSynchronized != -1) - { - m_objectsSynchronized++; - - if (m_objectsToSynchronize >= m_objectsSynchronized) - { - SynchronizationEndEventMessage synchronizationEndEventMessage = new SynchronizationEndEventMessage(); - Session.Send(synchronizationEndEventMessage); - m_objectsSynchronized = -1; - } - } - } +// private void MXPSendPrimitive(uint localID, UUID ownerID, Vector3 acc, Vector3 rvel, PrimitiveBaseShape primShape, Vector3 pos, UUID objectID, Vector3 vel, Quaternion rotation, uint flags, string text, byte[] textColor, uint parentID, byte[] particleSystem, byte clickAction, byte material, byte[] textureanim) +// { +// String typeName = ToOmType(primShape.PCode); +// m_log.Info("[MXP ClientStack] Transmitting Primitive" + typeName); +// +// PerceptionEventMessage pe = new PerceptionEventMessage(); +// pe.ObjectFragment.ObjectId = objectID.Guid; +// +// pe.ObjectFragment.ParentObjectId = Guid.Empty; +// +// // Resolving parent UUID. +// OpenSim.Region.Framework.Scenes.Scene scene = (OpenSim.Region.Framework.Scenes.Scene)Scene; +// if (scene.Entities.ContainsKey(parentID)) +// { +// pe.ObjectFragment.ParentObjectId = scene.Entities[parentID].UUID.Guid; +// } +// +// pe.ObjectFragment.ObjectIndex = localID; +// pe.ObjectFragment.ObjectName = typeName + " Object"; +// pe.ObjectFragment.OwnerId = ownerID.Guid; +// pe.ObjectFragment.TypeId = Guid.Empty; +// pe.ObjectFragment.TypeName = typeName; +// pe.ObjectFragment.Acceleration = ToOmVector(acc); +// pe.ObjectFragment.AngularAcceleration=new MsdQuaternion4f(); +// pe.ObjectFragment.AngularVelocity = ToOmQuaternion(rvel); +// pe.ObjectFragment.BoundingSphereRadius = primShape.Scale.Length(); +// +// pe.ObjectFragment.Location = ToOmVector(pos); +// +// pe.ObjectFragment.Mass = 1.0f; +// pe.ObjectFragment.Orientation = ToOmQuaternion(rotation); +// pe.ObjectFragment.Velocity =ToOmVector(vel); +// +// OmSlPrimitiveExt ext = new OmSlPrimitiveExt(); +// +// if (!((primShape.PCode == (byte)PCode.NewTree) || (primShape.PCode == (byte)PCode.Tree) || (primShape.PCode == (byte)PCode.Grass))) +// { +// +// ext.PathBegin = primShape.PathBegin; +// ext.PathEnd = primShape.PathEnd; +// ext.PathScaleX = primShape.PathScaleX; +// ext.PathScaleY = primShape.PathScaleY; +// ext.PathShearX = primShape.PathShearX; +// ext.PathShearY = primShape.PathShearY; +// ext.PathSkew = primShape.PathSkew; +// ext.ProfileBegin = primShape.ProfileBegin; +// ext.ProfileEnd = primShape.ProfileEnd; +// ext.PathCurve = primShape.PathCurve; +// ext.ProfileCurve = primShape.ProfileCurve; +// ext.ProfileHollow = primShape.ProfileHollow; +// ext.PathRadiusOffset = primShape.PathRadiusOffset; +// ext.PathRevolutions = primShape.PathRevolutions; +// ext.PathTaperX = primShape.PathTaperX; +// ext.PathTaperY = primShape.PathTaperY; +// ext.PathTwist = primShape.PathTwist; +// ext.PathTwistBegin = primShape.PathTwistBegin; +// +// +// } +// +// ext.UpdateFlags = flags; +// ext.ExtraParams = primShape.ExtraParams; +// ext.State = primShape.State; +// ext.TextureEntry = primShape.TextureEntry; +// ext.TextureAnim = textureanim; +// ext.Scale = ToOmVector(primShape.Scale); +// ext.Text = text; +// ext.TextColor = ToOmColor(textColor); +// ext.PSBlock = particleSystem; +// ext.ClickAction = clickAction; +// ext.Material = material; +// +// pe.SetExtension(ext); +// +// Session.Send(pe); +// +// if (m_objectsSynchronized != -1) +// { +// m_objectsSynchronized++; +// +// if (m_objectsToSynchronize >= m_objectsSynchronized) +// { +// SynchronizationEndEventMessage synchronizationEndEventMessage = new SynchronizationEndEventMessage(); +// Session.Send(synchronizationEndEventMessage); +// m_objectsSynchronized = -1; +// } +// } +// } public void MXPSendAvatarData(string participantName, UUID ownerID, UUID parentId, UUID avatarID, uint avatarLocalID, Vector3 position, Quaternion rotation) { diff --git a/OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs b/OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs index 2098625f72..7056e0110b 100644 --- a/OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs +++ b/OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs @@ -63,7 +63,7 @@ namespace OpenSim.Client.MXP.PacketHandler private readonly IList m_sessionsToRemove = new List(); private readonly int m_port; - private readonly bool m_accountsAuthenticate; +// private readonly bool m_accountsAuthenticate; private readonly String m_programName; private readonly byte m_programMajorVersion; @@ -76,7 +76,7 @@ namespace OpenSim.Client.MXP.PacketHandler public MXPPacketServer(int port, Dictionary scenes, bool accountsAuthenticate) { m_port = port; - m_accountsAuthenticate = accountsAuthenticate; +// m_accountsAuthenticate = accountsAuthenticate; m_scenes = scenes; @@ -491,7 +491,6 @@ namespace OpenSim.Client.MXP.PacketHandler public bool AuthoriseUser(string participantName, string password, UUID sceneId, out UserAccount account) { - UUID userId = UUID.Zero; string firstName = ""; string lastName = ""; account = null; diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs index 97161fcbd1..5b4fecb802 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) Contributors, http://opensimulator.org/ * See CONTRIBUTORS.TXT for a full list of copyright holders. * From 107052b23db4d16c8d1d5f8c828da7d6f6afd6b4 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 4 Sep 2010 00:09:53 +0100 Subject: [PATCH 33/57] Create Scene.Inventory.cs.AddInventoryItem(InventoryItemBase item) The agentID in AddInventoryItem(UUID agentID, InventoryItemBase item) is redundant since it's contained in item.Owner, and it doesn't make sense for agentID != item.Owner, hence the method is deprecated. --- .../Archiver/Tests/InventoryArchiverTests.cs | 6 ++-- .../LocalInventoryServiceConnector.cs | 6 ++-- .../Framework/Scenes/Scene.Inventory.cs | 35 ++++++++++++++----- 3 files changed, 33 insertions(+), 14 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index 0218f86178..d66a1d0640 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs @@ -163,7 +163,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests InventoryFolderBase objsFolder = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects")[0]; item1.Folder = objsFolder.ID; - scene.AddInventoryItem(userId, item1); + scene.AddInventoryItem(item1); MemoryStream archiveWriteStream = new MemoryStream(); archiverModule.OnInventoryArchiveSaved += SaveCompleted; @@ -282,7 +282,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests InventoryFolderBase objsFolder = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects")[0]; item1.Folder = objsFolder.ID; - scene.AddInventoryItem(userId, item1); + scene.AddInventoryItem(item1); MemoryStream archiveWriteStream = new MemoryStream(); archiverModule.OnInventoryArchiveSaved += SaveCompleted; @@ -485,7 +485,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests InventoryFolderBase objsFolder = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects")[0]; item1.Folder = objsFolder.ID; - scene.AddInventoryItem(userId, item1); + scene.AddInventoryItem(item1); MemoryStream archiveWriteStream = new MemoryStream(); archiverModule.OnInventoryArchiveSaved += SaveCompleted; diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs index 915b59ec29..06b40b3133 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs @@ -242,9 +242,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory } else { -// m_log.WarnFormat( -// "[LOCAL INVENTORY SERVICES CONNECTOR]: Could not find root folder for {0} when trying to add item {1} with no parent folder specified", -// item.Owner, item.Name); + m_log.WarnFormat( + "[LOCAL INVENTORY SERVICES CONNECTOR]: Could not find root folder for {0} when trying to add item {1} with no parent folder specified", + item.Owner, item.Name); return false; } } diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 0674e62d8b..7cedde0e5e 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -92,25 +92,44 @@ namespace OpenSim.Region.Framework.Scenes } } - public void AddInventoryItem(UUID AgentID, InventoryItemBase item) + /// + /// Add the given inventory item to a user's inventory. + /// + /// + public void AddInventoryItem(InventoryItemBase item) { if (InventoryService.AddItem(item)) { int userlevel = 0; - if (Permissions.IsGod(AgentID)) + if (Permissions.IsGod(item.Owner)) { userlevel = 1; } - EventManager.TriggerOnNewInventoryItemUploadComplete(AgentID, item.AssetID, item.Name, userlevel); + EventManager.TriggerOnNewInventoryItemUploadComplete(item.Owner, item.AssetID, item.Name, userlevel); } else { m_log.WarnFormat( "[AGENT INVENTORY]: Agent {0} could not add item {1} {2}", - AgentID, item.Name, item.ID); + item.Owner, item.Name, item.ID); return; - } + } + } + + /// + /// Add the given inventory item to a user's inventory. + /// + /// + /// A + /// + /// + /// A + /// + [Obsolete("Use AddInventoryItem(InventoryItemBase item) instead. This was deprecated in OpenSim 0.7.1")] + public void AddInventoryItem(UUID AgentID, InventoryItemBase item) + { + AddInventoryItem(item); } /// @@ -121,7 +140,7 @@ namespace OpenSim.Region.Framework.Scenes /// in which the item is to be placed. public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item) { - AddInventoryItem(remoteClient.AgentId, item); + AddInventoryItem(item); remoteClient.SendInventoryItemCreateUpdate(item, 0); } @@ -1108,7 +1127,7 @@ namespace OpenSim.Region.Framework.Scenes agentItem.Folder = folderId; - AddInventoryItem(avatarId, agentItem); + AddInventoryItem(agentItem); return agentItem; } @@ -1232,7 +1251,7 @@ namespace OpenSim.Region.Framework.Scenes { agentItem.Folder = newFolderID; - AddInventoryItem(destID, agentItem); + AddInventoryItem(agentItem); } } From 8fc68c6d9810a0d229e94a0cefb35086c65dec36 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 3 Sep 2010 17:18:53 -0700 Subject: [PATCH 34/57] Added XFF header processing. Untested, for lack of proxy. --- .../Servers/HttpServer/BaseHttpServer.cs | 2 ++ OpenSim/Framework/Util.cs | 28 +++++++++++++++++++ .../Server/Handlers/Login/LLLoginHandlers.cs | 12 +++++++- .../Login/LLLoginServiceInConnector.cs | 5 +++- .../Services/LLLoginService/LLLoginService.cs | 2 +- bin/Robust.HG.ini.example | 3 ++ 6 files changed, 49 insertions(+), 3 deletions(-) diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 95c3e6ca5f..d20f8c9b25 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -28,6 +28,7 @@ using System; using System.Collections; using System.Collections.Generic; +using System.Collections.Specialized; using System.IO; using System.Net; using System.Net.Sockets; @@ -737,6 +738,7 @@ namespace OpenSim.Framework.Servers.HttpServer if (methodWasFound) { xmlRprcRequest.Params.Add(request.Url); // Param[2] + xmlRprcRequest.Params.Add(request.Headers.Get("X-Forwarded-For")); // Param[3] try { diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index b5d025fbbd..2ac4eb1d14 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -1495,5 +1495,33 @@ namespace OpenSim.Framework } } + /// + /// Gets the client IP address + /// + /// + /// + public static IPEndPoint GetClientIPFromXFF(string xff) + { + if (xff == string.Empty) + return null; + + string[] parts = xff.Split(new char[] { ',' }); + if (parts.Length > 0) + { + try + { + return new IPEndPoint(IPAddress.Parse(parts[0]), 0); + } + catch (Exception e) + { + m_log.WarnFormat("[UTIL]: Exception parsing XFF header {0}: {1}", xff, e.Message); + } + } + + return null; + } + + + } } diff --git a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs index 5bb529c89e..30dc65e5e8 100644 --- a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs +++ b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs @@ -52,15 +52,24 @@ namespace OpenSim.Server.Handlers.Login private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private ILoginService m_LocalService; + private bool m_Proxy; - public LLLoginHandlers(ILoginService service) + public LLLoginHandlers(ILoginService service, bool hasProxy) { m_LocalService = service; + m_Proxy = hasProxy; } public XmlRpcResponse HandleXMLRPCLogin(XmlRpcRequest request, IPEndPoint remoteClient) { Hashtable requestData = (Hashtable)request.Params[0]; + if (m_Proxy && request.Params[3] != null) + { + IPEndPoint ep = Util.GetClientIPFromXFF((string)request.Params[3]); + if (ep != null) + // Bang! + remoteClient = ep; + } if (requestData != null) { @@ -189,6 +198,7 @@ namespace OpenSim.Server.Handlers.Login return map; } + } } diff --git a/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs b/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs index 67e83924d0..16c93c8e2c 100644 --- a/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs +++ b/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs @@ -43,6 +43,7 @@ namespace OpenSim.Server.Handlers.Login private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private ILoginService m_LoginService; + private bool m_Proxy; public LLLoginServiceInConnector(IConfigSource config, IHttpServer server, IScene scene) : base(config, server, String.Empty) @@ -81,12 +82,14 @@ namespace OpenSim.Server.Handlers.Login if (loginService == string.Empty) throw new Exception(String.Format("No LocalServiceModule for LoginService in config file")); + m_Proxy = serverConfig.GetBoolean("HasProxy", false); + return loginService; } private void InitializeHandlers(IHttpServer server) { - LLLoginHandlers loginHandlers = new LLLoginHandlers(m_LoginService); + LLLoginHandlers loginHandlers = new LLLoginHandlers(m_LoginService, m_Proxy); server.AddXmlRPCHandler("login_to_simulator", loginHandlers.HandleXMLRPCLogin, false); server.AddXmlRPCHandler("set_login_level", loginHandlers.HandleXMLRPCSetLoginLevel, false); server.SetDefaultLLSDHandler(loginHandlers.HandleLLSDLogin); diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index b74029787b..3f9bc19c9d 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs @@ -104,7 +104,7 @@ namespace OpenSim.Services.LLLoginService m_GatekeeperURL = m_LoginServerConfig.GetString("GatekeeperURI", string.Empty); m_MapTileURL = m_LoginServerConfig.GetString("MapTileURL", string.Empty); m_SearchURL = m_LoginServerConfig.GetString("SearchURL", string.Empty); - + // These are required; the others aren't if (accountService == string.Empty || authService == string.Empty) throw new Exception("LoginService is missing service specifications"); diff --git a/bin/Robust.HG.ini.example b/bin/Robust.HG.ini.example index 554d00f86b..9aaa46bf35 100644 --- a/bin/Robust.HG.ini.example +++ b/bin/Robust.HG.ini.example @@ -147,6 +147,9 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 WelcomeMessage = "Welcome, Avatar!" AllowRemoteSetLoginLevel = "false" + ; If you run this login server behind a proxy, set this to true + ; HasProxy = true + ; Defaults for the users, if none is specified in the useraccounts table entry (ServiceURLs) ; CHANGE THIS HomeURI = "http://127.0.0.1:8002" From 1e8e98a07fdad6cff4be780083b3d9ad2360b8e7 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 4 Sep 2010 01:36:26 +0100 Subject: [PATCH 35/57] Move code that allows llGiveInvetory() to move item into appropriate system folder up from connectors into Scene.Inventory.cs This fixes the problem for all architectures (hg as well as local and grid) and means we don't have to dupe code between connectors. Not ideal in that it becomes non-modular, but methods in Scene.Inventory.cs should eventually be modularized anyway. --- .../RemoteController/RemoteAdminPlugin.cs | 23 +++++---- .../AssetTransaction/AssetXferUploader.cs | 4 +- .../Archiver/InventoryArchiveReadRequest.cs | 3 +- .../InventoryAccess/InventoryAccessModule.cs | 2 +- .../LocalInventoryServiceConnector.cs | 28 ----------- .../RemoteXInventoryServiceConnector.cs | 26 +--------- .../World/Objects/BuySell/BuySellModule.cs | 2 +- .../Framework/Scenes/Scene.Inventory.cs | 48 +++++++++++++++---- 8 files changed, 56 insertions(+), 80 deletions(-) diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index c713e1963d..4b5710a4bd 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs @@ -1602,8 +1602,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController destinationItem.CreationDate = item.CreationDate; destinationItem.Folder = destinationFolder.ID; - inventoryService.AddItem(destinationItem); - m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", destinationItem.ID, destinationFolder.ID); + m_application.SceneManager.CurrentOrFirstScene.AddInventoryItem(destinationItem); + m_log.DebugFormat("[RADMIN]: Added item {0} to folder {1}", destinationItem.ID, destinationFolder.ID); // Wear item AvatarWearable newWearable = new AvatarWearable(); @@ -1613,7 +1613,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController } else { - m_log.WarnFormat("[RADMIN] Error transferring {0} to folder {1}", wearable.ItemID, destinationFolder.ID); + m_log.WarnFormat("[RADMIN]: Error transferring {0} to folder {1}", wearable.ItemID, destinationFolder.ID); } } } @@ -1655,16 +1655,16 @@ namespace OpenSim.ApplicationPlugins.RemoteController destinationItem.CreationDate = item.CreationDate; destinationItem.Folder = destinationFolder.ID; - inventoryService.AddItem(destinationItem); - m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", destinationItem.ID, destinationFolder.ID); + m_application.SceneManager.CurrentOrFirstScene.AddInventoryItem(destinationItem); + m_log.DebugFormat("[RADMIN]: Added item {0} to folder {1}", destinationItem.ID, destinationFolder.ID); // Attach item avatarAppearance.SetAttachment(attachpoint, destinationItem.ID, destinationItem.AssetID); - m_log.DebugFormat("[RADMIN] Attached {0}", destinationItem.ID); + m_log.DebugFormat("[RADMIN]: Attached {0}", destinationItem.ID); } else { - m_log.WarnFormat("[RADMIN] Error transferring {0} to folder {1}", itemID, destinationFolder.ID); + m_log.WarnFormat("[RADMIN]: Error transferring {0} to folder {1}", itemID, destinationFolder.ID); } } } @@ -1762,16 +1762,16 @@ namespace OpenSim.ApplicationPlugins.RemoteController destinationItem.CreationDate = item.CreationDate; destinationItem.Folder = extraFolder.ID; - inventoryService.AddItem(destinationItem); + m_application.SceneManager.CurrentOrFirstScene.AddInventoryItem(destinationItem); inventoryMap.Add(item.ID, destinationItem.ID); - m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", destinationItem.ID, extraFolder.ID); + m_log.DebugFormat("[RADMIN]: Added item {0} to folder {1}", destinationItem.ID, extraFolder.ID); // Attach item, if original is attached int attachpoint = avatarAppearance.GetAttachpoint(item.ID); if (attachpoint != 0) { avatarAppearance.SetAttachment(attachpoint, destinationItem.ID, destinationItem.AssetID); - m_log.DebugFormat("[RADMIN] Attached {0}", destinationItem.ID); + m_log.DebugFormat("[RADMIN]: Attached {0}", destinationItem.ID); } } } @@ -1790,7 +1790,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController private bool CreateDefaultAvatars() { // Only load once - if (m_defaultAvatarsLoaded) { return false; @@ -2048,7 +2047,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController inventoryItem.CreationDate = GetIntegerAttribute(item,"creationdate",Util.UnixTimeSinceEpoch()); inventoryItem.Folder = extraFolder.ID; // Parent folder - inventoryService.AddItem(inventoryItem); + m_application.SceneManager.CurrentOrFirstScene.AddInventoryItem(inventoryItem); m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", inventoryItem.ID, extraFolder.ID); } diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs index c791cb4c8d..460973840b 100644 --- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs +++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs @@ -214,8 +214,6 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction { m_userTransactions.Manager.MyScene.AssetService.Store(m_asset); - IInventoryService invService = m_userTransactions.Manager.MyScene.InventoryService; - InventoryItemBase item = new InventoryItemBase(); item.Owner = ourClient.AgentId; item.CreatorId = ourClient.AgentId.ToString(); @@ -234,7 +232,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction item.Flags = (uint) wearableType; item.CreationDate = Util.UnixTimeSinceEpoch(); - if (invService.AddItem(item)) + if (m_userTransactions.Manager.MyScene.AddInventoryItem(item)) ourClient.SendInventoryItemCreateUpdate(item, callbackID); else ourClient.SendAlertMessage("Unable to create inventory item"); diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 22c84e947c..52342ec357 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs @@ -406,8 +406,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver // Reset folder ID to the one in which we want to load it item.Folder = loadFolder.ID; - //m_userInfo.AddItem(item); - m_scene.InventoryService.AddItem(item); + m_scene.AddInventoryItem(item); return item; } diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 2ac2324cd9..d87f7f1d04 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -425,7 +425,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess item.Name = asset.Name; item.AssetType = asset.Type; - m_Scene.InventoryService.AddItem(item); + m_Scene.AddInventoryItem(item); if (remoteClient != null && item.Owner == remoteClient.AgentId) { diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs index 06b40b3133..cbd9e05de7 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs @@ -221,34 +221,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory // m_log.DebugFormat( // "[LOCAL INVENTORY SERVICES CONNECTOR]: Adding inventory item {0} to user {1} folder {2}", // item.Name, item.Owner, item.Folder); - - if (UUID.Zero == item.Folder) - { - InventoryFolderBase f = m_InventoryService.GetFolderForType(item.Owner, (AssetType)item.AssetType); - if (f != null) - { -// m_log.DebugFormat( -// "[LOCAL INVENTORY SERVICES CONNECTOR]: Found folder {0} type {1} for item {2}", -// f.Name, (AssetType)f.Type, item.Name); - - item.Folder = f.ID; - } - else - { - f = m_InventoryService.GetRootFolder(item.Owner); - if (f != null) - { - item.Folder = f.ID; - } - else - { - m_log.WarnFormat( - "[LOCAL INVENTORY SERVICES CONNECTOR]: Could not find root folder for {0} when trying to add item {1} with no parent folder specified", - item.Owner, item.Name); - return false; - } - } - } return m_InventoryService.AddItem(item); } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs index 4211fa9b07..4ab69474a1 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs @@ -227,31 +227,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory public bool AddItem(InventoryItemBase item) { if (item == null) - return false; - - if (UUID.Zero == item.Folder) - { - InventoryFolderBase f = m_RemoteConnector.GetFolderForType(item.Owner, (AssetType)item.AssetType); - if (f != null) - { - item.Folder = f.ID; - } - else - { - f = m_RemoteConnector.GetRootFolder(item.Owner); - if (f != null) - { - item.Folder = f.ID; - } - else - { - m_log.WarnFormat( - "[LOCAL INVENTORY SERVICES CONNECTOR]: Could not find root folder for {0} when trying to add item {1} with no parent folder specified", - item.Owner, item.Name); - return false; - } - } - } + return false; return m_RemoteConnector.AddItem(item); } diff --git a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs index 8ce6dafc95..12750c5e2c 100644 --- a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs +++ b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs @@ -219,7 +219,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell item.CurrentPermissions |= 16; // Slam! item.CreationDate = Util.UnixTimeSinceEpoch(); - if (m_scene.InventoryService.AddItem(item)) + if (m_scene.AddInventoryItem(item)) { remoteClient.SendInventoryItemCreateUpdate(item, 0); } diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 7cedde0e5e..4e871d9edf 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -70,18 +70,18 @@ namespace OpenSim.Region.Framework.Scenes public void AddUploadedInventoryItem(UUID agentID, InventoryItemBase item) { - IMoneyModule money=RequestModuleInterface(); + IMoneyModule money = RequestModuleInterface(); if (money != null) { money.ApplyUploadCharge(agentID, money.UploadCharge, "Asset upload"); } - AddInventoryItem(agentID, item); + AddInventoryItem(item); } public bool AddInventoryItemReturned(UUID AgentId, InventoryItemBase item) { - if (InventoryService.AddItem(item)) + if (AddInventoryItem(item)) return true; else { @@ -96,8 +96,36 @@ namespace OpenSim.Region.Framework.Scenes /// Add the given inventory item to a user's inventory. /// /// - public void AddInventoryItem(InventoryItemBase item) + public bool AddInventoryItem(InventoryItemBase item) { + if (UUID.Zero == item.Folder) + { + InventoryFolderBase f = InventoryService.GetFolderForType(item.Owner, (AssetType)item.AssetType); + if (f != null) + { +// m_log.DebugFormat( +// "[LOCAL INVENTORY SERVICES CONNECTOR]: Found folder {0} type {1} for item {2}", +// f.Name, (AssetType)f.Type, item.Name); + + item.Folder = f.ID; + } + else + { + f = InventoryService.GetRootFolder(item.Owner); + if (f != null) + { + item.Folder = f.ID; + } + else + { + m_log.WarnFormat( + "[AGENT INVENTORY]: Could not find root folder for {0} when trying to add item {1} with no parent folder specified", + item.Owner, item.Name); + return false; + } + } + } + if (InventoryService.AddItem(item)) { int userlevel = 0; @@ -106,6 +134,8 @@ namespace OpenSim.Region.Framework.Scenes userlevel = 1; } EventManager.TriggerOnNewInventoryItemUploadComplete(item.Owner, item.AssetID, item.Name, userlevel); + + return true; } else { @@ -113,7 +143,7 @@ namespace OpenSim.Region.Framework.Scenes "[AGENT INVENTORY]: Agent {0} could not add item {1} {2}", item.Owner, item.Name, item.ID); - return; + return false; } } @@ -538,7 +568,7 @@ namespace OpenSim.Region.Framework.Scenes itemCopy.SalePrice = item.SalePrice; itemCopy.SaleType = item.SaleType; - if (InventoryService.AddItem(itemCopy)) + if (AddInventoryItem(itemCopy)) { IInventoryAccessModule invAccess = RequestModuleInterface(); if (invAccess != null) @@ -764,8 +794,10 @@ namespace OpenSim.Region.Framework.Scenes item.BasePermissions = baseMask; item.CreationDate = creationDate; - if (InventoryService.AddItem(item)) + if (AddInventoryItem(item)) + { remoteClient.SendInventoryItemCreateUpdate(item, callbackID); + } else { m_dialogModule.SendAlertToUser(remoteClient, "Failed to create item"); @@ -1886,7 +1918,7 @@ namespace OpenSim.Region.Framework.Scenes // sets itemID so client can show item as 'attached' in inventory grp.SetFromItemID(item.ID); - if (InventoryService.AddItem(item)) + if (AddInventoryItem(item)) remoteClient.SendInventoryItemCreateUpdate(item, 0); else m_dialogModule.SendAlertToUser(remoteClient, "Operation failed"); From 9fd98368416ce9514e0926301a1fc20648d9ad59 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 4 Sep 2010 16:39:03 -0700 Subject: [PATCH 36/57] Make User Agent Service and Login Service separable. --- OpenSim/Framework/Util.cs | 18 +++++++- .../Handlers/Hypergrid/HomeAgentHandlers.cs | 26 +++++++++++- .../Hypergrid/UserAgentServerConnector.cs | 4 +- .../Handlers/Simulation/AgentHandlers.cs | 19 +-------- .../Hypergrid/UserAgentServiceConnector.cs | 42 ++++++++++++++----- bin/Robust.HG.ini.example | 4 ++ 6 files changed, 81 insertions(+), 32 deletions(-) diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 2ac4eb1d14..e7a7f49148 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -1521,7 +1521,23 @@ namespace OpenSim.Framework return null; } - + public static string GetCallerIP(Hashtable req) + { + if (req.ContainsKey("headers")) + { + try + { + Hashtable headers = (Hashtable)req["headers"]; + if (headers.ContainsKey("remote_addr") && headers["remote_addr"] != null) + return headers["remote_addr"].ToString(); + } + catch (Exception e) + { + m_log.WarnFormat("[UTIL]: exception in GetCallerIP: {0}", e.Message); + } + } + return string.Empty; + } } } diff --git a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs index e50481a259..d10d6fc6fe 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs @@ -54,9 +54,12 @@ namespace OpenSim.Server.Handlers.Hypergrid private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private IUserAgentService m_UserAgentService; - public HomeAgentHandler(IUserAgentService userAgentService) + private string m_LoginServerIP; + + public HomeAgentHandler(IUserAgentService userAgentService, string loginServerIP) { m_UserAgentService = userAgentService; + m_LoginServerIP = loginServerIP; } public Hashtable Handler(Hashtable request) @@ -120,6 +123,7 @@ namespace OpenSim.Server.Handlers.Hypergrid string regionname = string.Empty; string gatekeeper_host = string.Empty; int gatekeeper_port = 0; + IPEndPoint client_ipaddress = null; if (args.ContainsKey("gatekeeper_host") && args["gatekeeper_host"] != null) gatekeeper_host = args["gatekeeper_host"].AsString(); @@ -144,6 +148,24 @@ namespace OpenSim.Server.Handlers.Hypergrid if (args.ContainsKey("destination_name") && args["destination_name"] != null) regionname = args["destination_name"].ToString(); + if (args.ContainsKey("client_ip") && args["client_ip"] != null) + { + string ip_str = args["client_ip"].ToString(); + try + { + string callerIP = Util.GetCallerIP(request); + // Verify if this caller has authority to send the client IP + if (callerIP == m_LoginServerIP) + client_ipaddress = new IPEndPoint(IPAddress.Parse(ip_str), 0); + else + m_log.WarnFormat("[HOME AGENT HANDLER]: Unauthorized machine {0} tried to set client ip to {1}", callerIP, ip_str); + } + catch + { + m_log.DebugFormat("[HOME AGENT HANDLER]: Exception parsing client ip address from {0}", ip_str); + } + } + GridRegion destination = new GridRegion(); destination.RegionID = uuid; destination.RegionLocX = x; @@ -166,7 +188,7 @@ namespace OpenSim.Server.Handlers.Hypergrid OSDMap resp = new OSDMap(2); string reason = String.Empty; - bool result = m_UserAgentService.LoginAgentToGrid(aCircuit, gatekeeper, destination, out reason); + bool result = m_UserAgentService.LoginAgentToGrid(aCircuit, gatekeeper, destination, client_ipaddress, out reason); resp["reason"] = OSD.FromString(reason); resp["success"] = OSD.FromBoolean(result); diff --git a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs index 6b1152b00e..70157d5705 100644 --- a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs +++ b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs @@ -66,13 +66,15 @@ namespace OpenSim.Server.Handlers.Hypergrid if (m_HomeUsersService == null) throw new Exception("UserAgent server connector cannot proceed because of missing service"); + string loginServerIP = gridConfig.GetString("LoginServerIP", "127.0.0.1"); + server.AddXmlRPCHandler("agent_is_coming_home", AgentIsComingHome, false); server.AddXmlRPCHandler("get_home_region", GetHomeRegion, false); server.AddXmlRPCHandler("verify_agent", VerifyAgent, false); server.AddXmlRPCHandler("verify_client", VerifyClient, false); server.AddXmlRPCHandler("logout_agent", LogoutAgent, false); - server.AddHTTPHandler("/homeagent/", new HomeAgentHandler(m_HomeUsersService).Handler); + server.AddHTTPHandler("/homeagent/", new HomeAgentHandler(m_HomeUsersService, loginServerIP).Handler); } public XmlRpcResponse GetHomeRegion(XmlRpcRequest request, IPEndPoint remoteClient) diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 392927a9c3..2997430302 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -179,7 +179,7 @@ namespace OpenSim.Server.Handlers.Simulation resp["reason"] = OSD.FromString(reason); resp["success"] = OSD.FromBoolean(result); // Let's also send out the IP address of the caller back to the caller (HG 1.5) - resp["your_ip"] = OSD.FromString(GetCallerIP(request)); + resp["your_ip"] = OSD.FromString(Util.GetCallerIP(request)); // TODO: add reason if not String.Empty? responsedata["int_response_code"] = HttpStatusCode.OK; @@ -355,23 +355,6 @@ namespace OpenSim.Server.Handlers.Simulation m_SimulationService.ReleaseAgent(regionID, id, ""); } - private string GetCallerIP(Hashtable req) - { - if (req.ContainsKey("headers")) - { - try - { - Hashtable headers = (Hashtable)req["headers"]; - if (headers.ContainsKey("remote_addr") && headers["remote_addr"] != null) - return headers["remote_addr"].ToString(); - } - catch (Exception e) - { - m_log.WarnFormat("[AGENT HANDLER]: exception in GetCallerIP: {0}", e.Message); - } - } - return string.Empty; - } } } diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs index 7fa086ac68..5d29087e75 100644 --- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs @@ -70,16 +70,29 @@ namespace OpenSim.Services.Connectors.Hypergrid public UserAgentServiceConnector(IConfigSource config) { + IConfig serviceConfig = config.Configs["UserAgentService"]; + if (serviceConfig == null) + { + m_log.Error("[USER AGENT CONNECTOR]: UserAgentService missing from ini"); + throw new Exception("UserAgent connector init error"); + } + + string serviceURI = serviceConfig.GetString("UserAgentServerURI", + String.Empty); + + if (serviceURI == String.Empty) + { + m_log.Error("[USER AGENT CONNECTOR]: No Server URI named in section UserAgentService"); + throw new Exception("UserAgent connector init error"); + } + m_ServerURL = serviceURI; + + m_log.DebugFormat("[USER AGENT CONNECTOR]: UserAgentServiceConnector started for {0}", m_ServerURL); } - public bool LoginAgentToGrid(AgentCircuitData agent, GridRegion gatekeeper, GridRegion finalDestination, IPEndPoint ipaddress, out string reason) - { - // not available over remote calls - reason = "Method not available over remote calls"; - return false; - } - public bool LoginAgentToGrid(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, out string reason) + // The Login service calls this interface with a non-null [client] ipaddress + public bool LoginAgentToGrid(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, IPEndPoint ipaddress, out string reason) { reason = String.Empty; @@ -90,7 +103,7 @@ namespace OpenSim.Services.Connectors.Hypergrid return false; } - string uri = m_ServerURL + "/homeagent/" + aCircuit.AgentID + "/"; + string uri = m_ServerURL + "/homeagent/" + aCircuit.AgentID + "/"; Console.WriteLine(" >>> LoginAgentToGrid <<< " + uri); @@ -102,7 +115,7 @@ namespace OpenSim.Services.Connectors.Hypergrid //AgentCreateRequest.Headers.Add("Authorization", authKey); // Fill it in - OSDMap args = PackCreateAgentArguments(aCircuit, gatekeeper, destination); + OSDMap args = PackCreateAgentArguments(aCircuit, gatekeeper, destination, ipaddress); string strBuffer = ""; byte[] buffer = new byte[1]; @@ -199,7 +212,14 @@ namespace OpenSim.Services.Connectors.Hypergrid } - protected OSDMap PackCreateAgentArguments(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination) + + // The simulators call this interface + public bool LoginAgentToGrid(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, out string reason) + { + return LoginAgentToGrid(aCircuit, gatekeeper, destination, null, out reason); + } + + protected OSDMap PackCreateAgentArguments(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, IPEndPoint ipaddress) { OSDMap args = null; try @@ -217,6 +237,8 @@ namespace OpenSim.Services.Connectors.Hypergrid args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString()); args["destination_name"] = OSD.FromString(destination.RegionName); args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString()); + if (ipaddress != null) + args["client_ip"] = OSD.FromString(ipaddress.Address.ToString()); return args; } diff --git a/bin/Robust.HG.ini.example b/bin/Robust.HG.ini.example index 9aaa46bf35..dae7a19e21 100644 --- a/bin/Robust.HG.ini.example +++ b/bin/Robust.HG.ini.example @@ -219,6 +219,10 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 GridUserService = "OpenSim.Services.UserAccountService.dll:GridUserService" GridService = "OpenSim.Services.GridService.dll:GridService" GatekeeperService = "OpenSim.Services.HypergridService.dll:GatekeeperService" + + ;; If you separate the UserAgentService from the LoginService, set this to + ;; the IP address of the machine where your LoginService is + ;LoginServerIP = "127.0.0.1" ; * The interface that local users get when they are in other grids. ; * This restricts the inventory operations while in other grids. From 953a487f5e18a293acf59bfd590e1f03203494ec Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 4 Sep 2010 18:09:17 -0700 Subject: [PATCH 37/57] One more debug message to track an issue on Danger grid. --- .../Services/Connectors/Hypergrid/UserAgentServiceConnector.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs index 5d29087e75..6d3c64a875 100644 --- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs @@ -66,6 +66,7 @@ namespace OpenSim.Services.Connectors.Hypergrid { m_log.DebugFormat("[USER AGENT CONNECTOR]: Malformed Uri {0}: {1}", m_ServerURL, e.Message); } + m_log.DebugFormat("[USER AGENT CONNECTOR]: new connector to {0} ({1})", url, m_ServerURL); } public UserAgentServiceConnector(IConfigSource config) From 68f107b27e37df88618993b8234316288782d15e Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 4 Sep 2010 18:46:27 -0700 Subject: [PATCH 38/57] Logout the presence if client IP verification fails. --- OpenSim/Region/Framework/Scenes/Scene.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 56ac2c2e57..49f29ad26b 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2643,6 +2643,8 @@ namespace OpenSim.Region.Framework.Scenes try { ScenePresence sp = GetScenePresence(agentID); + PresenceService.LogoutAgent(sp.ControllingClient.SessionId); + if (sp != null) sp.ControllingClient.Close(); From e5936071711e35f9edf44d8393b8ad28ef4023db Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sun, 5 Sep 2010 14:16:42 +0200 Subject: [PATCH 39/57] Remove "Dwell" support from core and replace it with calls to methods on IDwellModule --- OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs | 6 +- OpenSim/Data/MySQL/MySQLLegacyRegionData.cs | 6 +- OpenSim/Data/SQLite/SQLiteRegionData.cs | 3 - OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs | 3 - OpenSim/Framework/LandData.cs | 14 --- .../External/LandDataSerializer.cs | 5 +- .../SynchronousRestFormsRequester.cs | 119 +++++++++--------- .../ClientStack/LindenUDP/LLClientView.cs | 6 +- .../World/Land/LandManagementModule.cs | 13 -- OpenSim/Region/DataSnapshot/LandSnapshot.cs | 7 +- 10 files changed, 74 insertions(+), 108 deletions(-) diff --git a/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs b/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs index 7ff87379b5..77b8a10f07 100644 --- a/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs +++ b/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs @@ -638,9 +638,9 @@ ELSE //Insert new values string sql = @"INSERT INTO [land] -([UUID],[RegionUUID],[LocalLandID],[Bitmap],[Name],[Description],[OwnerUUID],[IsGroupOwned],[Area],[AuctionID],[Category],[ClaimDate],[ClaimPrice],[GroupUUID],[SalePrice],[LandStatus],[LandFlags],[LandingType],[MediaAutoScale],[MediaTextureUUID],[MediaURL],[MusicURL],[PassHours],[PassPrice],[SnapshotUUID],[UserLocationX],[UserLocationY],[UserLocationZ],[UserLookAtX],[UserLookAtY],[UserLookAtZ],[AuthbuyerID],[OtherCleanTime],[Dwell]) +([UUID],[RegionUUID],[LocalLandID],[Bitmap],[Name],[Description],[OwnerUUID],[IsGroupOwned],[Area],[AuctionID],[Category],[ClaimDate],[ClaimPrice],[GroupUUID],[SalePrice],[LandStatus],[LandFlags],[LandingType],[MediaAutoScale],[MediaTextureUUID],[MediaURL],[MusicURL],[PassHours],[PassPrice],[SnapshotUUID],[UserLocationX],[UserLocationY],[UserLocationZ],[UserLookAtX],[UserLookAtY],[UserLookAtZ],[AuthbuyerID],[OtherCleanTime]) VALUES -(@UUID,@RegionUUID,@LocalLandID,@Bitmap,@Name,@Description,@OwnerUUID,@IsGroupOwned,@Area,@AuctionID,@Category,@ClaimDate,@ClaimPrice,@GroupUUID,@SalePrice,@LandStatus,@LandFlags,@LandingType,@MediaAutoScale,@MediaTextureUUID,@MediaURL,@MusicURL,@PassHours,@PassPrice,@SnapshotUUID,@UserLocationX,@UserLocationY,@UserLocationZ,@UserLookAtX,@UserLookAtY,@UserLookAtZ,@AuthbuyerID,@OtherCleanTime,@Dwell)"; +(@UUID,@RegionUUID,@LocalLandID,@Bitmap,@Name,@Description,@OwnerUUID,@IsGroupOwned,@Area,@AuctionID,@Category,@ClaimDate,@ClaimPrice,@GroupUUID,@SalePrice,@LandStatus,@LandFlags,@LandingType,@MediaAutoScale,@MediaTextureUUID,@MediaURL,@MusicURL,@PassHours,@PassPrice,@SnapshotUUID,@UserLocationX,@UserLocationY,@UserLocationZ,@UserLookAtX,@UserLookAtY,@UserLookAtZ,@AuthbuyerID,@OtherCleanTime)"; using (SqlConnection conn = new SqlConnection(m_connectionString)) using (SqlCommand cmd = new SqlCommand(sql, conn)) @@ -954,7 +954,6 @@ VALUES newData.SnapshotID = new UUID((Guid)row["SnapshotUUID"]); newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]); - newData.Dwell = Convert.ToInt32(row["Dwell"]); try { @@ -1357,7 +1356,6 @@ VALUES parameters.Add(_Database.CreateParameter("UserLookAtZ", land.UserLookAt.Z)); parameters.Add(_Database.CreateParameter("AuthBuyerID", land.AuthBuyerID)); parameters.Add(_Database.CreateParameter("OtherCleanTime", land.OtherCleanTime)); - parameters.Add(_Database.CreateParameter("Dwell", land.Dwell)); return parameters.ToArray(); } diff --git a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs index 04446ced4f..30253c3158 100644 --- a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs @@ -677,7 +677,7 @@ namespace OpenSim.Data.MySQL "MusicURL, PassHours, PassPrice, SnapshotUUID, " + "UserLocationX, UserLocationY, UserLocationZ, " + "UserLookAtX, UserLookAtY, UserLookAtZ, " + - "AuthbuyerID, OtherCleanTime, Dwell, MediaType, MediaDescription, " + + "AuthbuyerID, OtherCleanTime, MediaType, MediaDescription, " + "MediaSize, MediaLoop, ObscureMusic, ObscureMedia) values (" + "?UUID, ?RegionUUID, " + "?LocalLandID, ?Bitmap, ?Name, ?Description, " + @@ -688,7 +688,7 @@ namespace OpenSim.Data.MySQL "?MusicURL, ?PassHours, ?PassPrice, ?SnapshotUUID, " + "?UserLocationX, ?UserLocationY, ?UserLocationZ, " + "?UserLookAtX, ?UserLookAtY, ?UserLookAtZ, " + - "?AuthbuyerID, ?OtherCleanTime, ?Dwell, ?MediaType, ?MediaDescription, "+ + "?AuthbuyerID, ?OtherCleanTime, ?MediaType, ?MediaDescription, "+ "CONCAT(?MediaWidth, ',', ?MediaHeight), ?MediaLoop, ?ObscureMusic, ?ObscureMedia)"; FillLandCommand(cmd, parcel.LandData, parcel.RegionUUID); @@ -1329,7 +1329,6 @@ namespace OpenSim.Data.MySQL UUID.TryParse((string)row["AuthBuyerID"], out authedbuyer); UUID.TryParse((string)row["SnapshotUUID"], out snapshotID); newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]); - newData.Dwell = Convert.ToInt32(row["Dwell"]); newData.AuthBuyerID = authedbuyer; newData.SnapshotID = snapshotID; @@ -1660,7 +1659,6 @@ namespace OpenSim.Data.MySQL cmd.Parameters.AddWithValue("UserLookAtZ", land.UserLookAt.Z); cmd.Parameters.AddWithValue("AuthBuyerID", land.AuthBuyerID); cmd.Parameters.AddWithValue("OtherCleanTime", land.OtherCleanTime); - cmd.Parameters.AddWithValue("Dwell", land.Dwell); cmd.Parameters.AddWithValue("MediaDescription", land.MediaDescription); cmd.Parameters.AddWithValue("MediaType", land.MediaType); cmd.Parameters.AddWithValue("MediaWidth", land.MediaWidth); diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs index 8432e74592..88699a767f 100644 --- a/OpenSim/Data/SQLite/SQLiteRegionData.cs +++ b/OpenSim/Data/SQLite/SQLiteRegionData.cs @@ -1111,7 +1111,6 @@ namespace OpenSim.Data.SQLite createCol(land, "UserLookAtZ", typeof (Double)); createCol(land, "AuthbuyerID", typeof(String)); createCol(land, "OtherCleanTime", typeof(Int32)); - createCol(land, "Dwell", typeof(Int32)); land.PrimaryKey = new DataColumn[] {land.Columns["UUID"]}; @@ -1449,7 +1448,6 @@ namespace OpenSim.Data.SQLite UUID.TryParse((string)row["AuthbuyerID"], out authBuyerID); newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]); - newData.Dwell = Convert.ToInt32(row["Dwell"]); return newData; } @@ -1761,7 +1759,6 @@ namespace OpenSim.Data.SQLite row["UserLookAtZ"] = land.UserLookAt.Z; row["AuthbuyerID"] = land.AuthBuyerID.ToString(); row["OtherCleanTime"] = land.OtherCleanTime; - row["Dwell"] = land.Dwell; row["MediaType"] = land.MediaType; row["MediaDescription"] = land.MediaDescription; row["MediaSize"] = land.MediaWidth.ToString() + "," + land.MediaHeight.ToString(); diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs index 289fd948ce..b5ce4c0080 100644 --- a/OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs +++ b/OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs @@ -1069,7 +1069,6 @@ namespace OpenSim.Data.SQLiteLegacy createCol(land, "UserLookAtZ", typeof (Double)); createCol(land, "AuthbuyerID", typeof(String)); createCol(land, "OtherCleanTime", typeof(Int32)); - createCol(land, "Dwell", typeof(Int32)); land.PrimaryKey = new DataColumn[] {land.Columns["UUID"]}; @@ -1400,7 +1399,6 @@ namespace OpenSim.Data.SQLiteLegacy UUID.TryParse((string)row["AuthbuyerID"], out authBuyerID); newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]); - newData.Dwell = Convert.ToInt32(row["Dwell"]); return newData; } @@ -1711,7 +1709,6 @@ namespace OpenSim.Data.SQLiteLegacy row["UserLookAtZ"] = land.UserLookAt.Z; row["AuthbuyerID"] = land.AuthBuyerID.ToString(); row["OtherCleanTime"] = land.OtherCleanTime; - row["Dwell"] = land.Dwell; } /// diff --git a/OpenSim/Framework/LandData.cs b/OpenSim/Framework/LandData.cs index 4440c94163..5bb0413929 100644 --- a/OpenSim/Framework/LandData.cs +++ b/OpenSim/Framework/LandData.cs @@ -88,7 +88,6 @@ namespace OpenSim.Framework private UUID _snapshotID = UUID.Zero; private Vector3 _userLocation = new Vector3(); private Vector3 _userLookAt = new Vector3(); - private int _dwell = 0; private int _otherCleanTime = 0; private string _mediaType = "none/none"; private string _mediaDescription = ""; @@ -619,18 +618,6 @@ namespace OpenSim.Framework } } - /// - /// Deprecated idea. Number of visitors ~= free money - /// - public int Dwell { - get { - return _dwell; - } - set { - _dwell = value; - } - } - /// /// Number of minutes to return SceneObjectGroup that are owned by someone who doesn't own /// the parcel and isn't set to the same 'group' as the parcel. @@ -703,7 +690,6 @@ namespace OpenSim.Framework landData._userLocation = _userLocation; landData._userLookAt = _userLookAt; landData._otherCleanTime = _otherCleanTime; - landData._dwell = _dwell; landData._mediaType = _mediaType; landData._mediaDescription = _mediaDescription; landData._mediaWidth = _mediaWidth; diff --git a/OpenSim/Framework/Serialization/External/LandDataSerializer.cs b/OpenSim/Framework/Serialization/External/LandDataSerializer.cs index ff0afc86e8..fc0387b76c 100644 --- a/OpenSim/Framework/Serialization/External/LandDataSerializer.cs +++ b/OpenSim/Framework/Serialization/External/LandDataSerializer.cs @@ -118,7 +118,8 @@ namespace OpenSim.Framework.Serialization.External landData.SnapshotID = UUID.Parse( xtr.ReadElementString("SnapshotID")); landData.UserLocation = Vector3.Parse( xtr.ReadElementString("UserLocation")); landData.UserLookAt = Vector3.Parse( xtr.ReadElementString("UserLookAt")); - landData.Dwell = Convert.ToInt32( xtr.ReadElementString("Dwell")); + // No longer used here + xtr.ReadElementString("Dwell"); landData.OtherCleanTime = Convert.ToInt32( xtr.ReadElementString("OtherCleanTime")); xtr.ReadEndElement(); @@ -177,7 +178,7 @@ namespace OpenSim.Framework.Serialization.External xtw.WriteElementString("SnapshotID", landData.SnapshotID.ToString()); xtw.WriteElementString("UserLocation", landData.UserLocation.ToString()); xtw.WriteElementString("UserLookAt", landData.UserLookAt.ToString()); - xtw.WriteElementString("Dwell", Convert.ToString(landData.Dwell)); + xtw.WriteElementString("Dwell", "0"); xtw.WriteElementString("OtherCleanTime", Convert.ToString(landData.OtherCleanTime)); xtw.WriteEndElement(); diff --git a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs index f955df7731..41ece86047 100644 --- a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs +++ b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs @@ -57,80 +57,73 @@ namespace OpenSim.Framework.Servers.HttpServer { WebRequest request = WebRequest.Create(requestUrl); request.Method = verb; - - if ((verb == "POST") || (verb == "PUT")) - { - request.ContentType = "text/www-form-urlencoded"; - - MemoryStream buffer = new MemoryStream(); - int length = 0; - using (StreamWriter writer = new StreamWriter(buffer)) - { - writer.Write(obj); - writer.Flush(); - } - - length = (int)obj.Length; - request.ContentLength = length; - - Stream requestStream = null; - try - { - requestStream = request.GetRequestStream(); - requestStream.Write(buffer.ToArray(), 0, length); - } - catch (Exception e) - { - m_log.DebugFormat("[FORMS]: exception occured on sending request to {0}: " + e.ToString(), requestUrl); - } - finally - { - // If this is closed, it will be disposed internally, - // but the above write is asynchronous and may hit after - // we're through here. So the thread handling that will - // throw and put us back into the catch above. Isn't - // .NET great? - //if (requestStream != null) - // requestStream.Close(); - // Let's not close this - //buffer.Close(); - - } - } - string respstring = String.Empty; - try + using (MemoryStream buffer = new MemoryStream()) { - using (WebResponse resp = request.GetResponse()) + if ((verb == "POST") || (verb == "PUT")) { - if (resp.ContentLength != 0) + request.ContentType = "text/www-form-urlencoded"; + + int length = 0; + using (StreamWriter writer = new StreamWriter(buffer)) { - Stream respStream = null; - try + writer.Write(obj); + writer.Flush(); + } + + length = (int)obj.Length; + request.ContentLength = length; + + Stream requestStream = null; + try + { + requestStream = request.GetRequestStream(); + requestStream.Write(buffer.ToArray(), 0, length); + } + catch (Exception e) + { + m_log.DebugFormat("[FORMS]: exception occured on sending request to {0}: " + e.ToString(), requestUrl); + } + finally + { + if (requestStream != null) + requestStream.Close(); + } + } + + try + { + using (WebResponse resp = request.GetResponse()) + { + if (resp.ContentLength != 0) { - respStream = resp.GetResponseStream(); - using (StreamReader reader = new StreamReader(respStream)) + Stream respStream = null; + try { - respstring = reader.ReadToEnd(); + respStream = resp.GetResponseStream(); + using (StreamReader reader = new StreamReader(respStream)) + { + respstring = reader.ReadToEnd(); + } + } + catch (Exception e) + { + m_log.DebugFormat("[FORMS]: exception occured on receiving reply " + e.ToString()); + } + finally + { + if (respStream != null) + respStream.Close(); } - } - catch (Exception e) - { - m_log.DebugFormat("[FORMS]: exception occured on receiving reply " + e.ToString()); - } - finally - { - if (respStream != null) - respStream.Close(); } } } - } - catch (System.InvalidOperationException) - { - // This is what happens when there is invalid XML - m_log.DebugFormat("[FORMS]: InvalidOperationException on receiving request"); + catch (System.InvalidOperationException) + { + // This is what happens when there is invalid XML + m_log.DebugFormat("[FORMS]: InvalidOperationException on receiving request"); + } } return respstring; } diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index a1cd30a94c..3dea40cc05 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -2687,6 +2687,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void SendParcelInfo(RegionInfo info, LandData land, UUID parcelID, uint x, uint y) { + float dwell = 0.0f; + IDwellModule dwellModule = m_scene.RequestModuleInterface(); + if (dwellModule != null) + dwell = dwellModule.GetDwell(land.GlobalID); ParcelInfoReplyPacket reply = (ParcelInfoReplyPacket)PacketPool.Instance.GetPacket(PacketType.ParcelInfoReply); reply.AgentData.AgentID = m_agentId; reply.Data.ParcelID = parcelID; @@ -2711,7 +2715,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP reply.Data.GlobalZ = pos.Z; reply.Data.SimName = Utils.StringToBytes(info.RegionName); reply.Data.SnapshotID = land.SnapshotID; - reply.Data.Dwell = land.Dwell; + reply.Data.Dwell = dwell; reply.Data.SalePrice = land.SalePrice; reply.Data.AuctionID = (int)land.AuctionID; diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 776fe302a5..040dc8c850 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -171,7 +171,6 @@ namespace OpenSim.Region.CoreModules.World.Land client.OnParcelGodForceOwner += ClientOnParcelGodForceOwner; client.OnParcelReclaim += ClientOnParcelReclaim; client.OnParcelInfoRequest += ClientOnParcelInfoRequest; -// client.OnParcelDwellRequest += ClientOnParcelDwellRequest; client.OnParcelDeedToGroup += ClientOnParcelDeedToGroup; client.OnPreAgentUpdate += ClientOnPreAgentUpdate; @@ -1512,18 +1511,6 @@ namespace OpenSim.Region.CoreModules.World.Land #endregion - private void ClientOnParcelDwellRequest(int localID, IClientAPI remoteClient) - { - ILandObject selectedParcel = null; - lock (m_landList) - { - if (!m_landList.TryGetValue(localID, out selectedParcel)) - return; - } - - remoteClient.SendParcelDwellReply(localID, selectedParcel.LandData.GlobalID, selectedParcel.LandData.Dwell); - } - private void ClientOnParcelInfoRequest(IClientAPI remoteClient, UUID parcelID) { if (parcelID == UUID.Zero) diff --git a/OpenSim/Region/DataSnapshot/LandSnapshot.cs b/OpenSim/Region/DataSnapshot/LandSnapshot.cs index 64d29f2655..b8c90cd5a1 100644 --- a/OpenSim/Region/DataSnapshot/LandSnapshot.cs +++ b/OpenSim/Region/DataSnapshot/LandSnapshot.cs @@ -123,6 +123,8 @@ namespace OpenSim.Region.DataSnapshot.Providers ILandChannel landChannel = m_scene.LandChannel; List parcels = landChannel.AllParcels(); + IDwellModule dwellModule = m_scene.RequestModuleInterface(); + XmlNode parent = nodeFactory.CreateNode(XmlNodeType.Element, "parceldata", ""); if (parcels != null) { @@ -208,7 +210,10 @@ namespace OpenSim.Region.DataSnapshot.Providers xmlparcel.AppendChild(infouuid); XmlNode dwell = nodeFactory.CreateNode(XmlNodeType.Element, "dwell", ""); - dwell.InnerText = parcel.Dwell.ToString(); + if (dwellModule != null) + dwell.InnerText = dwellModule.GetDwell(parcel.GlobalID).ToString(); + else + dwell.InnerText = "0"; xmlparcel.AppendChild(dwell); //TODO: figure how to figure out teleport system landData.landingType From 6a0a878f7c268c6f248588895e232e3d14eb6eb3 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sun, 5 Sep 2010 14:16:42 +0200 Subject: [PATCH 40/57] Remove "Dwell" support from core and replace it with calls to methods on IDwellModule --- OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs | 6 +- OpenSim/Data/MySQL/MySQLLegacyRegionData.cs | 6 +- OpenSim/Data/SQLite/SQLiteRegionData.cs | 3 - OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs | 3 - OpenSim/Framework/LandData.cs | 14 -- .../External/LandDataSerializer.cs | 5 +- .../SynchronousRestFormsRequester.cs | 123 +++++++++--------- .../ClientStack/LindenUDP/LLClientView.cs | 6 +- .../World/Land/LandManagementModule.cs | 13 -- OpenSim/Region/DataSnapshot/LandSnapshot.cs | 7 +- 10 files changed, 78 insertions(+), 108 deletions(-) diff --git a/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs b/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs index 7ff87379b5..77b8a10f07 100644 --- a/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs +++ b/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs @@ -638,9 +638,9 @@ ELSE //Insert new values string sql = @"INSERT INTO [land] -([UUID],[RegionUUID],[LocalLandID],[Bitmap],[Name],[Description],[OwnerUUID],[IsGroupOwned],[Area],[AuctionID],[Category],[ClaimDate],[ClaimPrice],[GroupUUID],[SalePrice],[LandStatus],[LandFlags],[LandingType],[MediaAutoScale],[MediaTextureUUID],[MediaURL],[MusicURL],[PassHours],[PassPrice],[SnapshotUUID],[UserLocationX],[UserLocationY],[UserLocationZ],[UserLookAtX],[UserLookAtY],[UserLookAtZ],[AuthbuyerID],[OtherCleanTime],[Dwell]) +([UUID],[RegionUUID],[LocalLandID],[Bitmap],[Name],[Description],[OwnerUUID],[IsGroupOwned],[Area],[AuctionID],[Category],[ClaimDate],[ClaimPrice],[GroupUUID],[SalePrice],[LandStatus],[LandFlags],[LandingType],[MediaAutoScale],[MediaTextureUUID],[MediaURL],[MusicURL],[PassHours],[PassPrice],[SnapshotUUID],[UserLocationX],[UserLocationY],[UserLocationZ],[UserLookAtX],[UserLookAtY],[UserLookAtZ],[AuthbuyerID],[OtherCleanTime]) VALUES -(@UUID,@RegionUUID,@LocalLandID,@Bitmap,@Name,@Description,@OwnerUUID,@IsGroupOwned,@Area,@AuctionID,@Category,@ClaimDate,@ClaimPrice,@GroupUUID,@SalePrice,@LandStatus,@LandFlags,@LandingType,@MediaAutoScale,@MediaTextureUUID,@MediaURL,@MusicURL,@PassHours,@PassPrice,@SnapshotUUID,@UserLocationX,@UserLocationY,@UserLocationZ,@UserLookAtX,@UserLookAtY,@UserLookAtZ,@AuthbuyerID,@OtherCleanTime,@Dwell)"; +(@UUID,@RegionUUID,@LocalLandID,@Bitmap,@Name,@Description,@OwnerUUID,@IsGroupOwned,@Area,@AuctionID,@Category,@ClaimDate,@ClaimPrice,@GroupUUID,@SalePrice,@LandStatus,@LandFlags,@LandingType,@MediaAutoScale,@MediaTextureUUID,@MediaURL,@MusicURL,@PassHours,@PassPrice,@SnapshotUUID,@UserLocationX,@UserLocationY,@UserLocationZ,@UserLookAtX,@UserLookAtY,@UserLookAtZ,@AuthbuyerID,@OtherCleanTime)"; using (SqlConnection conn = new SqlConnection(m_connectionString)) using (SqlCommand cmd = new SqlCommand(sql, conn)) @@ -954,7 +954,6 @@ VALUES newData.SnapshotID = new UUID((Guid)row["SnapshotUUID"]); newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]); - newData.Dwell = Convert.ToInt32(row["Dwell"]); try { @@ -1357,7 +1356,6 @@ VALUES parameters.Add(_Database.CreateParameter("UserLookAtZ", land.UserLookAt.Z)); parameters.Add(_Database.CreateParameter("AuthBuyerID", land.AuthBuyerID)); parameters.Add(_Database.CreateParameter("OtherCleanTime", land.OtherCleanTime)); - parameters.Add(_Database.CreateParameter("Dwell", land.Dwell)); return parameters.ToArray(); } diff --git a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs index 04446ced4f..30253c3158 100644 --- a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs @@ -677,7 +677,7 @@ namespace OpenSim.Data.MySQL "MusicURL, PassHours, PassPrice, SnapshotUUID, " + "UserLocationX, UserLocationY, UserLocationZ, " + "UserLookAtX, UserLookAtY, UserLookAtZ, " + - "AuthbuyerID, OtherCleanTime, Dwell, MediaType, MediaDescription, " + + "AuthbuyerID, OtherCleanTime, MediaType, MediaDescription, " + "MediaSize, MediaLoop, ObscureMusic, ObscureMedia) values (" + "?UUID, ?RegionUUID, " + "?LocalLandID, ?Bitmap, ?Name, ?Description, " + @@ -688,7 +688,7 @@ namespace OpenSim.Data.MySQL "?MusicURL, ?PassHours, ?PassPrice, ?SnapshotUUID, " + "?UserLocationX, ?UserLocationY, ?UserLocationZ, " + "?UserLookAtX, ?UserLookAtY, ?UserLookAtZ, " + - "?AuthbuyerID, ?OtherCleanTime, ?Dwell, ?MediaType, ?MediaDescription, "+ + "?AuthbuyerID, ?OtherCleanTime, ?MediaType, ?MediaDescription, "+ "CONCAT(?MediaWidth, ',', ?MediaHeight), ?MediaLoop, ?ObscureMusic, ?ObscureMedia)"; FillLandCommand(cmd, parcel.LandData, parcel.RegionUUID); @@ -1329,7 +1329,6 @@ namespace OpenSim.Data.MySQL UUID.TryParse((string)row["AuthBuyerID"], out authedbuyer); UUID.TryParse((string)row["SnapshotUUID"], out snapshotID); newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]); - newData.Dwell = Convert.ToInt32(row["Dwell"]); newData.AuthBuyerID = authedbuyer; newData.SnapshotID = snapshotID; @@ -1660,7 +1659,6 @@ namespace OpenSim.Data.MySQL cmd.Parameters.AddWithValue("UserLookAtZ", land.UserLookAt.Z); cmd.Parameters.AddWithValue("AuthBuyerID", land.AuthBuyerID); cmd.Parameters.AddWithValue("OtherCleanTime", land.OtherCleanTime); - cmd.Parameters.AddWithValue("Dwell", land.Dwell); cmd.Parameters.AddWithValue("MediaDescription", land.MediaDescription); cmd.Parameters.AddWithValue("MediaType", land.MediaType); cmd.Parameters.AddWithValue("MediaWidth", land.MediaWidth); diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs index 8432e74592..88699a767f 100644 --- a/OpenSim/Data/SQLite/SQLiteRegionData.cs +++ b/OpenSim/Data/SQLite/SQLiteRegionData.cs @@ -1111,7 +1111,6 @@ namespace OpenSim.Data.SQLite createCol(land, "UserLookAtZ", typeof (Double)); createCol(land, "AuthbuyerID", typeof(String)); createCol(land, "OtherCleanTime", typeof(Int32)); - createCol(land, "Dwell", typeof(Int32)); land.PrimaryKey = new DataColumn[] {land.Columns["UUID"]}; @@ -1449,7 +1448,6 @@ namespace OpenSim.Data.SQLite UUID.TryParse((string)row["AuthbuyerID"], out authBuyerID); newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]); - newData.Dwell = Convert.ToInt32(row["Dwell"]); return newData; } @@ -1761,7 +1759,6 @@ namespace OpenSim.Data.SQLite row["UserLookAtZ"] = land.UserLookAt.Z; row["AuthbuyerID"] = land.AuthBuyerID.ToString(); row["OtherCleanTime"] = land.OtherCleanTime; - row["Dwell"] = land.Dwell; row["MediaType"] = land.MediaType; row["MediaDescription"] = land.MediaDescription; row["MediaSize"] = land.MediaWidth.ToString() + "," + land.MediaHeight.ToString(); diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs index 289fd948ce..b5ce4c0080 100644 --- a/OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs +++ b/OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs @@ -1069,7 +1069,6 @@ namespace OpenSim.Data.SQLiteLegacy createCol(land, "UserLookAtZ", typeof (Double)); createCol(land, "AuthbuyerID", typeof(String)); createCol(land, "OtherCleanTime", typeof(Int32)); - createCol(land, "Dwell", typeof(Int32)); land.PrimaryKey = new DataColumn[] {land.Columns["UUID"]}; @@ -1400,7 +1399,6 @@ namespace OpenSim.Data.SQLiteLegacy UUID.TryParse((string)row["AuthbuyerID"], out authBuyerID); newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]); - newData.Dwell = Convert.ToInt32(row["Dwell"]); return newData; } @@ -1711,7 +1709,6 @@ namespace OpenSim.Data.SQLiteLegacy row["UserLookAtZ"] = land.UserLookAt.Z; row["AuthbuyerID"] = land.AuthBuyerID.ToString(); row["OtherCleanTime"] = land.OtherCleanTime; - row["Dwell"] = land.Dwell; } /// diff --git a/OpenSim/Framework/LandData.cs b/OpenSim/Framework/LandData.cs index f263e67d84..8d3266b944 100644 --- a/OpenSim/Framework/LandData.cs +++ b/OpenSim/Framework/LandData.cs @@ -88,7 +88,6 @@ namespace OpenSim.Framework private UUID _snapshotID = UUID.Zero; private Vector3 _userLocation = new Vector3(); private Vector3 _userLookAt = new Vector3(); - private int _dwell = 0; private int _otherCleanTime = 0; private string _mediaType = "none/none"; private string _mediaDescription = ""; @@ -619,18 +618,6 @@ namespace OpenSim.Framework } } - /// - /// Deprecated idea. Number of visitors ~= free money - /// - public int Dwell { - get { - return _dwell; - } - set { - _dwell = value; - } - } - /// /// Number of minutes to return SceneObjectGroup that are owned by someone who doesn't own /// the parcel and isn't set to the same 'group' as the parcel. @@ -703,7 +690,6 @@ namespace OpenSim.Framework landData._userLocation = _userLocation; landData._userLookAt = _userLookAt; landData._otherCleanTime = _otherCleanTime; - landData._dwell = _dwell; landData._mediaType = _mediaType; landData._mediaDescription = _mediaDescription; landData._mediaWidth = _mediaWidth; diff --git a/OpenSim/Framework/Serialization/External/LandDataSerializer.cs b/OpenSim/Framework/Serialization/External/LandDataSerializer.cs index ff0afc86e8..fc0387b76c 100644 --- a/OpenSim/Framework/Serialization/External/LandDataSerializer.cs +++ b/OpenSim/Framework/Serialization/External/LandDataSerializer.cs @@ -118,7 +118,8 @@ namespace OpenSim.Framework.Serialization.External landData.SnapshotID = UUID.Parse( xtr.ReadElementString("SnapshotID")); landData.UserLocation = Vector3.Parse( xtr.ReadElementString("UserLocation")); landData.UserLookAt = Vector3.Parse( xtr.ReadElementString("UserLookAt")); - landData.Dwell = Convert.ToInt32( xtr.ReadElementString("Dwell")); + // No longer used here + xtr.ReadElementString("Dwell"); landData.OtherCleanTime = Convert.ToInt32( xtr.ReadElementString("OtherCleanTime")); xtr.ReadEndElement(); @@ -177,7 +178,7 @@ namespace OpenSim.Framework.Serialization.External xtw.WriteElementString("SnapshotID", landData.SnapshotID.ToString()); xtw.WriteElementString("UserLocation", landData.UserLocation.ToString()); xtw.WriteElementString("UserLookAt", landData.UserLookAt.ToString()); - xtw.WriteElementString("Dwell", Convert.ToString(landData.Dwell)); + xtw.WriteElementString("Dwell", "0"); xtw.WriteElementString("OtherCleanTime", Convert.ToString(landData.OtherCleanTime)); xtw.WriteEndElement(); diff --git a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs index b2c1c54954..0135a6c9bc 100644 --- a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs +++ b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs @@ -57,80 +57,77 @@ namespace OpenSim.Framework.Servers.HttpServer { WebRequest request = WebRequest.Create(requestUrl); request.Method = verb; - - if ((verb == "POST") || (verb == "PUT")) - { - request.ContentType = "text/www-form-urlencoded"; - - MemoryStream buffer = new MemoryStream(); - int length = 0; - using (StreamWriter writer = new StreamWriter(buffer)) - { - writer.Write(obj); - writer.Flush(); - } - - length = (int)obj.Length; - request.ContentLength = length; - - Stream requestStream = null; - try - { - requestStream = request.GetRequestStream(); - requestStream.Write(buffer.ToArray(), 0, length); - } - catch (Exception e) - { - m_log.DebugFormat("[FORMS]: exception occured on sending request to {0}: " + e.ToString(), requestUrl); - } - finally - { - // If this is closed, it will be disposed internally, - // but the above write is asynchronous and may hit after - // we're through here. So the thread handling that will - // throw and put us back into the catch above. Isn't - // .NET great? - //if (requestStream != null) - // requestStream.Close(); - // Let's not close this - //buffer.Close(); - - } - } - string respstring = String.Empty; - try + using (MemoryStream buffer = new MemoryStream()) { - using (WebResponse resp = request.GetResponse()) + if ((verb == "POST") || (verb == "PUT")) { - if (resp.ContentLength > 0) + request.ContentType = "text/www-form-urlencoded"; + + int length = 0; + using (StreamWriter writer = new StreamWriter(buffer)) { - Stream respStream = null; - try + writer.Write(obj); + writer.Flush(); + } + + length = (int)obj.Length; + request.ContentLength = length; + + Stream requestStream = null; + try + { + requestStream = request.GetRequestStream(); + requestStream.Write(buffer.ToArray(), 0, length); + } + catch (Exception e) + { + m_log.DebugFormat("[FORMS]: exception occured on sending request to {0}: " + e.ToString(), requestUrl); + } + finally + { + if (requestStream != null) + requestStream.Close(); + } + } + + try + { +<<<<<<< HEAD:OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs + if (resp.ContentLength > 0) +======= + using (WebResponse resp = request.GetResponse()) +>>>>>>> e593607... Remove "Dwell" support from core and replace it with calls to methods:OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs + { + if (resp.ContentLength != 0) { - respStream = resp.GetResponseStream(); - using (StreamReader reader = new StreamReader(respStream)) + Stream respStream = null; + try { - respstring = reader.ReadToEnd(); + respStream = resp.GetResponseStream(); + using (StreamReader reader = new StreamReader(respStream)) + { + respstring = reader.ReadToEnd(); + } + } + catch (Exception e) + { + m_log.DebugFormat("[FORMS]: exception occured on receiving reply " + e.ToString()); + } + finally + { + if (respStream != null) + respStream.Close(); } - } - catch (Exception e) - { - m_log.DebugFormat("[FORMS]: exception occured on receiving reply " + e.ToString()); - } - finally - { - if (respStream != null) - respStream.Close(); } } } - } - catch (System.InvalidOperationException) - { - // This is what happens when there is invalid XML - m_log.DebugFormat("[FORMS]: InvalidOperationException on receiving request"); + catch (System.InvalidOperationException) + { + // This is what happens when there is invalid XML + m_log.DebugFormat("[FORMS]: InvalidOperationException on receiving request"); + } } return respstring; } diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 3d4269fe11..9cdc80b707 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -2668,6 +2668,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void SendParcelInfo(RegionInfo info, LandData land, UUID parcelID, uint x, uint y) { + float dwell = 0.0f; + IDwellModule dwellModule = m_scene.RequestModuleInterface(); + if (dwellModule != null) + dwell = dwellModule.GetDwell(land.GlobalID); ParcelInfoReplyPacket reply = (ParcelInfoReplyPacket)PacketPool.Instance.GetPacket(PacketType.ParcelInfoReply); reply.AgentData.AgentID = m_agentId; reply.Data.ParcelID = parcelID; @@ -2692,7 +2696,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP reply.Data.GlobalZ = pos.Z; reply.Data.SimName = Utils.StringToBytes(info.RegionName); reply.Data.SnapshotID = land.SnapshotID; - reply.Data.Dwell = land.Dwell; + reply.Data.Dwell = dwell; reply.Data.SalePrice = land.SalePrice; reply.Data.AuctionID = (int)land.AuctionID; diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 3e79ec0c10..268e2ee402 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -163,7 +163,6 @@ namespace OpenSim.Region.CoreModules.World.Land client.OnParcelGodForceOwner += ClientOnParcelGodForceOwner; client.OnParcelReclaim += ClientOnParcelReclaim; client.OnParcelInfoRequest += ClientOnParcelInfoRequest; - client.OnParcelDwellRequest += ClientOnParcelDwellRequest; client.OnParcelDeedToGroup += ClientOnParcelDeedToGroup; client.OnPreAgentUpdate += ClientOnPreAgentUpdate; @@ -1487,18 +1486,6 @@ namespace OpenSim.Region.CoreModules.World.Land #endregion - private void ClientOnParcelDwellRequest(int localID, IClientAPI remoteClient) - { - ILandObject selectedParcel = null; - lock (m_landList) - { - if (!m_landList.TryGetValue(localID, out selectedParcel)) - return; - } - - remoteClient.SendParcelDwellReply(localID, selectedParcel.LandData.GlobalID, selectedParcel.LandData.Dwell); - } - private void ClientOnParcelInfoRequest(IClientAPI remoteClient, UUID parcelID) { if (parcelID == UUID.Zero) diff --git a/OpenSim/Region/DataSnapshot/LandSnapshot.cs b/OpenSim/Region/DataSnapshot/LandSnapshot.cs index 64d29f2655..b8c90cd5a1 100644 --- a/OpenSim/Region/DataSnapshot/LandSnapshot.cs +++ b/OpenSim/Region/DataSnapshot/LandSnapshot.cs @@ -123,6 +123,8 @@ namespace OpenSim.Region.DataSnapshot.Providers ILandChannel landChannel = m_scene.LandChannel; List parcels = landChannel.AllParcels(); + IDwellModule dwellModule = m_scene.RequestModuleInterface(); + XmlNode parent = nodeFactory.CreateNode(XmlNodeType.Element, "parceldata", ""); if (parcels != null) { @@ -208,7 +210,10 @@ namespace OpenSim.Region.DataSnapshot.Providers xmlparcel.AppendChild(infouuid); XmlNode dwell = nodeFactory.CreateNode(XmlNodeType.Element, "dwell", ""); - dwell.InnerText = parcel.Dwell.ToString(); + if (dwellModule != null) + dwell.InnerText = dwellModule.GetDwell(parcel.GlobalID).ToString(); + else + dwell.InnerText = "0"; xmlparcel.AppendChild(dwell); //TODO: figure how to figure out teleport system landData.landingType From 09c75b30f361cbcdd0123f0e65b24f031a9bdeae Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 5 Sep 2010 16:45:24 +0100 Subject: [PATCH 41/57] Fix build break --- .../Servers/HttpServer/SynchronousRestFormsRequester.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs index 0135a6c9bc..41ece86047 100644 --- a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs +++ b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs @@ -94,11 +94,7 @@ namespace OpenSim.Framework.Servers.HttpServer try { -<<<<<<< HEAD:OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs - if (resp.ContentLength > 0) -======= using (WebResponse resp = request.GetResponse()) ->>>>>>> e593607... Remove "Dwell" support from core and replace it with calls to methods:OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs { if (resp.ContentLength != 0) { From 64ec14c8c4cb58552dc557f350024f505492b5a9 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 5 Sep 2010 17:08:57 +0100 Subject: [PATCH 42/57] Add missing IDwellModule interface --- .../Framework/Interfaces/IDwellModule.cs | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 OpenSim/Region/Framework/Interfaces/IDwellModule.cs diff --git a/OpenSim/Region/Framework/Interfaces/IDwellModule.cs b/OpenSim/Region/Framework/Interfaces/IDwellModule.cs new file mode 100644 index 0000000000..db504393a2 --- /dev/null +++ b/OpenSim/Region/Framework/Interfaces/IDwellModule.cs @@ -0,0 +1,37 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using OpenMetaverse; +using OpenSim.Framework; + +namespace OpenSim.Region.Framework.Interfaces +{ + public interface IDwellModule + { + int GetDwell(UUID parcelID); + } +} From 4025b85a07619e1d1e22095eb3f65d2238c15378 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 5 Sep 2010 17:24:05 +0100 Subject: [PATCH 43/57] As an exmple, add the code to disable connectors intot he simian asset connector --- .../SimianGrid/SimianAssetServiceConnector.cs | 35 ++++++++++++------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs index 3a4f84f69c..99e69838ab 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs @@ -55,6 +55,7 @@ namespace OpenSim.Services.Connectors.SimianGrid private string m_serverUrl = String.Empty; private IImprovedAssetCache m_cache; + private bool m_Enabled = false; #region ISharedRegionModule @@ -73,8 +74,8 @@ namespace OpenSim.Services.Connectors.SimianGrid public SimianAssetServiceConnector() { } public string Name { get { return "SimianAssetServiceConnector"; } } - public void AddRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.RegisterModuleInterface(this); } } - public void RemoveRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.UnregisterModuleInterface(this); } } + public void AddRegion(Scene scene) { if (m_Enabled) { scene.RegisterModuleInterface(this); } } + public void RemoveRegion(Scene scene) { if (m_Enabled) { scene.UnregisterModuleInterface(this); } } #endregion ISharedRegionModule @@ -85,20 +86,30 @@ namespace OpenSim.Services.Connectors.SimianGrid public void Initialise(IConfigSource source) { - IConfig gridConfig = source.Configs["AssetService"]; - if (gridConfig != null) + IConfig moduleConfig = source.Configs["Modules"]; + if (moduleConfig != null) { - string serviceUrl = gridConfig.GetString("AssetServerURI"); - if (!String.IsNullOrEmpty(serviceUrl)) + string name = moduleConfig.GetString("AssetServices", ""); + if (name == Name) { - if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) - serviceUrl = serviceUrl + '/'; - m_serverUrl = serviceUrl; + IConfig gridConfig = source.Configs["AssetService"]; + if (gridConfig != null) + { + string serviceUrl = gridConfig.GetString("AssetServerURI"); + if (!String.IsNullOrEmpty(serviceUrl)) + { + if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) + serviceUrl = serviceUrl + '/'; + m_serverUrl = serviceUrl; + } + } + + if (String.IsNullOrEmpty(m_serverUrl)) + m_log.Info("[SIMIAN ASSET CONNECTOR]: No AssetServerURI specified, disabling connector"); + else + m_Enabled = true; } } - - if (String.IsNullOrEmpty(m_serverUrl)) - m_log.Info("[SIMIAN ASSET CONNECTOR]: No AssetServerURI specified, disabling connector"); } #region IAssetService From d9e9c41e1311d2a3bc11d16d031b0c1f969027e8 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 5 Sep 2010 17:34:51 +0100 Subject: [PATCH 44/57] Add m_Enabled pattern to SimianGridConnector --- .../SimianGrid/SimianGridServiceConnector.cs | 42 ++++++++++++------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs index 9d67ccbe51..a94620b983 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs @@ -60,6 +60,7 @@ namespace OpenSim.Services.Connectors.SimianGrid private string m_serverUrl = String.Empty; private Dictionary m_scenes = new Dictionary(); + private bool m_Enabled = false; #region ISharedRegionModule @@ -72,21 +73,25 @@ namespace OpenSim.Services.Connectors.SimianGrid public string Name { get { return "SimianGridServiceConnector"; } } public void AddRegion(Scene scene) { + if (!m_Enabled) + return; + // Every shared region module has to maintain an indepedent list of // currently running regions lock (m_scenes) m_scenes[scene.RegionInfo.RegionID] = scene; - if (!String.IsNullOrEmpty(m_serverUrl)) - scene.RegisterModuleInterface(this); + scene.RegisterModuleInterface(this); } public void RemoveRegion(Scene scene) { + if (!m_Enabled) + return; + lock (m_scenes) m_scenes.Remove(scene.RegionInfo.RegionID); - if (!String.IsNullOrEmpty(m_serverUrl)) - scene.UnregisterModuleInterface(this); + scene.UnregisterModuleInterface(this); } #endregion ISharedRegionModule @@ -98,20 +103,29 @@ namespace OpenSim.Services.Connectors.SimianGrid public void Initialise(IConfigSource source) { - IConfig gridConfig = source.Configs["GridService"]; - if (gridConfig != null) + IConfig moduleConfig = source.Configs["Modules"]; + if (moduleConfig != null) { - string serviceUrl = gridConfig.GetString("GridServerURI"); - if (!String.IsNullOrEmpty(serviceUrl)) + string name = moduleConfig.GetString("GridServices", ""); + if (name == Name) { - if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) - serviceUrl = serviceUrl + '/'; - m_serverUrl = serviceUrl; + IConfig gridConfig = source.Configs["GridService"]; + if (gridConfig != null) + { + string serviceUrl = gridConfig.GetString("GridServerURI"); + if (!String.IsNullOrEmpty(serviceUrl)) + { + if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) + serviceUrl = serviceUrl + '/'; + m_serverUrl = serviceUrl; + m_Enabled = true; + } + } + + if (String.IsNullOrEmpty(m_serverUrl)) + m_log.Info("[SIMIAN GRID CONNECTOR]: No GridServerURI specified, disabling connector"); } } - - if (String.IsNullOrEmpty(m_serverUrl)) - m_log.Info("[SIMIAN GRID CONNECTOR]: No GridServerURI specified, disabling connector"); } #region IGridService From a407ad38f602614655d1fba776d7721417967761 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 5 Sep 2010 17:44:02 +0100 Subject: [PATCH 45/57] Add the m_Enabled pattern to Simian Auth --- .../SimianAuthenticationServiceConnector.cs | 34 ++++++++++++------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs index f1c25751d4..0ce8db8dda 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs @@ -51,6 +51,7 @@ namespace OpenSim.Services.Connectors.SimianGrid MethodBase.GetCurrentMethod().DeclaringType); private string m_serverUrl = String.Empty; + private bool m_Enabled = false; #region ISharedRegionModule @@ -61,8 +62,8 @@ namespace OpenSim.Services.Connectors.SimianGrid public SimianAuthenticationServiceConnector() { } public string Name { get { return "SimianAuthenticationServiceConnector"; } } - public void AddRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.RegisterModuleInterface(this); } } - public void RemoveRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.UnregisterModuleInterface(this); } } + public void AddRegion(Scene scene) { if (m_Enabled) { scene.RegisterModuleInterface(this); } } + public void RemoveRegion(Scene scene) { if (m_Enabled) { scene.UnregisterModuleInterface(this); } } #endregion ISharedRegionModule @@ -73,20 +74,29 @@ namespace OpenSim.Services.Connectors.SimianGrid public void Initialise(IConfigSource source) { - IConfig gridConfig = source.Configs["AuthenticationService"]; - if (gridConfig != null) + IConfig moduleConfig = source.Configs["Modules"]; + if (moduleConfig != null) { - string serviceUrl = gridConfig.GetString("AuthenticationServerURI"); - if (!String.IsNullOrEmpty(serviceUrl)) + string name = moduleConfig.GetString("AssetServices", ""); + if (name == Name) { - if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) - serviceUrl = serviceUrl + '/'; - m_serverUrl = serviceUrl; + IConfig gridConfig = source.Configs["AuthenticationService"]; + if (gridConfig != null) + { + string serviceUrl = gridConfig.GetString("AuthenticationServerURI"); + if (!String.IsNullOrEmpty(serviceUrl)) + { + if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) + serviceUrl = serviceUrl + '/'; + m_serverUrl = serviceUrl; + m_Enabled = true; + } + } + + if (String.IsNullOrEmpty(m_serverUrl)) + m_log.Info("[SIMIAN AUTH CONNECTOR]: No AuthenticationServerURI specified, disabling connector"); } } - - if (String.IsNullOrEmpty(m_serverUrl)) - m_log.Info("[SIMIAN AUTH CONNECTOR]: No AuthenticationServerURI specified, disabling connector"); } public string Authenticate(UUID principalID, string password, int lifetime) From 1238b27d6473cc7f258c6ca08b71446fb69a20ad Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 5 Sep 2010 17:53:15 +0100 Subject: [PATCH 46/57] And the avatar services :) --- .../SimianAvatarServiceConnector.cs | 34 ++++++++++++------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs index c2e20a3093..97cb9e3cf3 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs @@ -56,6 +56,7 @@ namespace OpenSim.Services.Connectors.SimianGrid // private static string ZeroID = UUID.Zero.ToString(); private string m_serverUrl = String.Empty; + private bool m_Enabled = false; #region ISharedRegionModule @@ -66,8 +67,8 @@ namespace OpenSim.Services.Connectors.SimianGrid public SimianAvatarServiceConnector() { } public string Name { get { return "SimianAvatarServiceConnector"; } } - public void AddRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.RegisterModuleInterface(this); } } - public void RemoveRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.UnregisterModuleInterface(this); } } + public void AddRegion(Scene scene) { if (m_Enabled) { scene.RegisterModuleInterface(this); } } + public void RemoveRegion(Scene scene) { if (m_Enabled) { scene.UnregisterModuleInterface(this); } } #endregion ISharedRegionModule @@ -78,20 +79,29 @@ namespace OpenSim.Services.Connectors.SimianGrid public void Initialise(IConfigSource source) { - IConfig gridConfig = source.Configs["AvatarService"]; - if (gridConfig != null) + IConfig moduleConfig = source.Configs["Modules"]; + if (moduleConfig != null) { - string serviceUrl = gridConfig.GetString("AvatarServerURI"); - if (!String.IsNullOrEmpty(serviceUrl)) + string name = moduleConfig.GetString("AssetServices", ""); + if (name == Name) { - if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) - serviceUrl = serviceUrl + '/'; - m_serverUrl = serviceUrl; + IConfig gridConfig = source.Configs["AvatarService"]; + if (gridConfig != null) + { + string serviceUrl = gridConfig.GetString("AvatarServerURI"); + if (!String.IsNullOrEmpty(serviceUrl)) + { + if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) + serviceUrl = serviceUrl + '/'; + m_serverUrl = serviceUrl; + m_Enabled = true; + } + } + + if (String.IsNullOrEmpty(m_serverUrl)) + m_log.Info("[SIMIAN AVATAR CONNECTOR]: No AvatarServerURI specified, disabling connector"); } } - - if (String.IsNullOrEmpty(m_serverUrl)) - m_log.Info("[SIMIAN AVATAR CONNECTOR]: No AvatarServerURI specified, disabling connector"); } #region IAvatarService From b2486df67c11cb79ef08882299d3d6fbeac05448 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 5 Sep 2010 18:06:42 +0100 Subject: [PATCH 47/57] Friends works differently, it' snot even a region module at all, but a connector that is loaded by the core friends module. Change Simian to match. --- .../SimianGrid/SimianFriendsServiceConnector.cs | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs index 1afb1e1e99..5b18aeff3c 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs @@ -46,8 +46,7 @@ namespace OpenSim.Services.Connectors.SimianGrid /// /// Stores and retrieves friend lists from the SimianGrid backend /// - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class SimianFriendsServiceConnector : IFriendsService, ISharedRegionModule + public class SimianFriendsServiceConnector : IFriendsService { private static readonly ILog m_log = LogManager.GetLogger( @@ -55,20 +54,6 @@ namespace OpenSim.Services.Connectors.SimianGrid private string m_serverUrl = String.Empty; - #region ISharedRegionModule - - public Type ReplaceableInterface { get { return null; } } - public void RegionLoaded(Scene scene) { } - public void PostInitialise() { } - public void Close() { } - - public SimianFriendsServiceConnector() { } - public string Name { get { return "SimianFriendsServiceConnector"; } } - public void AddRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.RegisterModuleInterface(this); } } - public void RemoveRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.UnregisterModuleInterface(this); } } - - #endregion ISharedRegionModule - public SimianFriendsServiceConnector(IConfigSource source) { Initialise(source); From 0ca48b2486e64cf0372d7190efdd1455e7158bad Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 5 Sep 2010 18:14:31 +0100 Subject: [PATCH 48/57] Fix up Simian inentory --- .../SimianInventoryServiceConnector.cs | 48 ++++++++++++------- 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs index 63aaad7bac..1862842eb4 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs @@ -70,6 +70,7 @@ namespace OpenSim.Services.Connectors.SimianGrid private string m_serverUrl = String.Empty; private string m_userServerUrl = String.Empty; // private object m_gestureSyncRoot = new object(); + private bool m_Enabled = false; #region ISharedRegionModule @@ -80,8 +81,8 @@ namespace OpenSim.Services.Connectors.SimianGrid public SimianInventoryServiceConnector() { } public string Name { get { return "SimianInventoryServiceConnector"; } } - public void AddRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.RegisterModuleInterface(this); } } - public void RemoveRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.UnregisterModuleInterface(this); } } + public void AddRegion(Scene scene) { if (m_Enabled) { scene.RegisterModuleInterface(this); } } + public void RemoveRegion(Scene scene) { if (m_Enabled) { scene.UnregisterModuleInterface(this); } } #endregion ISharedRegionModule @@ -92,30 +93,41 @@ namespace OpenSim.Services.Connectors.SimianGrid public void Initialise(IConfigSource source) { - IConfig gridConfig = source.Configs["InventoryService"]; - if (gridConfig != null) + IConfig moduleConfig = source.Configs["Modules"]; + if (moduleConfig != null) { - string serviceUrl = gridConfig.GetString("InventoryServerURI"); - if (!String.IsNullOrEmpty(serviceUrl)) + string name = moduleConfig.GetString("AssetServices", ""); + if (name == Name) { - if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) - serviceUrl = serviceUrl + '/'; - m_serverUrl = serviceUrl; - - gridConfig = source.Configs["UserAccountService"]; + IConfig gridConfig = source.Configs["InventoryService"]; if (gridConfig != null) { - serviceUrl = gridConfig.GetString("UserAccountServerURI"); + string serviceUrl = gridConfig.GetString("InventoryServerURI"); if (!String.IsNullOrEmpty(serviceUrl)) - m_userServerUrl = serviceUrl; + { + if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) + serviceUrl = serviceUrl + '/'; + m_serverUrl = serviceUrl; + + gridConfig = source.Configs["UserAccountService"]; + if (gridConfig != null) + { + serviceUrl = gridConfig.GetString("UserAccountServerURI"); + if (!String.IsNullOrEmpty(serviceUrl)) + { + m_userServerUrl = serviceUrl; + m_Enabled = true; + } + } + } } + + if (String.IsNullOrEmpty(m_serverUrl)) + m_log.Info("[SIMIAN INVENTORY CONNECTOR]: No InventoryServerURI specified, disabling connector"); + else if (String.IsNullOrEmpty(m_userServerUrl)) + m_log.Info("[SIMIAN INVENTORY CONNECTOR]: No UserAccountServerURI specified, disabling connector"); } } - - if (String.IsNullOrEmpty(m_serverUrl)) - m_log.Info("[SIMIAN INVENTORY CONNECTOR]: No InventoryServerURI specified, disabling connector"); - else if (String.IsNullOrEmpty(m_userServerUrl)) - m_log.Info("[SIMIAN INVENTORY CONNECTOR]: No UserAccountServerURI specified, disabling connector"); } /// From 55d3c9891732d730ad91f5d5b65f7b39d6501029 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 5 Sep 2010 18:24:16 +0100 Subject: [PATCH 49/57] Fix up presence connector in SimianGrid --- .../SimianPresenceServiceConnector.cs | 34 ++++++++++++------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs index 778f3f4c29..fd667ed67f 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs @@ -59,6 +59,7 @@ namespace OpenSim.Services.Connectors.SimianGrid private string m_serverUrl = String.Empty; private SimianActivityDetector m_activityDetector; + private bool m_Enabled = false; #region ISharedRegionModule @@ -71,7 +72,7 @@ namespace OpenSim.Services.Connectors.SimianGrid public string Name { get { return "SimianPresenceServiceConnector"; } } public void AddRegion(Scene scene) { - if (!String.IsNullOrEmpty(m_serverUrl)) + if (m_Enabled) { scene.RegisterModuleInterface(this); scene.RegisterModuleInterface(this); @@ -83,7 +84,7 @@ namespace OpenSim.Services.Connectors.SimianGrid } public void RemoveRegion(Scene scene) { - if (!String.IsNullOrEmpty(m_serverUrl)) + if (m_Enabled) { scene.UnregisterModuleInterface(this); scene.UnregisterModuleInterface(this); @@ -103,20 +104,29 @@ namespace OpenSim.Services.Connectors.SimianGrid public void Initialise(IConfigSource source) { - IConfig gridConfig = source.Configs["PresenceService"]; - if (gridConfig != null) + IConfig moduleConfig = source.Configs["Modules"]; + if (moduleConfig != null) { - string serviceUrl = gridConfig.GetString("PresenceServerURI"); - if (!String.IsNullOrEmpty(serviceUrl)) + string name = moduleConfig.GetString("AssetServices", ""); + if (name == Name) { - if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) - serviceUrl = serviceUrl + '/'; - m_serverUrl = serviceUrl; + IConfig gridConfig = source.Configs["PresenceService"]; + if (gridConfig != null) + { + string serviceUrl = gridConfig.GetString("PresenceServerURI"); + if (!String.IsNullOrEmpty(serviceUrl)) + { + if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) + serviceUrl = serviceUrl + '/'; + m_serverUrl = serviceUrl; + m_Enabled = true; + } + } + + if (String.IsNullOrEmpty(m_serverUrl)) + m_log.Info("[SIMIAN PRESENCE CONNECTOR]: No PresenceServerURI specified, disabling connector"); } } - - if (String.IsNullOrEmpty(m_serverUrl)) - m_log.Info("[SIMIAN PRESENCE CONNECTOR]: No PresenceServerURI specified, disabling connector"); } #region IPresenceService From 4243701d22dd86aa7ac61459a6bd9129635dab43 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 5 Sep 2010 19:06:50 +0100 Subject: [PATCH 50/57] Make Simian profiles respect the module chosen in [Profile] --- .../Services/Connectors/SimianGrid/SimianProfiles.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs b/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs index a817d7c2cd..0ef4974f79 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs @@ -67,6 +67,7 @@ namespace OpenSim.Services.Connectors.SimianGrid MethodBase.GetCurrentMethod().DeclaringType); private string m_serverUrl = String.Empty; + private bool m_Enabled = false; #region INonSharedRegionModule @@ -76,8 +77,8 @@ namespace OpenSim.Services.Connectors.SimianGrid public SimianProfiles() { } public string Name { get { return "SimianProfiles"; } } - public void AddRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { CheckEstateManager(scene); scene.EventManager.OnClientConnect += ClientConnectHandler; } } - public void RemoveRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.EventManager.OnClientConnect -= ClientConnectHandler; } } + public void AddRegion(Scene scene) { if (m_Enabled) { CheckEstateManager(scene); scene.EventManager.OnClientConnect += ClientConnectHandler; } } + public void RemoveRegion(Scene scene) { if (m_Enabled) { scene.EventManager.OnClientConnect -= ClientConnectHandler; } } #endregion INonSharedRegionModule @@ -88,6 +89,13 @@ namespace OpenSim.Services.Connectors.SimianGrid public void Initialise(IConfigSource source) { + IConfig profileConfig = source.Configs["Profile"]; + if (profileConfig == null) + return; + + if (profileConfig.GetString("Module", String.Empty) != Name) + return; + IConfig gridConfig = source.Configs["UserAccountService"]; if (gridConfig != null) { From 1b770d3afc435f94577f27889ce903350d57557e Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 5 Sep 2010 19:09:30 +0100 Subject: [PATCH 51/57] Change UserAccountService to match --- .../SimianUserAccountServiceConnector.cs | 34 ++++++++++++------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs index 4c8662fe40..deb86951b6 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs @@ -55,6 +55,7 @@ namespace OpenSim.Services.Connectors.SimianGrid private string m_serverUrl = String.Empty; private ExpiringCache m_accountCache; + private bool m_Enabled = false; #region ISharedRegionModule @@ -65,8 +66,8 @@ namespace OpenSim.Services.Connectors.SimianGrid public SimianUserAccountServiceConnector() { } public string Name { get { return "SimianUserAccountServiceConnector"; } } - public void AddRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.RegisterModuleInterface(this); } } - public void RemoveRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.UnregisterModuleInterface(this); } } + public void AddRegion(Scene scene) { if (m_Enabled) { scene.RegisterModuleInterface(this); } } + public void RemoveRegion(Scene scene) { if (m_Enabled) { scene.UnregisterModuleInterface(this); } } #endregion ISharedRegionModule @@ -77,20 +78,29 @@ namespace OpenSim.Services.Connectors.SimianGrid public void Initialise(IConfigSource source) { - IConfig gridConfig = source.Configs["UserAccountService"]; - if (gridConfig != null) + IConfig moduleConfig = source.Configs["Modules"]; + if (moduleConfig != null) { - string serviceUrl = gridConfig.GetString("UserAccountServerURI"); - if (!String.IsNullOrEmpty(serviceUrl)) + string name = moduleConfig.GetString("UserAccountServices", ""); + if (name == Name) { - if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) - serviceUrl = serviceUrl + '/'; - m_serverUrl = serviceUrl; + IConfig gridConfig = source.Configs["UserAccountService"]; + if (gridConfig != null) + { + string serviceUrl = gridConfig.GetString("UserAccountServerURI"); + if (!String.IsNullOrEmpty(serviceUrl)) + { + if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) + serviceUrl = serviceUrl + '/'; + m_serverUrl = serviceUrl; + m_Enabled = true; + } + } + + if (String.IsNullOrEmpty(m_serverUrl)) + m_log.Info("[SIMIAN ACCOUNT CONNECTOR]: No UserAccountServerURI specified, disabling connector"); } } - - if (String.IsNullOrEmpty(m_serverUrl)) - m_log.Info("[SIMIAN ACCOUNT CONNECTOR]: No UserAccountServerURI specified, disabling connector"); } public UserAccount GetUserAccount(UUID scopeID, string firstName, string lastName) From 7f9f9f92460e8ba1b30901bd7a2f1c58c1c6e62c Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 5 Sep 2010 19:14:45 +0100 Subject: [PATCH 52/57] Fix a handful of copypaste errors --- .../SimianGrid/SimianAuthenticationServiceConnector.cs | 2 +- .../Connectors/SimianGrid/SimianAvatarServiceConnector.cs | 2 +- .../Connectors/SimianGrid/SimianInventoryServiceConnector.cs | 2 +- .../Connectors/SimianGrid/SimianPresenceServiceConnector.cs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs index 0ce8db8dda..68f73ee983 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs @@ -77,7 +77,7 @@ namespace OpenSim.Services.Connectors.SimianGrid IConfig moduleConfig = source.Configs["Modules"]; if (moduleConfig != null) { - string name = moduleConfig.GetString("AssetServices", ""); + string name = moduleConfig.GetString("AuthenticationServices", ""); if (name == Name) { IConfig gridConfig = source.Configs["AuthenticationService"]; diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs index 97cb9e3cf3..7e56bd19e2 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs @@ -82,7 +82,7 @@ namespace OpenSim.Services.Connectors.SimianGrid IConfig moduleConfig = source.Configs["Modules"]; if (moduleConfig != null) { - string name = moduleConfig.GetString("AssetServices", ""); + string name = moduleConfig.GetString("AvatarServices", ""); if (name == Name) { IConfig gridConfig = source.Configs["AvatarService"]; diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs index 1862842eb4..eb118ae557 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs @@ -96,7 +96,7 @@ namespace OpenSim.Services.Connectors.SimianGrid IConfig moduleConfig = source.Configs["Modules"]; if (moduleConfig != null) { - string name = moduleConfig.GetString("AssetServices", ""); + string name = moduleConfig.GetString("InventoryServices", ""); if (name == Name) { IConfig gridConfig = source.Configs["InventoryService"]; diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs index fd667ed67f..074c80f719 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs @@ -107,7 +107,7 @@ namespace OpenSim.Services.Connectors.SimianGrid IConfig moduleConfig = source.Configs["Modules"]; if (moduleConfig != null) { - string name = moduleConfig.GetString("AssetServices", ""); + string name = moduleConfig.GetString("PresenceServices", ""); if (name == Name) { IConfig gridConfig = source.Configs["PresenceService"]; From 00a23eea0ec5d3607cf9cd021a3a182da258686e Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 6 Sep 2010 03:59:48 +0200 Subject: [PATCH 53/57] Reflect the ParcelPropertiesUpdateRequest into Scene.EventManager, because modules need to see it (Search!) even if it comes in via CAPS --- .../World/Land/LandManagementModule.cs | 14 +++++++--- .../Region/Framework/Scenes/EventManager.cs | 26 ++++++++++++++++++- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 040dc8c850..f62ec1b275 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -1115,7 +1115,11 @@ namespace OpenSim.Region.CoreModules.World.Land m_landList.TryGetValue(localID, out land); } - if (land != null) land.UpdateLandProperties(args, remote_client); + if (land != null) + { + land.UpdateLandProperties(args, remote_client); + m_scene.EventManager.TriggerOnParcelPropertiesUpdateRequest(args, localID, remote_client); + } } public void ClientOnParcelDivideRequest(int west, int south, int east, int north, IClientAPI remote_client) @@ -1433,9 +1437,13 @@ namespace OpenSim.Region.CoreModules.World.Land m_landList.TryGetValue(parcelID, out land); } - if (land != null) { + if (land != null) + { land.UpdateLandProperties(land_update, client); - } else { + m_scene.EventManager.TriggerOnParcelPropertiesUpdateRequest(land_update, parcelID, client); + } + else + { m_log.WarnFormat("[LAND] unable to find parcelID {0}", parcelID); } return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty()); diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 52e6e92bb5..d4e2736522 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -113,6 +113,8 @@ namespace OpenSim.Region.Framework.Scenes public event OnSetRootAgentSceneDelegate OnSetRootAgentScene; + public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest; + /// /// Fired when an object is touched/grabbed. /// @@ -2128,5 +2130,27 @@ namespace OpenSim.Region.Framework.Scenes } } } + + public void TriggerOnParcelPropertiesUpdateRequest(LandUpdateArgs args, + int local_id, IClientAPI remote_client) + { + ParcelPropertiesUpdateRequest handler = OnParcelPropertiesUpdateRequest; + if (handler != null) + { + foreach (ParcelPropertiesUpdateRequest d in handler.GetInvocationList()) + { + try + { + d(args, local_id, remote_client); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerOnSceneObjectPartCopy failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } + } } -} \ No newline at end of file +} From f2e343d53081dbd6956d39b1e172e171101a4900 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 6 Sep 2010 14:09:46 +0200 Subject: [PATCH 54/57] Workaround for mono bug #312968 --- .../Servers/HttpServer/SynchronousRestFormsRequester.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs index 41ece86047..e481b2b9f4 100644 --- a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs +++ b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs @@ -64,6 +64,7 @@ namespace OpenSim.Framework.Servers.HttpServer if ((verb == "POST") || (verb == "PUT")) { request.ContentType = "text/www-form-urlencoded"; + request.KeepAlive = true; int length = 0; using (StreamWriter writer = new StreamWriter(buffer)) From 06adbc13242c16d40f9e9a02652067131f2eb9b7 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 6 Sep 2010 17:24:10 +0200 Subject: [PATCH 55/57] Revert "Workaround for mono bug #312968" This reverts commit f2e343d53081dbd6956d39b1e172e171101a4900. Doesn't compile with our version of Mono. Patched Mono instead. --- .../Servers/HttpServer/SynchronousRestFormsRequester.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs index e481b2b9f4..41ece86047 100644 --- a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs +++ b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs @@ -64,7 +64,6 @@ namespace OpenSim.Framework.Servers.HttpServer if ((verb == "POST") || (verb == "PUT")) { request.ContentType = "text/www-form-urlencoded"; - request.KeepAlive = true; int length = 0; using (StreamWriter writer = new StreamWriter(buffer)) From f4f9a2cb4590fe56e672242b4c5697078785e793 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 6 Sep 2010 18:14:24 +0200 Subject: [PATCH 56/57] Don't turn off the sale settings on child prims when linking, and on copy of prims anymore. The behavior now matches SL and can be used to link vendor prims for transport --- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 8 -------- 1 file changed, 8 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 8823df1eff..86842b3ab0 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -1619,11 +1619,6 @@ namespace OpenSim.Region.Framework.Scenes if (child != null) { - // Make sure no child prim is set for sale - // So that, on delink, no prims are unwittingly - // left for sale and sold off - child.RootPart.ObjectSaleType = 0; - child.RootPart.SalePrice = 10; childGroups.Add(child); } } @@ -1907,9 +1902,6 @@ namespace OpenSim.Region.Framework.Scenes child.ApplyNextOwnerPermissions(); } } - - copy.RootPart.ObjectSaleType = 0; - copy.RootPart.SalePrice = 10; } Entities.Add(copy); From 8886afd31961e1a838cb15df863ff9155885e0c6 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 6 Sep 2010 21:59:52 +0200 Subject: [PATCH 57/57] Fix yet another cause of "Ghost attachments" --- .../Avatar/Attachments/AttachmentsModule.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index bd9e621ec6..100b55cf6d 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -271,8 +271,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments if (AttachmentPt != 0 && AttachmentPt != objatt.GetAttachmentPoint()) tainted = true; - AttachObject(remoteClient, objatt, AttachmentPt, false); - //objatt.ScheduleGroupForFullUpdate(); + // This will throw if the attachment fails + try + { + AttachObject(remoteClient, objatt, AttachmentPt, false); + } + catch + { + // Make sure the object doesn't stick around and bail + m_scene.DeleteSceneObject(objatt, false); + return null; + } if (tainted) objatt.HasGroupChanged = true; @@ -616,4 +625,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments so.HasGroupChanged = false; } } -} \ No newline at end of file +}