From 0898be5750a9e5f0cfab566a34b65e4a227d82e6 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 31 Jan 2011 22:54:36 +0000 Subject: Change SimianGroupsServicesConnectorModule.GetAgentGroupMembership() so that it returns null if the user isn't a member of the group. This matches the behaviour of the same method for Flotsam Groups. This is the behaviour assumed by existing code. Method doc also added to IGroupsServicesConnector to the make the contract clear. --- .../XmlRpcGroups/IGroupsServicesConnector.cs | 19 +++++++ .../SimianGroupsServicesConnectorModule.cs | 66 +++++++++++----------- 2 files changed, 52 insertions(+), 33 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs index 5c779de..6d26075 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs @@ -63,7 +63,26 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups void SetAgentActiveGroupRole(UUID RequestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID); void SetAgentGroupInfo(UUID RequestingAgentID, UUID AgentID, UUID GroupID, bool AcceptNotices, bool ListInProfile); + /// + /// Get information about a specific group to which the user belongs. + /// + /// The agent requesting the information. + /// The agent requested. + /// The group requested. + /// + /// If the user is a member of the group then the data structure is returned. If not, then null is returned. + /// GroupMembershipData GetAgentGroupMembership(UUID RequestingAgentID, UUID AgentID, UUID GroupID); + + /// + /// Get information about the groups to which a user belongs. + /// + /// The agent requesting the information. + /// The agent requested. + /// + /// Information about the groups to which the user belongs. If the user belongs to no groups then an empty + /// list is returned. + /// List GetAgentGroupMemberships(UUID RequestingAgentID, UUID AgentID); void AddGroupNotice(UUID RequestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message, byte[] binaryBucket); diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs index 0d265f2..81725c5 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs @@ -704,7 +704,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups } } - return findings; } @@ -712,54 +711,55 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups { if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); - GroupMembershipData data = new GroupMembershipData(); - - /////////////////////////////// - // Agent Specific Information: - // - OSDMap UserActiveGroup; - if (SimianGetGenericEntry(agentID, "Group", "ActiveGroup", out UserActiveGroup)) - { - data.Active = UserActiveGroup["GroupID"].AsUUID().Equals(groupID); - } + GroupMembershipData data = null; + bool foundData = false; OSDMap UserGroupMemberInfo; if (SimianGetGenericEntry(agentID, "GroupMember", groupID.ToString(), out UserGroupMemberInfo)) { + data = new GroupMembershipData(); data.AcceptNotices = UserGroupMemberInfo["AcceptNotices"].AsBoolean(); data.Contribution = UserGroupMemberInfo["Contribution"].AsInteger(); data.ListInProfile = UserGroupMemberInfo["ListInProfile"].AsBoolean(); - data.ActiveRole = UserGroupMemberInfo["SelectedRoleID"].AsUUID(); + data.ActiveRole = UserGroupMemberInfo["SelectedRoleID"].AsUUID(); + + /////////////////////////////// + // Agent Specific Information: + // + OSDMap UserActiveGroup; + if (SimianGetGenericEntry(agentID, "Group", "ActiveGroup", out UserActiveGroup)) + { + data.Active = UserActiveGroup["GroupID"].AsUUID().Equals(groupID); + } /////////////////////////////// // Role Specific Information: // - OSDMap GroupRoleInfo; if (SimianGetGenericEntry(groupID, "GroupRole", data.ActiveRole.ToString(), out GroupRoleInfo)) { data.GroupTitle = GroupRoleInfo["Title"].AsString(); data.GroupPowers = GroupRoleInfo["Powers"].AsULong(); - } - } - - /////////////////////////////// - // Group Specific Information: - // - OSDMap GroupInfo; - string GroupName; - if (SimianGetFirstGenericEntry(groupID, "Group", out GroupName, out GroupInfo)) - { - data.GroupID = groupID; - data.AllowPublish = GroupInfo["AllowPublish"].AsBoolean(); - data.Charter = GroupInfo["Charter"].AsString(); - data.FounderID = GroupInfo["FounderID"].AsUUID(); - data.GroupName = GroupName; - data.GroupPicture = GroupInfo["InsigniaID"].AsUUID(); - data.MaturePublish = GroupInfo["MaturePublish"].AsBoolean(); - data.MembershipFee = GroupInfo["MembershipFee"].AsInteger(); - data.OpenEnrollment = GroupInfo["OpenEnrollment"].AsBoolean(); - data.ShowInList = GroupInfo["ShowInList"].AsBoolean(); + } + + /////////////////////////////// + // Group Specific Information: + // + OSDMap GroupInfo; + string GroupName; + if (SimianGetFirstGenericEntry(groupID, "Group", out GroupName, out GroupInfo)) + { + data.GroupID = groupID; + data.AllowPublish = GroupInfo["AllowPublish"].AsBoolean(); + data.Charter = GroupInfo["Charter"].AsString(); + data.FounderID = GroupInfo["FounderID"].AsUUID(); + data.GroupName = GroupName; + data.GroupPicture = GroupInfo["InsigniaID"].AsUUID(); + data.MaturePublish = GroupInfo["MaturePublish"].AsBoolean(); + data.MembershipFee = GroupInfo["MembershipFee"].AsInteger(); + data.OpenEnrollment = GroupInfo["OpenEnrollment"].AsBoolean(); + data.ShowInList = GroupInfo["ShowInList"].AsBoolean(); + } } return data; -- cgit v1.1 From 2344150b6e9dd056769f8ce565ec35243bef2538 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 2 Feb 2011 19:39:33 +0000 Subject: Stop double counting dequeued packets for packets sent number This is already being incremented in LLUDPServer.SendPacketFinal for every packet --- OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs index d4c3307..21bd99e 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs @@ -441,13 +441,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// an outgoing packet from each, obeying the throttling bucket limits /// /// + /// /// Packet queues are inspected in ascending numerical order starting from 0. Therefore, queues with a lower /// ThrottleOutPacketType number will see their packet get sent first (e.g. if both Land and Wind queues have /// packets, then the packet at the front of the Land queue will be sent before the packet at the front of the /// wind queue). /// - /// This function is only called from a synchronous loop in the - /// UDPServer so we don't need to bother making this thread safe + /// This function is only called from a synchronous loop in the + /// UDPServer so we don't need to bother making this thread safe + /// + /// /// True if any packets were sent, otherwise false public bool DequeueOutgoing() { @@ -476,7 +479,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_udpServer.SendPacketFinal(nextPacket); m_nextPackets[i] = null; packetSent = true; - this.PacketsSent++; } } else @@ -493,7 +495,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Send the packet m_udpServer.SendPacketFinal(packet); packetSent = true; - this.PacketsSent++; } else { -- cgit v1.1 From 2413e9eb3fe63307660202f913eee1c877340372 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 2 Feb 2011 20:00:50 +0000 Subject: Record number of resent packets in LindenUDP stack and display in stats report --- .../Region/ClientStack/LindenUDP/LLUDPClient.cs | 7 +++++-- .../Region/ClientStack/LindenUDP/LLUDPServer.cs | 5 ++++- .../Agent/UDP/Linden/LindenUDPInfoModule.cs | 24 ++++++++++++---------- 3 files changed, 22 insertions(+), 14 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs index 21bd99e..65a8fe3 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs @@ -122,6 +122,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP public int PacketsReceived; /// Number of packets sent to this client public int PacketsSent; + /// Number of packets resent to this client + public int PacketsResent; /// Total byte count of unacked packets sent to this client public int UnackedBytes; @@ -256,9 +258,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP public string GetStats() { return string.Format( - "{0,7} {1,7} {2,9} {3,8} {4,7} {5,7} {6,7} {7,7} {8,9} {9,7} {10,7}", + "{0,7} {1,7} {2,7} {3,9} {4,7} {5,7} {6,7} {7,7} {8,7} {9,8} {10,7} {11,7}", + PacketsReceived, PacketsSent, - PacketsReceived, + PacketsResent, UnackedBytes, m_packetOutboxes[(int)ThrottleOutPacketType.Resend].Count, m_packetOutboxes[(int)ThrottleOutPacketType.Land].Count, diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index df8ddbb..5ff9aee 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs @@ -506,7 +506,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Bump up the resend count on this packet Interlocked.Increment(ref outgoingPacket.ResendCount); - //Interlocked.Increment(ref Stats.ResentPackets); // Requeue or resend the packet if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, false)) @@ -582,6 +581,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP udpClient.NeedAcks.Add(outgoingPacket); } } + else + { + Interlocked.Increment(ref udpClient.PacketsResent); + } #endregion Sequence Number Assignment diff --git a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs index 87d067c..6630edb 100644 --- a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs +++ b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs @@ -154,24 +154,26 @@ namespace OpenSim.Region.CoreModules.UDP.Linden report.Append(GetColumnEntry("Type", maxTypeLength, columnPadding)); report.AppendFormat( - "{0,7} {1,7} {2,9} {3,8} {4,7} {5,7} {6,7} {7,7} {8,9} {9,7} {10,7}\n", + "{0,7} {1,7} {2,7} {3,9} {4,7} {5,7} {6,7} {7,7} {8,7} {9,8} {10,7} {11,7}\n", "Pkts", "Pkts", + "Pkts", "Bytes", - "Pkts", - "Pkts", - "Pkts", - "Pkts", - "Pkts", - "Pkts", - "Pkts", - "Pkts"); + "Q Pkts", + "Q Pkts", + "Q Pkts", + "Q Pkts", + "Q Pkts", + "Q Pkts", + "Q Pkts", + "Q Pkts"); report.AppendFormat("{0,-" + totalInfoFieldsLength + "}", ""); report.AppendFormat( - "{0,7} {1,7} {2,9} {3,8} {4,7} {5,7} {6,7} {7,7} {8,9} {9,7} {10,7}\n", - "Out", + "{0,7} {1,7} {2,7} {3,9} {4,7} {5,7} {6,7} {7,7} {8,7} {9,8} {10,7} {11,7}\n", "In", + "Out", + "Resent", "Unacked", "Resend", "Land", -- cgit v1.1 From 4f7cf491e6fa06a6ac4672fa81e707437f3fa537 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 2 Feb 2011 20:02:10 +0000 Subject: Comment out texture CAPS 'texture not found' message for now --- OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs b/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs index 6fb8b46..df4d561 100644 --- a/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs @@ -245,14 +245,12 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps WriteTextureData(httpRequest, httpResponse, texture, format); return true; } - } // not found - m_log.Warn("[GETTEXTURE]: Texture " + textureID + " not found"); +// m_log.Warn("[GETTEXTURE]: Texture " + textureID + " not found"); httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound; return true; - } private void WriteTextureData(OSHttpRequest request, OSHttpResponse response, AssetBase texture, string format) -- cgit v1.1 From 8fdc810a2329063d136458dff5a4c7d307db3feb Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 3 Feb 2011 04:07:36 -0800 Subject: Addresses mantis #5360: CreatorData was being written as long as it wasn't null. This made iars backwards incompatible when some items had non-null foreign creators. This patch adds an explicit option (-c) to preserve foreign creator information. --- .../CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index 1a96098..26edba4 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs @@ -128,6 +128,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver + " is the user's last name." + Environment.NewLine + " is the path inside the user's inventory for the folder/item to be saved." + Environment.NewLine + "-p|--profile= adds the url of the profile service to the saved user information." + Environment.NewLine + + "-c|--creators preserves information about foreign creators." + Environment.NewLine + "-v|--verbose extra debug messages." + Environment.NewLine + " is the filesystem path at which to save the IAR." + string.Format(" If this is not given then the filename {0} in the current directory is used", DEFAULT_INV_BACKUP_FILENAME), @@ -396,6 +397,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver //ops.Add("v|version=", delegate(string v) { options["version"] = v; }); ops.Add("p|profile=", delegate(string v) { options["profile"] = v; }); ops.Add("v|verbose", delegate(string v) { options["verbose"] = v; }); + ops.Add("c|creators", delegate(string v) { options["creators"] = v; }); List mainParams = ops.Parse(cmdparams); -- cgit v1.1 From cf24069227f9a32272c873d4423e2e11f5da25a8 Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Thu, 3 Feb 2011 12:43:46 -0800 Subject: Change UpdateAgent (for changes in agent position) to be sent once to each simulator rather than once to each region. This should help with some of the delays caused by multiple outstanding requests to a single service point. --- .../Simulation/LocalSimulationConnector.cs | 14 +++---- .../Framework/Scenes/SceneCommunicationService.cs | 43 +++++++++++----------- 2 files changed, 29 insertions(+), 28 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs index c5972dd..56720b7 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs @@ -225,17 +225,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation if (destination == null) return false; + // We limit the number of messages sent for a position change to just one per + // simulator so when we receive the update we need to hand it to each of the + // scenes; scenes each check to see if the is a scene presence for the avatar + // note that we really don't need the GridRegion for this call foreach (Scene s in m_sceneList) { - if (s.RegionInfo.RegionHandle == destination.RegionHandle) - { - //m_log.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate"); - s.IncomingChildAgentDataUpdate(cAgentData); - return true; - } + //m_log.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate"); + s.IncomingChildAgentDataUpdate(cAgentData); } //m_log.Debug("[LOCAL COMMS]: region not found for ChildAgentUpdate"); - return false; + return true; } public bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent) diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index f8ff308..837e655 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs @@ -193,7 +193,8 @@ namespace OpenSim.Region.Framework.Scenes } } - public delegate void SendChildAgentDataUpdateDelegate(AgentPosition cAgentData, UUID scopeID, ulong regionHandle); + public delegate void SendChildAgentDataUpdateDelegate(AgentPosition cAgentData, UUID scopeID, GridRegion dest); + /// /// This informs all neighboring regions about the settings of it's child agent. @@ -202,31 +203,17 @@ namespace OpenSim.Region.Framework.Scenes /// This contains information, such as, Draw Distance, Camera location, Current Position, Current throttle settings, etc. /// /// - private void SendChildAgentDataUpdateAsync(AgentPosition cAgentData, UUID scopeID, ulong regionHandle) + private void SendChildAgentDataUpdateAsync(AgentPosition cAgentData, UUID scopeID, GridRegion dest) { //m_log.Info("[INTERGRID]: Informing neighbors about my agent in " + m_regionInfo.RegionName); try { - //m_commsProvider.InterRegion.ChildAgentUpdate(regionHandle, cAgentData); - uint x = 0, y = 0; - Utils.LongToUInts(regionHandle, out x, out y); - GridRegion destination = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y); - m_scene.SimulationService.UpdateAgent(destination, cAgentData); + m_scene.SimulationService.UpdateAgent(dest, cAgentData); } catch { // Ignore; we did our best } - - //if (regionAccepted) - //{ - // //m_log.Info("[INTERGRID]: Completed sending a neighbor an update about my agent"); - //} - //else - //{ - // //m_log.Info("[INTERGRID]: Failed sending a neighbor an update about my agent"); - //} - } private void SendChildAgentDataUpdateCompleted(IAsyncResult iar) @@ -240,14 +227,28 @@ namespace OpenSim.Region.Framework.Scenes // This assumes that we know what our neighbors are. try { + uint x = 0, y = 0; + List simulatorList = new List(); foreach (ulong regionHandle in presence.KnownChildRegionHandles) { if (regionHandle != m_regionInfo.RegionHandle) { - SendChildAgentDataUpdateDelegate d = SendChildAgentDataUpdateAsync; - d.BeginInvoke(cAgentData, m_regionInfo.ScopeID, regionHandle, - SendChildAgentDataUpdateCompleted, - d); + // we only want to send one update to each simulator; the simulator will + // hand it off to the regions where a child agent exists, this does assume + // that the region position is cached or performance will degrade + Utils.LongToUInts(regionHandle, out x, out y); + GridRegion dest = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y); + if (! simulatorList.Contains(dest.ServerURI)) + { + // we havent seen this simulator before, add it to the list + // and send it an update + simulatorList.Add(dest.ServerURI); + + SendChildAgentDataUpdateDelegate d = SendChildAgentDataUpdateAsync; + d.BeginInvoke(cAgentData, m_regionInfo.ScopeID, dest, + SendChildAgentDataUpdateCompleted, + d); + } } } } -- cgit v1.1 From 1613d89383574f7bba3102376e6f3a2ee99b1270 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 4 Feb 2011 20:51:51 +0000 Subject: minor: Correct misspelling of neighbour in log messages. Thanks Fly-Man- --- .../Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 54b95f7..80a8041 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -983,7 +983,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer /// public void EnableChildAgent(ScenePresence sp, GridRegion region) { - m_log.DebugFormat("[ENTITY TRANSFER]: Enabling child agent in new neighour {0}", region.RegionName); + m_log.DebugFormat("[ENTITY TRANSFER]: Enabling child agent in new neighbour {0}", region.RegionName); AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); AgentCircuitData agent = sp.ControllingClient.RequestClientInfo(); -- cgit v1.1 From 034327b51fc496702b84b101123140b017bf68ff Mon Sep 17 00:00:00 2001 From: Kevin Cozens Date: Thu, 3 Feb 2011 12:03:17 -0500 Subject: Send object date to viewer in microseconds (Fixes mantis bug #3990) --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 4fcd8f5..6a92378 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2055,8 +2055,9 @@ namespace OpenSim.Region.Framework.Scenes public void GetProperties(IClientAPI client) { + //Viewer wants date in microseconds so multiply it by 1,000,000. client.SendObjectPropertiesReply( - m_fromUserInventoryItemID, (ulong)_creationDate, _creatorID, UUID.Zero, UUID.Zero, + m_fromUserInventoryItemID, (ulong)_creationDate*(ulong)1e6, _creatorID, UUID.Zero, UUID.Zero, _groupID, (short)InventorySerial, _lastOwnerID, UUID, _ownerID, ParentGroup.RootPart.TouchName, new byte[0], ParentGroup.RootPart.SitName, Name, Description, ParentGroup.RootPart._ownerMask, ParentGroup.RootPart._nextOwnerMask, ParentGroup.RootPart._groupMask, ParentGroup.RootPart._everyoneMask, -- cgit v1.1 From 3585130ac8b805296323105a5b50c5d416210266 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 31 Jan 2011 02:42:22 -0500 Subject: SetTexture_fix --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 30fb252..38a16a4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -1750,13 +1750,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { UUID textureID=new UUID(); - if (!UUID.TryParse(texture, out textureID)) - { - textureID=InventoryKey(texture, (int)AssetType.Texture); - } - - if (textureID == UUID.Zero) - return; + textureID=InventoryKey(texture, (int)AssetType.Texture); + if (textureID == UUID.Zero) + { + if (!UUID.TryParse(texture, out textureID)) + return; + } Primitive.TextureEntry tex = part.Shape.Textures; -- cgit v1.1 From bc2e254b55b65cf267b8027e3e696acbc0f3c60b Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 4 Feb 2011 21:55:22 +0000 Subject: minor: fix indentation, spacing on commit 3585130 this previous commit tries to look up the texture by name first before just using the uuid. this allows correct resolution of inventory textures which have uuids as names. --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 38a16a4..e8da274 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -1748,14 +1748,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api protected void SetTexture(SceneObjectPart part, string texture, int face) { - UUID textureID=new UUID(); - - textureID=InventoryKey(texture, (int)AssetType.Texture); - if (textureID == UUID.Zero) - { - if (!UUID.TryParse(texture, out textureID)) - return; - } + UUID textureID = new UUID(); + + textureID = InventoryKey(texture, (int)AssetType.Texture); + if (textureID == UUID.Zero) + { + if (!UUID.TryParse(texture, out textureID)) + return; + } Primitive.TextureEntry tex = part.Shape.Textures; -- cgit v1.1 From 722f0ba18cbea725235f1c31cf3bd3d6a66def29 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 4 Feb 2011 23:06:24 +0000 Subject: Put something in the ImprovedInstantMessage.BinaryBucket for llInstantMessage() to stop this crashing viewer 2.4.0 (1.23.5 was fine with this). We're putting in a string of format " which appears to be the expected value. This resolves http://opensimulator.org/mantis/view.php?id=5356 --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index e8da274..73fe160 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3063,12 +3063,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api msg.ParentEstateID = 0; //ParentEstateID; msg.Position = Vector3.Zero;// new Vector3(m_host.AbsolutePosition); msg.RegionID = World.RegionInfo.RegionID.Guid;//RegionID.Guid; - msg.binaryBucket = new byte[0];// binaryBucket; + msg.binaryBucket + = Util.StringToBytes256( + "{0}/{1}/{2}/{3}", + World.RegionInfo.RegionName, + (int)Math.Floor(m_host.AbsolutePosition.X), + (int)Math.Floor(m_host.AbsolutePosition.Y), + (int)Math.Floor(m_host.AbsolutePosition.Z)); if (m_TransferModule != null) { m_TransferModule.SendInstantMessage(msg, delegate(bool success) {}); } + ScriptSleep(2000); } -- cgit v1.1 From 5b7a5a5b8b6221b2fe42f645c757c2e5e9132aa6 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 4 Feb 2011 23:14:21 +0000 Subject: Add position to IM sent from llInstantMessage(), to better fulfill client expectations --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 73fe160..72ee495 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3061,7 +3061,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api msg.fromGroup = false;// fromGroup; msg.offline = (byte)0; //offline; msg.ParentEstateID = 0; //ParentEstateID; - msg.Position = Vector3.Zero;// new Vector3(m_host.AbsolutePosition); + msg.Position = new Vector3(m_host.AbsolutePosition); msg.RegionID = World.RegionInfo.RegionID.Guid;//RegionID.Guid; msg.binaryBucket = Util.StringToBytes256( -- cgit v1.1 From cdd64bb8f51df51858b841de4def7808735b02dd Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 5 Feb 2011 00:15:25 +0000 Subject: For now, reinstate the call to World.GridService.GetRegionsByName() commented out in 933f47e Even though we don't use the results, just getting the regions may have side effects in making hypergrid links available for the later World.RequestTeleportLocation() --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index c0c790d..3f8735e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -702,7 +702,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // and convert the regionName to the target region if (regionName.Contains(".") && regionName.Contains(":")) { -// List regions = World.GridService.GetRegionsByName(World.RegionInfo.ScopeID, regionName, 1); + World.GridService.GetRegionsByName(World.RegionInfo.ScopeID, regionName, 1); +// List regions = World.GridService.GetRegionsByName(World.RegionInfo.ScopeID, regionName, 1); + string[] parts = regionName.Split(new char[] { ':' }); if (parts.Length > 2) regionName = parts[0] + ':' + parts[1] + "/ " + parts[2]; -- cgit v1.1 From f5a3eb9fd547df043b00a2934d891dcfff3142ab Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 4 Feb 2011 17:05:45 -0800 Subject: Added a config var to HGInventoryAccessModule called OutboundPermission that controls whether the sim lets asset POSTs happen to foreign grids or not. It's True by default. If ppl want to allow foreign visitors but don't want to allow any assets out of their grid, they should set this to False. This is the beginning of policies for these things... --- .../Framework/InventoryAccess/HGInventoryAccessModule.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs index 34b8114..4565d10 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs @@ -55,6 +55,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess } private string m_ProfileServerURI; + private bool m_OutboundPermission; // private bool m_Initialized = false; @@ -78,7 +79,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess IConfig thisModuleConfig = source.Configs["HGInventoryAccessModule"]; if (thisModuleConfig != null) + { m_ProfileServerURI = thisModuleConfig.GetString("ProfileServerURI", string.Empty); + m_OutboundPermission = thisModuleConfig.GetBoolean("OutboundPermission", true); + } else m_log.Warn("[HG INVENTORY ACCESS MODULE]: HGInventoryAccessModule configs not found. ProfileServerURI not set!"); } @@ -103,7 +107,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess public void UploadInventoryItem(UUID avatarID, UUID assetID, string name, int userlevel) { string userAssetServer = string.Empty; - if (IsForeignUser(avatarID, out userAssetServer)) + if (IsForeignUser(avatarID, out userAssetServer) && m_OutboundPermission) { Util.FireAndForget(delegate { m_assMapper.Post(assetID, avatarID, userAssetServer); }); } @@ -197,7 +201,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess if (IsForeignUser(sender, out userAssetServer)) m_assMapper.Get(item.AssetID, sender, userAssetServer); - if (IsForeignUser(receiver, out userAssetServer)) + if (IsForeignUser(receiver, out userAssetServer) && m_OutboundPermission) m_assMapper.Post(item.AssetID, receiver, userAssetServer); } -- cgit v1.1 From 632babf8fba8180764b359b9716eaac904b1b4ac Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 4 Feb 2011 19:19:38 -0800 Subject: Added an additional debug message, and removed a bunch of files that weren't being used anymore -- the old RemotsInventory connectors stuff. --- .../Inventory/HGInventoryBroker.cs | 5 + .../Inventory/RemoteInventoryServiceConnector.cs | 362 --------------------- 2 files changed, 5 insertions(+), 362 deletions(-) delete mode 100644 OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs index 39410b5..3f63db3 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs @@ -200,6 +200,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return; } } + else + { + m_log.DebugFormat("[HG INVENTORY CONNECTOR]: User {0} does not have InventoryServerURI. OH NOES!", userID); + return; + } } } } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs deleted file mode 100644 index 9213132..0000000 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs +++ /dev/null @@ -1,362 +0,0 @@ -/* - * 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 log4net; -using System; -using System.Collections.Generic; -using System.Reflection; -using Nini.Config; -using OpenSim.Framework; -using OpenSim.Framework.Statistics; -using OpenSim.Services.Connectors; -using OpenSim.Region.Framework.Interfaces; -using OpenSim.Region.Framework.Scenes; -using OpenSim.Services.Interfaces; -using OpenMetaverse; - -namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory -{ - public class RemoteInventoryServicesConnector : BaseInventoryConnector, ISharedRegionModule, IInventoryService - { - private static readonly ILog m_log = - LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - private bool m_Enabled = false; - private bool m_Initialized = false; - private Scene m_Scene; - private InventoryServicesConnector m_RemoteConnector; - - private IUserManagement m_UserManager; - private IUserManagement UserManager - { - get - { - if (m_UserManager == null) - { - m_UserManager = m_Scene.RequestModuleInterface(); - } - return m_UserManager; - } - } - - - public Type ReplaceableInterface - { - get { return null; } - } - - public string Name - { - get { return "RemoteInventoryServicesConnector"; } - } - - public RemoteInventoryServicesConnector() - { - } - - public RemoteInventoryServicesConnector(IConfigSource source) - { - Init(source); - } - - protected override void Init(IConfigSource source) - { - m_RemoteConnector = new InventoryServicesConnector(source); - base.Init(source); - } - - #region ISharedRegionModule - - public void Initialise(IConfigSource source) - { - IConfig moduleConfig = source.Configs["Modules"]; - if (moduleConfig != null) - { - string name = moduleConfig.GetString("InventoryServices", ""); - if (name == Name) - { - Init(source); - m_Enabled = true; - - m_log.Info("[INVENTORY CONNECTOR]: Remote inventory enabled"); - } - } - } - - public void PostInitialise() - { - } - - public void Close() - { - } - - public void AddRegion(Scene scene) - { -// m_Scene = scene; - //m_log.Debug("[XXXX] Adding scene " + m_Scene.RegionInfo.RegionName); - - if (!m_Enabled) - return; - - if (!m_Initialized) - { - m_Initialized = true; - } - - scene.RegisterModuleInterface(this); - m_cache.AddRegion(scene); - - if (m_Scene == null) - m_Scene = scene; - } - - public void RemoveRegion(Scene scene) - { - if (!m_Enabled) - return; - - m_cache.RemoveRegion(scene); - } - - public void RegionLoaded(Scene scene) - { - if (!m_Enabled) - return; - - m_log.InfoFormat("[INVENTORY CONNECTOR]: Enabled remote inventory for region {0}", scene.RegionInfo.RegionName); - - } - - #endregion ISharedRegionModule - - #region IInventoryService - - public override bool CreateUserInventory(UUID user) - { - return false; - } - - public override List GetInventorySkeleton(UUID userId) - { - return new List(); - } - - public override InventoryCollection GetUserInventory(UUID userID) - { - return null; - } - - public override void GetUserInventory(UUID userID, InventoryReceiptCallback callback) - { - UUID sessionID = GetSessionID(userID); - try - { - m_RemoteConnector.GetUserInventory(userID.ToString(), sessionID, callback); - } - catch (Exception e) - { - if (StatsManager.SimExtraStats != null) - StatsManager.SimExtraStats.AddInventoryServiceRetrievalFailure(); - - m_log.ErrorFormat("[INVENTORY CONNECTOR]: Request inventory operation failed, {0} {1}", - e.Source, e.Message); - } - - } - - // inherited. See base class - // public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) - - public override Dictionary GetSystemFolders(UUID userID) - { - UUID sessionID = GetSessionID(userID); - return m_RemoteConnector.GetSystemFolders(userID.ToString(), sessionID); - } - - public override InventoryCollection GetFolderContent(UUID userID, UUID folderID) - { - UUID sessionID = GetSessionID(userID); - try - { - InventoryCollection invCol = m_RemoteConnector.GetFolderContent(userID.ToString(), folderID, sessionID); - foreach (InventoryItemBase item in invCol.Items) - UserManager.AddUser(item.CreatorIdAsUuid, item.CreatorData); - return invCol; - } - catch (Exception e) - { - m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetFolderContent operation failed, {0} {1}", - e.Source, e.Message); - } - InventoryCollection nullCollection = new InventoryCollection(); - nullCollection.Folders = new List(); - nullCollection.Items = new List(); - nullCollection.UserID = userID; - return nullCollection; - } - - public override List GetFolderItems(UUID userID, UUID folderID) - { - UUID sessionID = GetSessionID(userID); - return m_RemoteConnector.GetFolderItems(userID.ToString(), folderID, sessionID); - } - - public override bool AddFolder(InventoryFolderBase folder) - { - if (folder == null) - return false; - - UUID sessionID = GetSessionID(folder.Owner); - return m_RemoteConnector.AddFolder(folder.Owner.ToString(), folder, sessionID); - } - - public override bool UpdateFolder(InventoryFolderBase folder) - { - if (folder == null) - return false; - - UUID sessionID = GetSessionID(folder.Owner); - return m_RemoteConnector.UpdateFolder(folder.Owner.ToString(), folder, sessionID); - } - - public override bool MoveFolder(InventoryFolderBase folder) - { - if (folder == null) - return false; - - UUID sessionID = GetSessionID(folder.Owner); - return m_RemoteConnector.MoveFolder(folder.Owner.ToString(), folder, sessionID); - } - - public override bool DeleteFolders(UUID ownerID, List folderIDs) - { - if (folderIDs == null) - return false; - if (folderIDs.Count == 0) - return false; - - UUID sessionID = GetSessionID(ownerID); - return m_RemoteConnector.DeleteFolders(ownerID.ToString(), folderIDs, sessionID); - } - - - public override bool PurgeFolder(InventoryFolderBase folder) - { - if (folder == null) - return false; - - UUID sessionID = GetSessionID(folder.Owner); - return m_RemoteConnector.PurgeFolder(folder.Owner.ToString(), folder, sessionID); - } - - // public bool AddItem(InventoryItemBase item) inherited - // Uses AddItemPlain - - protected override bool AddItemPlain(InventoryItemBase item) - { - if (item == null) - return false; - - UUID sessionID = GetSessionID(item.Owner); - return m_RemoteConnector.AddItem(item.Owner.ToString(), item, sessionID); - } - - public override bool UpdateItem(InventoryItemBase item) - { - if (item == null) - return false; - - UUID sessionID = GetSessionID(item.Owner); - return m_RemoteConnector.UpdateItem(item.Owner.ToString(), item, sessionID); - } - - public override bool MoveItems(UUID ownerID, List items) - { - if (items == null) - return false; - - UUID sessionID = GetSessionID(ownerID); - return m_RemoteConnector.MoveItems(ownerID.ToString(), items, sessionID); - } - - - public override bool DeleteItems(UUID ownerID, List itemIDs) - { - if (itemIDs == null) - return false; - if (itemIDs.Count == 0) - return true; - - UUID sessionID = GetSessionID(ownerID); - return m_RemoteConnector.DeleteItems(ownerID.ToString(), itemIDs, sessionID); - } - - public override InventoryItemBase GetItem(InventoryItemBase item) - { - if (item == null) - return null; - - UUID sessionID = GetSessionID(item.Owner); - return m_RemoteConnector.QueryItem(item.Owner.ToString(), item, sessionID); - } - - public override InventoryFolderBase GetFolder(InventoryFolderBase folder) - { - if (folder == null) - return null; - - UUID sessionID = GetSessionID(folder.Owner); - return m_RemoteConnector.QueryFolder(folder.Owner.ToString(), folder, sessionID); - } - - public override bool HasInventoryForUser(UUID userID) - { - return false; - } - - public override List GetActiveGestures(UUID userId) - { - return new List(); - } - - public override int GetAssetPermissions(UUID userID, UUID assetID) - { - UUID sessionID = GetSessionID(userID); - return m_RemoteConnector.GetAssetPermissions(userID.ToString(), assetID, sessionID); - } - - - #endregion - - private UUID GetSessionID(UUID userID) - { - return UUID.Zero; - } - - } -} -- cgit v1.1 From 67555994adc6b5449a0a1c21997e7bfcf880ad02 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 5 Feb 2011 07:55:54 -0800 Subject: Amend to yesterday's deletions: forgot to delete the RemoteInventory module in th addin.xml file. --- OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml | 1 - 1 file changed, 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml index 43de2ab..a9d247a 100644 --- a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml +++ b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml @@ -47,7 +47,6 @@ - -- cgit v1.1 From b20ab1063f5717a69fb3226c44b4af5228280d35 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 5 Feb 2011 17:57:30 -0800 Subject: Added a couple of console commands to help diagnose issues: show circuits: shows the lists of agent circuit data show http-handlers: shows the currently registered http handlers --- OpenSim/Region/Application/OpenSim.cs | 50 +++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index ed4b620..bbcc588 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -294,6 +294,14 @@ namespace OpenSim "show connections", "Show connection data", HandleShow); + m_console.Commands.AddCommand("region", false, "show circuits", + "show circuits", + "Show agent circuit data", HandleShow); + + m_console.Commands.AddCommand("region", false, "show http-handlers", + "show http-handlers", + "Show all registered http handlers", HandleShow); + m_console.Commands.AddCommand("region", false, "show modules", "show modules", "Show module data", HandleShow); @@ -943,6 +951,48 @@ namespace OpenSim MainConsole.Instance.Output(connections.ToString()); break; + case "circuits": + System.Text.StringBuilder acd = new System.Text.StringBuilder("Agent Circuits:\n"); + m_sceneManager.ForEachScene( + delegate(Scene scene) + { + //this.HttpServer. + acd.AppendFormat("{0}:\n", scene.RegionInfo.RegionName); + foreach (AgentCircuitData aCircuit in scene.AuthenticateHandler.AgentCircuits.Values) + acd.AppendFormat("\t{0} {1} ({2})\n", aCircuit.firstname, aCircuit.lastname, (aCircuit.child ? "Child" : "Root")); + } + ); + + MainConsole.Instance.Output(acd.ToString()); + break; + + case "http-handlers": + System.Text.StringBuilder handlers = new System.Text.StringBuilder("Registered HTTP Handlers:\n"); + + handlers.AppendFormat("* XMLRPC:\n"); + foreach (String s in HttpServer.GetXmlRpcHandlerKeys()) + handlers.AppendFormat("\t{0}\n", s); + + handlers.AppendFormat("* HTTP:\n"); + List poll = HttpServer.GetPollServiceHandlerKeys(); + foreach (String s in HttpServer.GetHTTPHandlerKeys()) + handlers.AppendFormat("\t{0} {1}\n", s, (poll.Contains(s) ? "(poll service)" : string.Empty)); + + handlers.AppendFormat("* Agent:\n"); + foreach (String s in HttpServer.GetAgentHandlerKeys()) + handlers.AppendFormat("\t{0}\n", s); + + handlers.AppendFormat("* LLSD:\n"); + foreach (String s in HttpServer.GetLLSDHandlerKeys()) + handlers.AppendFormat("\t{0}\n", s); + + handlers.AppendFormat("* StreamHandlers ({0}):\n", HttpServer.GetStreamHandlerKeys().Count); + foreach (String s in HttpServer.GetStreamHandlerKeys()) + handlers.AppendFormat("\t{0}\n", s); + + MainConsole.Instance.Output(handlers.ToString()); + break; + case "modules": MainConsole.Instance.Output("The currently loaded shared modules are:"); foreach (IRegionModule module in m_moduleLoader.GetLoadedSharedModules) -- cgit v1.1 From 30fa5ad1e29df50de99611b43adfd577696bfdda Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 5 Feb 2011 19:21:12 -0800 Subject: One more diagnosis command: show caps --- .../Agent/Capabilities/CapabilitiesModule.cs | 28 +++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs b/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs index c023a6f..75df6cc 100644 --- a/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs +++ b/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs @@ -26,12 +26,14 @@ */ using System; +using System.Collections; using System.Collections.Generic; using System.Reflection; using log4net; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; +using OpenSim.Framework.Console; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using Caps=OpenSim.Framework.Capabilities.Caps; @@ -61,6 +63,10 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities { m_scene = scene; m_scene.RegisterModuleInterface(this); + MainConsole.Instance.Commands.AddCommand("Capabilities", false, "show caps", + "show capabilities", + "Shows all registered capabilities", CapabilitiesCommand); + m_log.Error("\n\n**************************************************************\n\n"); } public void RegionLoaded(Scene scene) @@ -72,7 +78,9 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities m_scene.UnregisterModuleInterface(this); } - public void PostInitialise() {} + public void PostInitialise() + { + } public void Close() {} @@ -226,5 +234,23 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities m_log.Info(" >> "+x+", "+y+": "+kvp.Value); } } + + private void CapabilitiesCommand(string module, string[] cmdparams) + { + System.Text.StringBuilder caps = new System.Text.StringBuilder(); + caps.AppendFormat("Region {0}:\n", m_scene.RegionInfo.RegionName); + + foreach (KeyValuePair kvp in m_capsHandlers) + { + caps.AppendFormat("** User {0}:\n", kvp.Key); + for (IDictionaryEnumerator kvp2 = kvp.Value.CapsHandlers.CapsDetails.GetEnumerator(); kvp2.MoveNext(); ) + { + Uri uri = new Uri(kvp2.Value.ToString()); + caps.AppendFormat(" {0} = {1}\n", kvp2.Key, uri.PathAndQuery); + } + } + + MainConsole.Instance.Output(caps.ToString()); + } } } -- cgit v1.1 From cc81d924cab97889538c20e9bfa45008ecfead3e Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 5 Feb 2011 19:34:02 -0800 Subject: Fixed Caps handlers leak --- OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs b/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs index 75df6cc..1d8e70e 100644 --- a/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs +++ b/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs @@ -66,7 +66,6 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities MainConsole.Instance.Commands.AddCommand("Capabilities", false, "show caps", "show capabilities", "Shows all registered capabilities", CapabilitiesCommand); - m_log.Error("\n\n**************************************************************\n\n"); } public void RegionLoaded(Scene scene) -- cgit v1.1 From 3411d4867d01d4cf87f09300f69d149c5269c611 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 5 Feb 2011 19:40:55 -0800 Subject: Honor check of m_Enabled in WorldViewModule. --- OpenSim/Region/OptionalModules/World/WorldView/WorldViewModule.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/OptionalModules/World/WorldView/WorldViewModule.cs b/OpenSim/Region/OptionalModules/World/WorldView/WorldViewModule.cs index d4b7020..cee8851 100644 --- a/OpenSim/Region/OptionalModules/World/WorldView/WorldViewModule.cs +++ b/OpenSim/Region/OptionalModules/World/WorldView/WorldViewModule.cs @@ -71,6 +71,9 @@ namespace OpenSim.Region.OptionalModules.World.WorldView public void RegionLoaded(Scene scene) { + if (!m_Enabled) + return; + m_Generator = scene.RequestModuleInterface(); if (m_Generator == null) { -- cgit v1.1 From 2c7e87c45bb0d543ba0ab9342a1bc29f92fb4fd3 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 6 Feb 2011 07:51:20 -0800 Subject: Better output for show neighbours --- .../ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs index 023a44c..3c36799 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs @@ -247,13 +247,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid public void NeighboursCommand(string module, string[] cmdparams) { + System.Text.StringBuilder caps = new System.Text.StringBuilder(); + foreach (KeyValuePair kvp in m_LocalCache) { - m_log.InfoFormat("*** Neighbours of {0} {1} ***", kvp.Key, kvp.Value.RegionName); + caps.AppendFormat("*** Neighbours of {0} ({1}) ***\n", kvp.Value.RegionName, kvp.Key); List regions = kvp.Value.GetNeighbours(); foreach (GridRegion r in regions) - m_log.InfoFormat(" {0} @ {1}={2}", r.RegionName, r.RegionLocX / Constants.RegionSize, r.RegionLocY / Constants.RegionSize); + caps.AppendFormat(" {0} @ {1}-{2}\n", r.RegionName, r.RegionLocX / Constants.RegionSize, r.RegionLocY / Constants.RegionSize); } + + MainConsole.Instance.Output(caps.ToString()); } } -- cgit v1.1 From 98ea78fc77b3dd6da185d71dfab402a0ef8780d6 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 6 Feb 2011 19:39:29 -0800 Subject: New command: show pending-objects --- OpenSim/Region/Application/OpenSim.cs | 22 ++++++++++++++++++++++ .../Region/Framework/Interfaces/ISceneViewer.cs | 1 + OpenSim/Region/Framework/Scenes/SceneViewer.cs | 8 ++++++++ 3 files changed, 31 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index bbcc588..bd1aa46 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -302,6 +302,10 @@ namespace OpenSim "show http-handlers", "Show all registered http handlers", HandleShow); + m_console.Commands.AddCommand("region", false, "show pending-objects", + "show pending-objects", + "Show # of objects on the pending queues of all scene viewers", HandleShow); + m_console.Commands.AddCommand("region", false, "show modules", "show modules", "Show module data", HandleShow); @@ -993,6 +997,24 @@ namespace OpenSim MainConsole.Instance.Output(handlers.ToString()); break; + case "pending-objects": + System.Text.StringBuilder pending = new System.Text.StringBuilder("Pending objects:\n"); + m_sceneManager.ForEachScene( + delegate(Scene scene) + { + scene.ForEachScenePresence( + delegate(ScenePresence sp) + { + pending.AppendFormat("{0}: {1} {2} pending\n", + scene.RegionInfo.RegionName, sp.Name, sp.SceneViewer.GetPendingObjectsCount()); + } + ); + } + ); + + MainConsole.Instance.Output(pending.ToString()); + break; + case "modules": MainConsole.Instance.Output("The currently loaded shared modules are:"); foreach (IRegionModule module in m_moduleLoader.GetLoadedSharedModules) diff --git a/OpenSim/Region/Framework/Interfaces/ISceneViewer.cs b/OpenSim/Region/Framework/Interfaces/ISceneViewer.cs index 7251d57..2397f22 100644 --- a/OpenSim/Region/Framework/Interfaces/ISceneViewer.cs +++ b/OpenSim/Region/Framework/Interfaces/ISceneViewer.cs @@ -36,5 +36,6 @@ namespace OpenSim.Region.Framework.Interfaces void Close(); void QueuePartForUpdate(SceneObjectPart part); void SendPrimUpdates(); + int GetPendingObjectsCount(); } } diff --git a/OpenSim/Region/Framework/Scenes/SceneViewer.cs b/OpenSim/Region/Framework/Scenes/SceneViewer.cs index b44a010..7c067ca 100644 --- a/OpenSim/Region/Framework/Scenes/SceneViewer.cs +++ b/OpenSim/Region/Framework/Scenes/SceneViewer.cs @@ -205,6 +205,14 @@ namespace OpenSim.Region.Framework.Scenes Reset(); } + public int GetPendingObjectsCount() + { + if (m_pendingObjects != null) + return m_pendingObjects.Count; + + return 0; + } + public class ScenePartUpdate { public UUID FullID; -- cgit v1.1 From ebeef02fef1a04b5b4cfe13dad588bcce7f9ba21 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 7 Feb 2011 07:45:03 -0800 Subject: Hunting down mantis #5365 Revert "refactor: remove redundant null checks" This reverts commit 6e58996b4d9db202cd7795a37bd687362effef48. --- .../LindenUDP/UnackedPacketCollection.cs | 45 ++++++++++++++-------- 1 file changed, 30 insertions(+), 15 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs b/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs index 9d40688..d762bef 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs @@ -141,31 +141,46 @@ namespace OpenSim.Region.ClientStack.LindenUDP private void ProcessQueues() { // Process all the pending adds + OutgoingPacket pendingAdd; - while (m_pendingAdds.TryDequeue(out pendingAdd)) - m_packets[pendingAdd.SequenceNumber] = pendingAdd; + if (m_pendingAdds != null) + { + while (m_pendingAdds.TryDequeue(out pendingAdd)) + { + if (pendingAdd != null && m_packets != null) + { + m_packets[pendingAdd.SequenceNumber] = pendingAdd; + } + } + } // Process all the pending removes, including updating statistics and round-trip times PendingAck pendingRemove; OutgoingPacket ackedPacket; - while (m_pendingRemoves.TryDequeue(out pendingRemove)) + if (m_pendingRemoves != null) { - if (m_packets.TryGetValue(pendingRemove.SequenceNumber, out ackedPacket)) + while (m_pendingRemoves.TryDequeue(out pendingRemove)) { - m_packets.Remove(pendingRemove.SequenceNumber); - - // Update stats - Interlocked.Add(ref ackedPacket.Client.UnackedBytes, -ackedPacket.Buffer.DataLength); - - if (!pendingRemove.FromResend) + if (m_pendingRemoves != null && m_packets != null) { - // Calculate the round-trip time for this packet and its ACK - int rtt = pendingRemove.RemoveTime - ackedPacket.TickCount; - if (rtt > 0) - ackedPacket.Client.UpdateRoundTrip(rtt); + if (m_packets.TryGetValue(pendingRemove.SequenceNumber, out ackedPacket)) + { + m_packets.Remove(pendingRemove.SequenceNumber); + + // Update stats + Interlocked.Add(ref ackedPacket.Client.UnackedBytes, -ackedPacket.Buffer.DataLength); + + if (!pendingRemove.FromResend) + { + // Calculate the round-trip time for this packet and its ACK + int rtt = pendingRemove.RemoveTime - ackedPacket.TickCount; + if (rtt > 0) + ackedPacket.Client.UpdateRoundTrip(rtt); + } + } } } } } } -} \ No newline at end of file +} -- cgit v1.1 From d934add0213400f03bc4dc2d24e1b0ccee965101 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 7 Feb 2011 14:49:18 -0800 Subject: Thanks Tokeiito for noticing this bug. mantis #5366 --- .../Authorization/RemoteAuthorizationServiceConnector.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs index 01a2615..66994fa 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs @@ -139,7 +139,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization if (scene != null) { - UserAccount account = scene.UserAccountService.GetUserAccount(UUID.Zero, userID); + UserAccount account = scene.UserAccountService.GetUserAccount(UUID.Zero, new UUID(userID)); isAuthorized = IsAuthorizedForRegion(userID, account.FirstName, account.LastName, account.Email, scene.RegionInfo.RegionName, regionID, out message); } -- cgit v1.1 From d627122cdcbff1888b7334a524ed652731ba3766 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 7 Feb 2011 19:44:55 -0800 Subject: Mantis #5368 -- exception on WorldMap --- OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index e0f36a2..1094970 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -764,10 +764,11 @@ namespace OpenSim.Region.CoreModules.World.WorldMap if (!responseMap.ContainsKey(itemtype.ToString())) // remote sim doesnt have the stated region handle { - if (!m_blacklistedregions.ContainsKey(regionhandle)) + m_log.DebugFormat("[WORLD MAP]: Remote sim does not have the stated region. Blacklisting."); + lock (m_blacklistedregions) { - m_log.DebugFormat("[WORLD MAP]: Remote sim does not have the stated region. Blacklisting."); - m_blacklistedregions.Add(regionhandle, Environment.TickCount); + if (!m_blacklistedregions.ContainsKey(regionhandle)) + m_blacklistedregions.Add(regionhandle, Environment.TickCount); } } -- cgit v1.1 From ac7bc78555c1dd51724790032f0711b24bc8c67d Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 8 Feb 2011 12:06:14 -0800 Subject: Added emergency monitoring of UDP Outgoing packets thread. Just type "emergency-monitoring on/off" --- .../Region/ClientStack/LindenUDP/LLUDPServer.cs | 100 +++++++++++++++++++++ OpenSim/Region/Framework/Scenes/Scene.cs | 2 + .../Agent/UDP/Linden/LindenUDPInfoModule.cs | 30 ++++++- 3 files changed, 130 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index 5ff9aee..72257d2 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs @@ -27,6 +27,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.IO; using System.Net; using System.Net.Sockets; @@ -1053,6 +1054,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP #endregion Update Timers + if (m_scene.EmergencyMonitoring) + clientPacketHandler = MonitoredClientOutgoingPacketHandler; + // Handle outgoing packets, resends, acknowledgements, and pings for each // client. m_packetSent will be set to true if a packet is sent m_scene.ForEachClient(clientPacketHandler); @@ -1068,6 +1072,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { m_log.Error("[LLUDPSERVER]: OutgoingPacketHandler loop threw an exception: " + ex.Message, ex); } + } Watchdog.RemoveThread(); @@ -1105,6 +1110,101 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } + #region Emergency Monitoring + private Stopwatch watch1 = new Stopwatch(); + private Stopwatch watch2 = new Stopwatch(); + + private float avgProcessingTicks = 0; + private float avgResendUnackedTicks = 0; + private float avgSendAcksTicks = 0; + private float avgSendPingTicks = 0; + private float avgDequeueTicks = 0; + private long nticks = 0; + private long nticksUnack = 0; + private long nticksAck = 0; + private long nticksPing = 0; + + private void MonitoredClientOutgoingPacketHandler(IClientAPI client) + { + nticks++; + watch1.Start(); + try + { + if (client is LLClientView) + { + LLUDPClient udpClient = ((LLClientView)client).UDPClient; + + if (udpClient.IsConnected) + { + if (m_resendUnacked) + { + nticksUnack++; + watch2.Start(); + + ResendUnacked(udpClient); + + watch2.Stop(); + avgResendUnackedTicks = (nticksUnack - 1)/(float)nticksUnack * avgResendUnackedTicks + (watch2.ElapsedTicks / (float)nticksUnack); + watch2.Reset(); + } + + if (m_sendAcks) + { + nticksAck++; + watch2.Start(); + + SendAcks(udpClient); + + watch2.Stop(); + avgSendAcksTicks = (nticksAck - 1) / (float)nticksAck * avgSendAcksTicks + (watch2.ElapsedTicks / (float)nticksAck); + watch2.Reset(); + } + + if (m_sendPing) + { + nticksPing++; + watch2.Start(); + + SendPing(udpClient); + + watch2.Stop(); + avgSendPingTicks = (nticksPing - 1) / (float)nticksPing * avgSendPingTicks + (watch2.ElapsedTicks / (float)nticksPing); + watch2.Reset(); + } + + watch2.Start(); + // Dequeue any outgoing packets that are within the throttle limits + if (udpClient.DequeueOutgoing()) + m_packetSent = true; + watch2.Stop(); + avgDequeueTicks = (nticks - 1) / (float)nticks * avgDequeueTicks + (watch2.ElapsedTicks / (float)nticks); + watch2.Reset(); + + } + else + m_log.WarnFormat("[LLUDPSERVER]: Client is not connected"); + } + } + catch (Exception ex) + { + m_log.Error("[LLUDPSERVER]: OutgoingPacketHandler iteration for " + client.Name + + " threw an exception: " + ex.Message, ex); + } + watch1.Stop(); + avgProcessingTicks = (nticks - 1) / (float)nticks * avgProcessingTicks + (watch1.ElapsedTicks / (float)nticks); + watch1.Reset(); + + // reuse this -- it's every 100ms + if (m_scene.EmergencyMonitoring && nticks % 100 == 0) + { + m_log.InfoFormat("[LLUDPSERVER]: avg processing ticks: {0} avg unacked: {1} avg acks: {2} avg ping: {3} avg dequeue: {4} (pack sent? {5})", + avgProcessingTicks, avgResendUnackedTicks, avgSendAcksTicks, avgSendPingTicks, avgDequeueTicks, m_packetSent); + } + + } + + #endregion + private void ProcessInPacket(object state) { IncomingPacket incomingPacket = (IncomingPacket)state; diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 4fca261..355671c 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -64,6 +64,8 @@ namespace OpenSim.Region.Framework.Scenes #region Fields + public bool EmergencyMonitoring = false; + public SynchronizeSceneHandler SynchronizeScene; public SimStatsReporter StatsReporter; public List NorthBorders = new List(); diff --git a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs index 6630edb..53cebb2 100644 --- a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs +++ b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs @@ -95,7 +95,15 @@ namespace OpenSim.Region.CoreModules.UDP.Linden "Show throttle settings for each client and for the server overall", "Without the 'full' option, only root agents are shown." + " With the 'full' option child agents are also shown.", - ShowThrottlesReport); + ShowThrottlesReport); + + scene.AddCommand( + this, "emergency-monitoring", + "Go on/off emergency monitoring mode", + "Go on/off emergency monitoring mode", + "Go on/off emergency monitoring mode", + EmergencyMonitoring); + } public void RemoveRegion(Scene scene) @@ -120,7 +128,25 @@ namespace OpenSim.Region.CoreModules.UDP.Linden { MainConsole.Instance.Output(GetThrottlesReport(cmd)); } - + + protected void EmergencyMonitoring(string module, string[] cmd) + { + bool mode = true; + if (cmd.Length == 1 || (cmd.Length > 1 && cmd[1] == "on")) + { + mode = true; + MainConsole.Instance.Output("Emergency Monitoring ON"); + } + else + { + mode = false; + MainConsole.Instance.Output("Emergency Monitoring OFF"); + } + + foreach (Scene s in m_scenes.Values) + s.EmergencyMonitoring = mode; + } + protected string GetColumnEntry(string entry, int maxLength, int columnPadding) { return string.Format( -- cgit v1.1 From 82846afe4b2a141421bff136dec9eef553522aa7 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 8 Feb 2011 12:37:37 -0800 Subject: Minor improvement to previous commit. --- OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index 72257d2..703ef6a 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs @@ -1056,6 +1056,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (m_scene.EmergencyMonitoring) clientPacketHandler = MonitoredClientOutgoingPacketHandler; + else + clientPacketHandler = ClientOutgoingPacketHandler; // Handle outgoing packets, resends, acknowledgements, and pings for each // client. m_packetSent will be set to true if a packet is sent @@ -1197,8 +1199,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP // reuse this -- it's every 100ms if (m_scene.EmergencyMonitoring && nticks % 100 == 0) { - m_log.InfoFormat("[LLUDPSERVER]: avg processing ticks: {0} avg unacked: {1} avg acks: {2} avg ping: {3} avg dequeue: {4} (pack sent? {5})", - avgProcessingTicks, avgResendUnackedTicks, avgSendAcksTicks, avgSendPingTicks, avgDequeueTicks, m_packetSent); + m_log.InfoFormat("[LLUDPSERVER]: avg processing ticks: {0} avg unacked: {1} avg acks: {2} avg ping: {3} avg dequeue: {4} (TickCountRes: {5})", + avgProcessingTicks, avgResendUnackedTicks, avgSendAcksTicks, avgSendPingTicks, avgDequeueTicks, TickCountResolution); } } -- cgit v1.1 From f431bd20ec18222a69fe1371b6145cf7415fdf9f Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 8 Feb 2011 14:49:50 -0800 Subject: Minor addition to the previous commit --- OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index 703ef6a..bfbe959 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs @@ -1125,6 +1125,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP private long nticksUnack = 0; private long nticksAck = 0; private long nticksPing = 0; + private int npacksSent = 0; + private int npackNotSent = 0; private void MonitoredClientOutgoingPacketHandler(IClientAPI client) { @@ -1177,7 +1179,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP watch2.Start(); // Dequeue any outgoing packets that are within the throttle limits if (udpClient.DequeueOutgoing()) + { m_packetSent = true; + npacksSent++; + } + else + npackNotSent++; + watch2.Stop(); avgDequeueTicks = (nticks - 1) / (float)nticks * avgDequeueTicks + (watch2.ElapsedTicks / (float)nticks); watch2.Reset(); @@ -1196,11 +1204,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP avgProcessingTicks = (nticks - 1) / (float)nticks * avgProcessingTicks + (watch1.ElapsedTicks / (float)nticks); watch1.Reset(); - // reuse this -- it's every 100ms + // reuse this -- it's every ~100ms if (m_scene.EmergencyMonitoring && nticks % 100 == 0) { - m_log.InfoFormat("[LLUDPSERVER]: avg processing ticks: {0} avg unacked: {1} avg acks: {2} avg ping: {3} avg dequeue: {4} (TickCountRes: {5})", - avgProcessingTicks, avgResendUnackedTicks, avgSendAcksTicks, avgSendPingTicks, avgDequeueTicks, TickCountResolution); + m_log.InfoFormat("[LLUDPSERVER]: avg processing ticks: {0} avg unacked: {1} avg acks: {2} avg ping: {3} avg dequeue: {4} (TickCountRes: {5} sent: {6} notsent: {7})", + avgProcessingTicks, avgResendUnackedTicks, avgSendAcksTicks, avgSendPingTicks, avgDequeueTicks, TickCountResolution, npacksSent, npackNotSent); + npackNotSent = npacksSent = 0; } } -- cgit v1.1 From 117462cba18fd0f9610d854760b92362b3beea7c Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 8 Feb 2011 17:53:01 -0800 Subject: Avoid potential race conditions on UseCircuitCode. I artificially made the race condition happen, and got very similar results to those described in mantis #5365 -- no prims/avie sent back. --- .../Region/ClientStack/LindenUDP/LLUDPServer.cs | 51 ++++++++++++---------- 1 file changed, 28 insertions(+), 23 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index bfbe959..04fec95 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs @@ -640,10 +640,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { object[] array = new object[] { buffer, packet }; - if (m_asyncPacketHandling) - Util.FireAndForget(HandleUseCircuitCode, array); - else - HandleUseCircuitCode(array); + Util.FireAndForget(HandleUseCircuitCode, array); return; } @@ -857,11 +854,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP IPEndPoint remoteEndPoint = (IPEndPoint)buffer.RemoteEndPoint; + // Acknowledge the UseCircuitCode packet immediately, even before processing further + // This is so that the client doesn't send another one + SendAckImmediate(remoteEndPoint, packet.Header.Sequence); + // Begin the process of adding the client to the simulator AddNewClient((UseCircuitCodePacket)packet, remoteEndPoint); - - // Acknowledge the UseCircuitCode packet - SendAckImmediate(remoteEndPoint, packet.Header.Sequence); // m_log.DebugFormat( // "[LLUDPSERVER]: Handling UseCircuitCode request from {0} took {1}ms", @@ -927,25 +925,32 @@ namespace OpenSim.Region.ClientStack.LindenUDP protected virtual void AddClient(uint circuitCode, UUID agentID, UUID sessionID, IPEndPoint remoteEndPoint, AuthenticateResponse sessionInfo) { - // Create the LLUDPClient - LLUDPClient udpClient = new LLUDPClient(this, ThrottleRates, m_throttle, circuitCode, agentID, remoteEndPoint, m_defaultRTO, m_maxRTO); - IClientAPI existingClient; - - if (!m_scene.TryGetClient(agentID, out existingClient)) + // In priciple there shouldn't be more than one thread here, ever. + // But in case that happens, we need to synchronize this piece of code + // because it's too important + lock (this) { - // Create the LLClientView - LLClientView client = new LLClientView(remoteEndPoint, m_scene, this, udpClient, sessionInfo, agentID, sessionID, circuitCode); - client.OnLogout += LogoutHandler; + IClientAPI existingClient; - client.DisableFacelights = m_disableFacelights; + if (!m_scene.TryGetClient(agentID, out existingClient)) + { + // Create the LLUDPClient + LLUDPClient udpClient = new LLUDPClient(this, ThrottleRates, m_throttle, circuitCode, agentID, remoteEndPoint, m_defaultRTO, m_maxRTO); + // Create the LLClientView + LLClientView client = new LLClientView(remoteEndPoint, m_scene, this, udpClient, sessionInfo, agentID, sessionID, circuitCode); + client.OnLogout += LogoutHandler; - // Start the IClientAPI - client.Start(); - } - else - { - m_log.WarnFormat("[LLUDPSERVER]: Ignoring a repeated UseCircuitCode from {0} at {1} for circuit {2}", - udpClient.AgentID, remoteEndPoint, circuitCode); + client.DisableFacelights = m_disableFacelights; + + // Start the IClientAPI + client.Start(); + + } + else + { + m_log.WarnFormat("[LLUDPSERVER]: Ignoring a repeated UseCircuitCode from {0} at {1} for circuit {2}", + existingClient.AgentId, remoteEndPoint, circuitCode); + } } } -- cgit v1.1 From 585473aade100c3ffeef27e0c8e6b6c8c09d0109 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 8 Feb 2011 20:12:33 -0800 Subject: Brute-force debug -- mantis #5365 --- OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs | 18 +++++++++++++++--- OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | 5 +++++ 2 files changed, 20 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs index 65a8fe3..2d58b94 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs @@ -463,12 +463,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP bool packetSent = false; ThrottleOutPacketTypeFlags emptyCategories = 0; - //string queueDebugOutput = String.Empty; // Serious debug business + string queueDebugOutput = String.Empty; // Serious debug business for (int i = 0; i < THROTTLE_CATEGORY_COUNT; i++) { bucket = m_throttleCategories[i]; - //queueDebugOutput += m_packetOutboxes[i].Count + " "; // Serious debug business + if (i == 4) + queueDebugOutput += m_packetOutboxes[i].Count + " "; // Serious debug business if (m_nextPackets[i] != null) { @@ -476,13 +477,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP // leaving a dequeued packet still waiting to be sent out. Try to // send it again OutgoingPacket nextPacket = m_nextPackets[i]; + if (i == 4) queueDebugOutput += "m_nextPackets[i] != null, " + nextPacket.Buffer.DataLength; if (bucket.RemoveTokens(nextPacket.Buffer.DataLength)) { + if (i == 4) queueDebugOutput += " removed tokens "; // Send the packet m_udpServer.SendPacketFinal(nextPacket); m_nextPackets[i] = null; packetSent = true; } + else + if (i == 4) queueDebugOutput += " did not remove tokens "; } else { @@ -491,6 +496,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP queue = m_packetOutboxes[i]; if (queue.Dequeue(out packet)) { + if (i == 4) queueDebugOutput += "m_nextPackets[i] == null, dq ok " + packet.Buffer.DataLength; // A packet was pulled off the queue. See if we have // enough tokens in the bucket to send it out if (bucket.RemoveTokens(packet.Buffer.DataLength)) @@ -498,11 +504,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Send the packet m_udpServer.SendPacketFinal(packet); packetSent = true; + if (i == 4) queueDebugOutput += " removed tokens "; } else { // Save the dequeued packet for the next iteration m_nextPackets[i] = packet; + if (i == 4) queueDebugOutput += " did not remove tokens "; } // If the queue is empty after this dequeue, fire the queue @@ -513,17 +521,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP } else { + if (i == 4) queueDebugOutput += "m_nextPackets[i] == null, dq nok "; // No packets in this queue. Fire the queue empty callback // if it has not been called recently emptyCategories |= CategoryToFlag(i); } } + } if (emptyCategories != 0) BeginFireQueueEmpty(emptyCategories); - //m_log.Info("[LLUDPCLIENT]: Queues: " + queueDebugOutput); // Serious debug business + if (m_udpServer.EmergencyMonitoring) + m_log.Info("[LLUDPCLIENT]: Queues: " + queueDebugOutput); // Serious debug business + return packetSent; } diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index 04fec95..922e2bc 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs @@ -1133,6 +1133,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP private int npacksSent = 0; private int npackNotSent = 0; + public bool EmergencyMonitoring + { + get { return m_scene.EmergencyMonitoring; } + } + private void MonitoredClientOutgoingPacketHandler(IClientAPI client) { nticks++; -- cgit v1.1 From ba202ea9b08b1205de343c65fd209b6cca4cb6bc Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 8 Feb 2011 21:09:10 -0800 Subject: Don't build strings unless we're in emergency debugging. --- OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs index 2d58b94..20f0410 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs @@ -468,7 +468,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP for (int i = 0; i < THROTTLE_CATEGORY_COUNT; i++) { bucket = m_throttleCategories[i]; - if (i == 4) + if (m_udpServer.EmergencyMonitoring && i == 4) queueDebugOutput += m_packetOutboxes[i].Count + " "; // Serious debug business if (m_nextPackets[i] != null) @@ -477,17 +477,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP // leaving a dequeued packet still waiting to be sent out. Try to // send it again OutgoingPacket nextPacket = m_nextPackets[i]; - if (i == 4) queueDebugOutput += "m_nextPackets[i] != null, " + nextPacket.Buffer.DataLength; + if (m_udpServer.EmergencyMonitoring && i == 4) queueDebugOutput += "m_nextPackets[i] != null, " + nextPacket.Buffer.DataLength; if (bucket.RemoveTokens(nextPacket.Buffer.DataLength)) { - if (i == 4) queueDebugOutput += " removed tokens "; + if (m_udpServer.EmergencyMonitoring && i == 4) queueDebugOutput += " removed tokens "; // Send the packet m_udpServer.SendPacketFinal(nextPacket); m_nextPackets[i] = null; packetSent = true; } else - if (i == 4) queueDebugOutput += " did not remove tokens "; + if (m_udpServer.EmergencyMonitoring && i == 4) queueDebugOutput += " did not remove tokens "; } else { @@ -496,7 +496,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP queue = m_packetOutboxes[i]; if (queue.Dequeue(out packet)) { - if (i == 4) queueDebugOutput += "m_nextPackets[i] == null, dq ok " + packet.Buffer.DataLength; + if (m_udpServer.EmergencyMonitoring && i == 4) queueDebugOutput += "m_nextPackets[i] == null, dq ok " + packet.Buffer.DataLength; // A packet was pulled off the queue. See if we have // enough tokens in the bucket to send it out if (bucket.RemoveTokens(packet.Buffer.DataLength)) @@ -504,13 +504,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Send the packet m_udpServer.SendPacketFinal(packet); packetSent = true; - if (i == 4) queueDebugOutput += " removed tokens "; + if (m_udpServer.EmergencyMonitoring && i == 4) queueDebugOutput += " removed tokens "; } else { // Save the dequeued packet for the next iteration m_nextPackets[i] = packet; - if (i == 4) queueDebugOutput += " did not remove tokens "; + if (m_udpServer.EmergencyMonitoring && i == 4) queueDebugOutput += " did not remove tokens "; } // If the queue is empty after this dequeue, fire the queue @@ -521,7 +521,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } else { - if (i == 4) queueDebugOutput += "m_nextPackets[i] == null, dq nok "; + if (m_udpServer.EmergencyMonitoring && i == 4) queueDebugOutput += "m_nextPackets[i] == null, dq nok "; // No packets in this queue. Fire the queue empty callback // if it has not been called recently emptyCategories |= CategoryToFlag(i); -- cgit v1.1 From 473fac4dc71858139bd44c1e9ce4fd03d9d1bd91 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 9 Feb 2011 08:06:20 -0800 Subject: Detect negative dripAmounts in TokenBuckets. These negatives result from overflown integer operations. Also added Total to the scene throttles in show throttles. --- OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs | 3 +++ OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs b/OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs index bdbd284..dd52683 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs @@ -207,6 +207,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP int dripAmount = deltaMS * tokensPerMS; + if (dripAmount < 0) + Console.WriteLine("MAY DAY MAY DAY! Drip amount is " + dripAmount + ". This should not happen"); + content = Math.Min(content + dripAmount, maxBurst); lastDrip = now; diff --git a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs index 53cebb2..dfeecb1 100644 --- a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs +++ b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs @@ -361,7 +361,7 @@ namespace OpenSim.Region.CoreModules.UDP.Linden ThrottleRates throttleRates = udpServer.ThrottleRates; report.AppendFormat( "{0,7} {1,8} {2,7} {3,7} {4,7} {5,7} {6,9} {7,7}", - "n/a", + (throttleRates.Total * 8) / 1000, (throttleRates.ResendLimit * 8) / 1000, (throttleRates.LandLimit * 8) / 1000, (throttleRates.WindLimit * 8) / 1000, -- cgit v1.1 From 477a869fb2cc615430d78cbad6a5a0eedf6b9bf8 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 9 Feb 2011 08:08:57 -0800 Subject: More detection of negatives. --- OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs b/OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs index dd52683..de8b521 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs @@ -213,6 +213,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP content = Math.Min(content + dripAmount, maxBurst); lastDrip = now; + if (content < 0) + Console.WriteLine("MAY DAY MAY DAY! Content is " + content + ". This should not happen"); + return true; } } -- cgit v1.1 From 1bba9c6300db10c78f606bf0c21be17004dde704 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 9 Feb 2011 08:35:21 -0800 Subject: Revert "Don't build strings unless we're in emergency debugging." This reverts commit ba202ea9b08b1205de343c65fd209b6cca4cb6bc. --- OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs index 20f0410..2d58b94 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs @@ -468,7 +468,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP for (int i = 0; i < THROTTLE_CATEGORY_COUNT; i++) { bucket = m_throttleCategories[i]; - if (m_udpServer.EmergencyMonitoring && i == 4) + if (i == 4) queueDebugOutput += m_packetOutboxes[i].Count + " "; // Serious debug business if (m_nextPackets[i] != null) @@ -477,17 +477,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP // leaving a dequeued packet still waiting to be sent out. Try to // send it again OutgoingPacket nextPacket = m_nextPackets[i]; - if (m_udpServer.EmergencyMonitoring && i == 4) queueDebugOutput += "m_nextPackets[i] != null, " + nextPacket.Buffer.DataLength; + if (i == 4) queueDebugOutput += "m_nextPackets[i] != null, " + nextPacket.Buffer.DataLength; if (bucket.RemoveTokens(nextPacket.Buffer.DataLength)) { - if (m_udpServer.EmergencyMonitoring && i == 4) queueDebugOutput += " removed tokens "; + if (i == 4) queueDebugOutput += " removed tokens "; // Send the packet m_udpServer.SendPacketFinal(nextPacket); m_nextPackets[i] = null; packetSent = true; } else - if (m_udpServer.EmergencyMonitoring && i == 4) queueDebugOutput += " did not remove tokens "; + if (i == 4) queueDebugOutput += " did not remove tokens "; } else { @@ -496,7 +496,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP queue = m_packetOutboxes[i]; if (queue.Dequeue(out packet)) { - if (m_udpServer.EmergencyMonitoring && i == 4) queueDebugOutput += "m_nextPackets[i] == null, dq ok " + packet.Buffer.DataLength; + if (i == 4) queueDebugOutput += "m_nextPackets[i] == null, dq ok " + packet.Buffer.DataLength; // A packet was pulled off the queue. See if we have // enough tokens in the bucket to send it out if (bucket.RemoveTokens(packet.Buffer.DataLength)) @@ -504,13 +504,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Send the packet m_udpServer.SendPacketFinal(packet); packetSent = true; - if (m_udpServer.EmergencyMonitoring && i == 4) queueDebugOutput += " removed tokens "; + if (i == 4) queueDebugOutput += " removed tokens "; } else { // Save the dequeued packet for the next iteration m_nextPackets[i] = packet; - if (m_udpServer.EmergencyMonitoring && i == 4) queueDebugOutput += " did not remove tokens "; + if (i == 4) queueDebugOutput += " did not remove tokens "; } // If the queue is empty after this dequeue, fire the queue @@ -521,7 +521,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } else { - if (m_udpServer.EmergencyMonitoring && i == 4) queueDebugOutput += "m_nextPackets[i] == null, dq nok "; + if (i == 4) queueDebugOutput += "m_nextPackets[i] == null, dq nok "; // No packets in this queue. Fire the queue empty callback // if it has not been called recently emptyCategories |= CategoryToFlag(i); -- cgit v1.1 From 830fee145d8e8fabc32365ee6f04732d4c85b1e3 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 9 Feb 2011 08:35:36 -0800 Subject: Revert "Brute-force debug -- mantis #5365" This reverts commit 585473aade100c3ffeef27e0c8e6b6c8c09d0109. --- OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs | 18 +++--------------- OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | 5 ----- 2 files changed, 3 insertions(+), 20 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs index 2d58b94..65a8fe3 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs @@ -463,13 +463,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP bool packetSent = false; ThrottleOutPacketTypeFlags emptyCategories = 0; - string queueDebugOutput = String.Empty; // Serious debug business + //string queueDebugOutput = String.Empty; // Serious debug business for (int i = 0; i < THROTTLE_CATEGORY_COUNT; i++) { bucket = m_throttleCategories[i]; - if (i == 4) - queueDebugOutput += m_packetOutboxes[i].Count + " "; // Serious debug business + //queueDebugOutput += m_packetOutboxes[i].Count + " "; // Serious debug business if (m_nextPackets[i] != null) { @@ -477,17 +476,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP // leaving a dequeued packet still waiting to be sent out. Try to // send it again OutgoingPacket nextPacket = m_nextPackets[i]; - if (i == 4) queueDebugOutput += "m_nextPackets[i] != null, " + nextPacket.Buffer.DataLength; if (bucket.RemoveTokens(nextPacket.Buffer.DataLength)) { - if (i == 4) queueDebugOutput += " removed tokens "; // Send the packet m_udpServer.SendPacketFinal(nextPacket); m_nextPackets[i] = null; packetSent = true; } - else - if (i == 4) queueDebugOutput += " did not remove tokens "; } else { @@ -496,7 +491,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP queue = m_packetOutboxes[i]; if (queue.Dequeue(out packet)) { - if (i == 4) queueDebugOutput += "m_nextPackets[i] == null, dq ok " + packet.Buffer.DataLength; // A packet was pulled off the queue. See if we have // enough tokens in the bucket to send it out if (bucket.RemoveTokens(packet.Buffer.DataLength)) @@ -504,13 +498,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Send the packet m_udpServer.SendPacketFinal(packet); packetSent = true; - if (i == 4) queueDebugOutput += " removed tokens "; } else { // Save the dequeued packet for the next iteration m_nextPackets[i] = packet; - if (i == 4) queueDebugOutput += " did not remove tokens "; } // If the queue is empty after this dequeue, fire the queue @@ -521,21 +513,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP } else { - if (i == 4) queueDebugOutput += "m_nextPackets[i] == null, dq nok "; // No packets in this queue. Fire the queue empty callback // if it has not been called recently emptyCategories |= CategoryToFlag(i); } } - } if (emptyCategories != 0) BeginFireQueueEmpty(emptyCategories); - if (m_udpServer.EmergencyMonitoring) - m_log.Info("[LLUDPCLIENT]: Queues: " + queueDebugOutput); // Serious debug business - + //m_log.Info("[LLUDPCLIENT]: Queues: " + queueDebugOutput); // Serious debug business return packetSent; } diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index 922e2bc..04fec95 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs @@ -1133,11 +1133,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP private int npacksSent = 0; private int npackNotSent = 0; - public bool EmergencyMonitoring - { - get { return m_scene.EmergencyMonitoring; } - } - private void MonitoredClientOutgoingPacketHandler(IClientAPI client) { nticks++; -- cgit v1.1 From 1cd951e5aedad4be809fc2674e57e34d0972b67c Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 9 Feb 2011 09:39:53 -0800 Subject: Fix the negative number problem in TokenBucket. mantis #5365 --- OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs b/OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs index de8b521..0a8331f 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs @@ -207,14 +207,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP int dripAmount = deltaMS * tokensPerMS; - if (dripAmount < 0) - Console.WriteLine("MAY DAY MAY DAY! Drip amount is " + dripAmount + ". This should not happen"); - content = Math.Min(content + dripAmount, maxBurst); lastDrip = now; - if (content < 0) - Console.WriteLine("MAY DAY MAY DAY! Content is " + content + ". This should not happen"); + if (dripAmount < 0 || content < 0) + // sim has been idle for too long, integer has overflown + // previous calculation is meaningless, let's put it at correct max + content = maxBurst; return true; } -- cgit v1.1 From f33e51e2ffd475ccdbc69429b4b4d707e88cc050 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 9 Feb 2011 09:50:26 -0800 Subject: Comment instrumentation out. Not needed anymore. Left in comments, in case it is needed again. Mantis #5365 --- OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index 04fec95..207d213 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs @@ -1059,10 +1059,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP #endregion Update Timers - if (m_scene.EmergencyMonitoring) - clientPacketHandler = MonitoredClientOutgoingPacketHandler; - else - clientPacketHandler = ClientOutgoingPacketHandler; + // Use this for emergency monitoring -- bug hunting + //if (m_scene.EmergencyMonitoring) + // clientPacketHandler = MonitoredClientOutgoingPacketHandler; + //else + // clientPacketHandler = ClientOutgoingPacketHandler; // Handle outgoing packets, resends, acknowledgements, and pings for each // client. m_packetSent will be set to true if a packet is sent @@ -1118,6 +1119,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP } #region Emergency Monitoring + // Alternative packet handler fuull of instrumentation + // Handy for hunting bugs private Stopwatch watch1 = new Stopwatch(); private Stopwatch watch2 = new Stopwatch(); -- cgit v1.1 From 21715396fa0d87bd4936bd37151487346794806d Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 9 Feb 2011 17:45:19 -0800 Subject: Put the Ack of UseCircuitCode back to where it used to be. Some ppl are reporting login issues. --- OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index 207d213..584c577 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs @@ -854,14 +854,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP IPEndPoint remoteEndPoint = (IPEndPoint)buffer.RemoteEndPoint; - // Acknowledge the UseCircuitCode packet immediately, even before processing further - // This is so that the client doesn't send another one - SendAckImmediate(remoteEndPoint, packet.Header.Sequence); - // Begin the process of adding the client to the simulator AddNewClient((UseCircuitCodePacket)packet, remoteEndPoint); - -// m_log.DebugFormat( + + // Send ack + SendAckImmediate(remoteEndPoint, packet.Header.Sequence); + + // m_log.DebugFormat( // "[LLUDPSERVER]: Handling UseCircuitCode request from {0} took {1}ms", // buffer.RemoteEndPoint, (DateTime.Now - startTime).Milliseconds); } -- cgit v1.1 From 89bb5c0941625542ce3fe364cf91a2e2fa60cbcf Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 10 Feb 2011 06:09:04 -0800 Subject: Revert "Hunting down mantis #5365" This reverts commit ebeef02fef1a04b5b4cfe13dad588bcce7f9ba21. --- .../LindenUDP/UnackedPacketCollection.cs | 45 ++++++++-------------- 1 file changed, 15 insertions(+), 30 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs b/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs index d762bef..9d40688 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs @@ -141,46 +141,31 @@ namespace OpenSim.Region.ClientStack.LindenUDP private void ProcessQueues() { // Process all the pending adds - OutgoingPacket pendingAdd; - if (m_pendingAdds != null) - { - while (m_pendingAdds.TryDequeue(out pendingAdd)) - { - if (pendingAdd != null && m_packets != null) - { - m_packets[pendingAdd.SequenceNumber] = pendingAdd; - } - } - } + while (m_pendingAdds.TryDequeue(out pendingAdd)) + m_packets[pendingAdd.SequenceNumber] = pendingAdd; // Process all the pending removes, including updating statistics and round-trip times PendingAck pendingRemove; OutgoingPacket ackedPacket; - if (m_pendingRemoves != null) + while (m_pendingRemoves.TryDequeue(out pendingRemove)) { - while (m_pendingRemoves.TryDequeue(out pendingRemove)) + if (m_packets.TryGetValue(pendingRemove.SequenceNumber, out ackedPacket)) { - if (m_pendingRemoves != null && m_packets != null) + m_packets.Remove(pendingRemove.SequenceNumber); + + // Update stats + Interlocked.Add(ref ackedPacket.Client.UnackedBytes, -ackedPacket.Buffer.DataLength); + + if (!pendingRemove.FromResend) { - if (m_packets.TryGetValue(pendingRemove.SequenceNumber, out ackedPacket)) - { - m_packets.Remove(pendingRemove.SequenceNumber); - - // Update stats - Interlocked.Add(ref ackedPacket.Client.UnackedBytes, -ackedPacket.Buffer.DataLength); - - if (!pendingRemove.FromResend) - { - // Calculate the round-trip time for this packet and its ACK - int rtt = pendingRemove.RemoveTime - ackedPacket.TickCount; - if (rtt > 0) - ackedPacket.Client.UpdateRoundTrip(rtt); - } - } + // Calculate the round-trip time for this packet and its ACK + int rtt = pendingRemove.RemoveTime - ackedPacket.TickCount; + if (rtt > 0) + ackedPacket.Client.UpdateRoundTrip(rtt); } } } } } -} +} \ No newline at end of file -- cgit v1.1 From 45382e6f828395cbbcc1324d366c4f3e0eff7ad7 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 10 Feb 2011 06:26:26 -0800 Subject: Reinstated a couple of null checks related to the previous revert. --- .../LindenUDP/UnackedPacketCollection.cs | 26 +++++++++++++--------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs b/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs index 9d40688..d195110 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs @@ -143,7 +143,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Process all the pending adds OutgoingPacket pendingAdd; while (m_pendingAdds.TryDequeue(out pendingAdd)) - m_packets[pendingAdd.SequenceNumber] = pendingAdd; + if (pendingAdd != null) + m_packets[pendingAdd.SequenceNumber] = pendingAdd; // Process all the pending removes, including updating statistics and round-trip times PendingAck pendingRemove; @@ -152,17 +153,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP { if (m_packets.TryGetValue(pendingRemove.SequenceNumber, out ackedPacket)) { - m_packets.Remove(pendingRemove.SequenceNumber); - - // Update stats - Interlocked.Add(ref ackedPacket.Client.UnackedBytes, -ackedPacket.Buffer.DataLength); - - if (!pendingRemove.FromResend) + if (ackedPacket != null) { - // Calculate the round-trip time for this packet and its ACK - int rtt = pendingRemove.RemoveTime - ackedPacket.TickCount; - if (rtt > 0) - ackedPacket.Client.UpdateRoundTrip(rtt); + m_packets.Remove(pendingRemove.SequenceNumber); + + // Update stats + Interlocked.Add(ref ackedPacket.Client.UnackedBytes, -ackedPacket.Buffer.DataLength); + + if (!pendingRemove.FromResend) + { + // Calculate the round-trip time for this packet and its ACK + int rtt = pendingRemove.RemoveTime - ackedPacket.TickCount; + if (rtt > 0) + ackedPacket.Client.UpdateRoundTrip(rtt); + } } } } -- cgit v1.1 From 8fd58aa00c092da188a67573d4aa87c363f44eff Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 11 Feb 2011 22:09:46 +0000 Subject: add estate name to show regions console command --- OpenSim/Region/Application/OpenSim.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index bd1aa46..4081888 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -1030,11 +1030,12 @@ namespace OpenSim delegate(Scene scene) { MainConsole.Instance.Output(String.Format( - "Region Name: {0}, Region XLoc: {1}, Region YLoc: {2}, Region Port: {3}", + "Region Name: {0}, Region XLoc: {1}, Region YLoc: {2}, Region Port: {3}, Estate Name: {4}", scene.RegionInfo.RegionName, scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY, - scene.RegionInfo.InternalEndPoint.Port)); + scene.RegionInfo.InternalEndPoint.Port, + scene.RegionInfo.EstateSettings.EstateName)); }); break; -- cgit v1.1 From 26727ee044f0be22abf070c7d320bce2da2c0d9a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 11 Feb 2011 23:32:38 +0000 Subject: refactor: split out estate management commands into separate class --- .../World/Estate/EstateManagementCommands.cs | 156 ++++++ .../World/Estate/EstateManagementModule.cs | 584 +++++++++------------ 2 files changed, 400 insertions(+), 340 deletions(-) create mode 100644 OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs new file mode 100644 index 0000000..14f5b1e --- /dev/null +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs @@ -0,0 +1,156 @@ +/* + * 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 System; +using System.Collections.Generic; +using System.IO; +using System.Reflection; +using System.Security; +using log4net; +using Nini.Config; +using OpenMetaverse; +using OpenSim.Framework; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.Framework.Scenes; + +namespace OpenSim.Region.CoreModules.World.Estate +{ + public class EstateManagementCommands + { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + protected EstateManagementModule m_module; + + public EstateManagementCommands(EstateManagementModule module) + { + m_module = module; + } + + public void Initialise() + { + m_module.Scene.AddCommand(this, "set terrain texture", + "set terrain texture [] []", + "Sets the terrain to , if or are specified, it will only " + + "set it on regions with a matching coordinate. Specify -1 in or to wildcard" + + " that coordinate.", + consoleSetTerrainTexture); + + m_module.Scene.AddCommand(this, "set terrain heights", + "set terrain heights [] []", + "Sets the terrain texture heights on corner # to /, if or are specified, it will only " + + "set it on regions with a matching coordinate. Specify -1 in or to wildcard" + + " that coordinate. Corner # SW = 0, NW = 1, SE = 2, NE = 3.", + consoleSetTerrainHeights); + } + + protected void consoleSetTerrainTexture(string module, string[] args) + { + string num = args[3]; + string uuid = args[4]; + int x = (args.Length > 5 ? int.Parse(args[5]) : -1); + int y = (args.Length > 6 ? int.Parse(args[6]) : -1); + + if (x == -1 || m_module.Scene.RegionInfo.RegionLocX == x) + { + if (y == -1 || m_module.Scene.RegionInfo.RegionLocY == y) + { + int corner = int.Parse(num); + UUID texture = UUID.Parse(uuid); + + m_log.Debug("[ESTATEMODULE]: Setting terrain textures for " + m_module.Scene.RegionInfo.RegionName + + string.Format(" (C#{0} = {1})", corner, texture)); + + switch (corner) + { + case 0: + m_module.Scene.RegionInfo.RegionSettings.TerrainTexture1 = texture; + break; + case 1: + m_module.Scene.RegionInfo.RegionSettings.TerrainTexture2 = texture; + break; + case 2: + m_module.Scene.RegionInfo.RegionSettings.TerrainTexture3 = texture; + break; + case 3: + m_module.Scene.RegionInfo.RegionSettings.TerrainTexture4 = texture; + break; + } + + m_module.Scene.RegionInfo.RegionSettings.Save(); + m_module.TriggerRegionInfoChange(); + m_module.sendRegionInfoPacketToAll(); + } + } + } + + protected void consoleSetTerrainHeights(string module, string[] args) + { + string num = args[3]; + string min = args[4]; + string max = args[5]; + int x = (args.Length > 6 ? int.Parse(args[6]) : -1); + int y = (args.Length > 7 ? int.Parse(args[7]) : -1); + + if (x == -1 || m_module.Scene.RegionInfo.RegionLocX == x) + { + if (y == -1 || m_module.Scene.RegionInfo.RegionLocY == y) + { + int corner = int.Parse(num); + float lowValue = float.Parse(min, Culture.NumberFormatInfo); + float highValue = float.Parse(max, Culture.NumberFormatInfo); + + m_log.Debug("[ESTATEMODULE]: Setting terrain heights " + m_module.Scene.RegionInfo.RegionName + + string.Format(" (C{0}, {1}-{2}", corner, lowValue, highValue)); + + switch (corner) + { + case 0: + m_module.Scene.RegionInfo.RegionSettings.Elevation1SW = lowValue; + m_module.Scene.RegionInfo.RegionSettings.Elevation2SW = highValue; + break; + case 1: + m_module.Scene.RegionInfo.RegionSettings.Elevation1NW = lowValue; + m_module.Scene.RegionInfo.RegionSettings.Elevation2NW = highValue; + break; + case 2: + m_module.Scene.RegionInfo.RegionSettings.Elevation1SE = lowValue; + m_module.Scene.RegionInfo.RegionSettings.Elevation2SE = highValue; + break; + case 3: + m_module.Scene.RegionInfo.RegionSettings.Elevation1NE = lowValue; + m_module.Scene.RegionInfo.RegionSettings.Elevation2NE = highValue; + break; + } + + m_module.Scene.RegionInfo.RegionSettings.Save(); + m_module.TriggerRegionInfoChange(); + m_module.sendRegionHandshakeToAll(); + } + } + } + } +} \ No newline at end of file diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 01f04d9..54d3c61 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -24,6 +24,7 @@ * (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 System; using System.Collections.Generic; using System.IO; @@ -44,7 +45,9 @@ namespace OpenSim.Region.CoreModules.World.Estate private delegate void LookupUUIDS(List uuidLst); - private Scene m_scene; + public Scene Scene { get; private set; } + + protected EstateManagementCommands m_commands; private EstateTerrainXferHandler TerrainUploader; @@ -58,89 +61,89 @@ namespace OpenSim.Region.CoreModules.World.Estate { uint sun = 0; - if (!m_scene.RegionInfo.EstateSettings.UseGlobalTime) - sun=(uint)(m_scene.RegionInfo.EstateSettings.SunPosition*1024.0) + 0x1800; + if (!Scene.RegionInfo.EstateSettings.UseGlobalTime) + sun = (uint)(Scene.RegionInfo.EstateSettings.SunPosition * 1024.0) + 0x1800; UUID estateOwner; - estateOwner = m_scene.RegionInfo.EstateSettings.EstateOwner; + estateOwner = Scene.RegionInfo.EstateSettings.EstateOwner; - if (m_scene.Permissions.IsGod(remote_client.AgentId)) + if (Scene.Permissions.IsGod(remote_client.AgentId)) estateOwner = remote_client.AgentId; remote_client.SendDetailedEstateData(invoice, - m_scene.RegionInfo.EstateSettings.EstateName, - m_scene.RegionInfo.EstateSettings.EstateID, - m_scene.RegionInfo.EstateSettings.ParentEstateID, + Scene.RegionInfo.EstateSettings.EstateName, + Scene.RegionInfo.EstateSettings.EstateID, + Scene.RegionInfo.EstateSettings.ParentEstateID, GetEstateFlags(), sun, - m_scene.RegionInfo.RegionSettings.Covenant, - m_scene.RegionInfo.EstateSettings.AbuseEmail, + Scene.RegionInfo.RegionSettings.Covenant, + Scene.RegionInfo.EstateSettings.AbuseEmail, estateOwner); remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.EstateManagers, - m_scene.RegionInfo.EstateSettings.EstateManagers, - m_scene.RegionInfo.EstateSettings.EstateID); + Scene.RegionInfo.EstateSettings.EstateManagers, + Scene.RegionInfo.EstateSettings.EstateID); remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AccessOptions, - m_scene.RegionInfo.EstateSettings.EstateAccess, - m_scene.RegionInfo.EstateSettings.EstateID); + Scene.RegionInfo.EstateSettings.EstateAccess, + Scene.RegionInfo.EstateSettings.EstateID); remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, - m_scene.RegionInfo.EstateSettings.EstateGroups, - m_scene.RegionInfo.EstateSettings.EstateID); + Scene.RegionInfo.EstateSettings.EstateGroups, + Scene.RegionInfo.EstateSettings.EstateID); remote_client.SendBannedUserList(invoice, - m_scene.RegionInfo.EstateSettings.EstateBans, - m_scene.RegionInfo.EstateSettings.EstateID); + Scene.RegionInfo.EstateSettings.EstateBans, + Scene.RegionInfo.EstateSettings.EstateID); } private void estateSetRegionInfoHandler(bool blockTerraform, bool noFly, bool allowDamage, bool blockLandResell, int maxAgents, float objectBonusFactor, int matureLevel, bool restrictPushObject, bool allowParcelChanges) { if (blockTerraform) - m_scene.RegionInfo.RegionSettings.BlockTerraform = true; + Scene.RegionInfo.RegionSettings.BlockTerraform = true; else - m_scene.RegionInfo.RegionSettings.BlockTerraform = false; + Scene.RegionInfo.RegionSettings.BlockTerraform = false; if (noFly) - m_scene.RegionInfo.RegionSettings.BlockFly = true; + Scene.RegionInfo.RegionSettings.BlockFly = true; else - m_scene.RegionInfo.RegionSettings.BlockFly = false; + Scene.RegionInfo.RegionSettings.BlockFly = false; if (allowDamage) - m_scene.RegionInfo.RegionSettings.AllowDamage = true; + Scene.RegionInfo.RegionSettings.AllowDamage = true; else - m_scene.RegionInfo.RegionSettings.AllowDamage = false; + Scene.RegionInfo.RegionSettings.AllowDamage = false; if (blockLandResell) - m_scene.RegionInfo.RegionSettings.AllowLandResell = false; + Scene.RegionInfo.RegionSettings.AllowLandResell = false; else - m_scene.RegionInfo.RegionSettings.AllowLandResell = true; + Scene.RegionInfo.RegionSettings.AllowLandResell = true; - m_scene.RegionInfo.RegionSettings.AgentLimit = (byte) maxAgents; + Scene.RegionInfo.RegionSettings.AgentLimit = (byte) maxAgents; - m_scene.RegionInfo.RegionSettings.ObjectBonus = objectBonusFactor; + Scene.RegionInfo.RegionSettings.ObjectBonus = objectBonusFactor; if (matureLevel <= 13) - m_scene.RegionInfo.RegionSettings.Maturity = 0; + Scene.RegionInfo.RegionSettings.Maturity = 0; else if (matureLevel <= 21) - m_scene.RegionInfo.RegionSettings.Maturity = 1; + Scene.RegionInfo.RegionSettings.Maturity = 1; else - m_scene.RegionInfo.RegionSettings.Maturity = 2; + Scene.RegionInfo.RegionSettings.Maturity = 2; if (restrictPushObject) - m_scene.RegionInfo.RegionSettings.RestrictPushing = true; + Scene.RegionInfo.RegionSettings.RestrictPushing = true; else - m_scene.RegionInfo.RegionSettings.RestrictPushing = false; + Scene.RegionInfo.RegionSettings.RestrictPushing = false; if (allowParcelChanges) - m_scene.RegionInfo.RegionSettings.AllowLandJoinDivide = true; + Scene.RegionInfo.RegionSettings.AllowLandJoinDivide = true; else - m_scene.RegionInfo.RegionSettings.AllowLandJoinDivide = false; + Scene.RegionInfo.RegionSettings.AllowLandJoinDivide = false; - m_scene.RegionInfo.RegionSettings.Save(); + Scene.RegionInfo.RegionSettings.Save(); TriggerRegionInfoChange(); sendRegionInfoPacketToAll(); @@ -154,19 +157,19 @@ namespace OpenSim.Region.CoreModules.World.Estate switch (corner) { case 0: - m_scene.RegionInfo.RegionSettings.TerrainTexture1 = texture; + Scene.RegionInfo.RegionSettings.TerrainTexture1 = texture; break; case 1: - m_scene.RegionInfo.RegionSettings.TerrainTexture2 = texture; + Scene.RegionInfo.RegionSettings.TerrainTexture2 = texture; break; case 2: - m_scene.RegionInfo.RegionSettings.TerrainTexture3 = texture; + Scene.RegionInfo.RegionSettings.TerrainTexture3 = texture; break; case 3: - m_scene.RegionInfo.RegionSettings.TerrainTexture4 = texture; + Scene.RegionInfo.RegionSettings.TerrainTexture4 = texture; break; } - m_scene.RegionInfo.RegionSettings.Save(); + Scene.RegionInfo.RegionSettings.Save(); TriggerRegionInfoChange(); sendRegionInfoPacketToAll(); } @@ -176,23 +179,23 @@ namespace OpenSim.Region.CoreModules.World.Estate switch (corner) { case 0: - m_scene.RegionInfo.RegionSettings.Elevation1SW = lowValue; - m_scene.RegionInfo.RegionSettings.Elevation2SW = highValue; + Scene.RegionInfo.RegionSettings.Elevation1SW = lowValue; + Scene.RegionInfo.RegionSettings.Elevation2SW = highValue; break; case 1: - m_scene.RegionInfo.RegionSettings.Elevation1NW = lowValue; - m_scene.RegionInfo.RegionSettings.Elevation2NW = highValue; + Scene.RegionInfo.RegionSettings.Elevation1NW = lowValue; + Scene.RegionInfo.RegionSettings.Elevation2NW = highValue; break; case 2: - m_scene.RegionInfo.RegionSettings.Elevation1SE = lowValue; - m_scene.RegionInfo.RegionSettings.Elevation2SE = highValue; + Scene.RegionInfo.RegionSettings.Elevation1SE = lowValue; + Scene.RegionInfo.RegionSettings.Elevation2SE = highValue; break; case 3: - m_scene.RegionInfo.RegionSettings.Elevation1NE = lowValue; - m_scene.RegionInfo.RegionSettings.Elevation2NE = highValue; + Scene.RegionInfo.RegionSettings.Elevation1NE = lowValue; + Scene.RegionInfo.RegionSettings.Elevation2NE = highValue; break; } - m_scene.RegionInfo.RegionSettings.Save(); + Scene.RegionInfo.RegionSettings.Save(); TriggerRegionInfoChange(); sendRegionInfoPacketToAll(); } @@ -208,30 +211,30 @@ namespace OpenSim.Region.CoreModules.World.Estate bool UseGlobal, bool EstateFixedSun, float EstateSunHour) { // Water Height - m_scene.RegionInfo.RegionSettings.WaterHeight = WaterHeight; + Scene.RegionInfo.RegionSettings.WaterHeight = WaterHeight; // Terraforming limits - m_scene.RegionInfo.RegionSettings.TerrainRaiseLimit = TerrainRaiseLimit; - m_scene.RegionInfo.RegionSettings.TerrainLowerLimit = TerrainLowerLimit; + Scene.RegionInfo.RegionSettings.TerrainRaiseLimit = TerrainRaiseLimit; + Scene.RegionInfo.RegionSettings.TerrainLowerLimit = TerrainLowerLimit; // Time of day / fixed sun - m_scene.RegionInfo.RegionSettings.UseEstateSun = UseEstateSun; - m_scene.RegionInfo.RegionSettings.FixedSun = UseFixedSun; - m_scene.RegionInfo.RegionSettings.SunPosition = SunHour; + Scene.RegionInfo.RegionSettings.UseEstateSun = UseEstateSun; + Scene.RegionInfo.RegionSettings.FixedSun = UseFixedSun; + Scene.RegionInfo.RegionSettings.SunPosition = SunHour; - m_scene.TriggerEstateSunUpdate(); + Scene.TriggerEstateSunUpdate(); //m_log.Debug("[ESTATE]: UFS: " + UseFixedSun.ToString()); //m_log.Debug("[ESTATE]: SunHour: " + SunHour.ToString()); sendRegionInfoPacketToAll(); - m_scene.RegionInfo.RegionSettings.Save(); + Scene.RegionInfo.RegionSettings.Save(); TriggerRegionInfoChange(); } private void handleEstateRestartSimRequest(IClientAPI remoteClient, int timeInSeconds) { - IRestartModule restartModule = m_scene.RequestModuleInterface(); + IRestartModule restartModule = Scene.RequestModuleInterface(); if (restartModule != null) { List times = new List(); @@ -252,8 +255,8 @@ namespace OpenSim.Region.CoreModules.World.Estate private void handleChangeEstateCovenantRequest(IClientAPI remoteClient, UUID estateCovenantID) { - m_scene.RegionInfo.RegionSettings.Covenant = estateCovenantID; - m_scene.RegionInfo.RegionSettings.Save(); + Scene.RegionInfo.RegionSettings.Covenant = estateCovenantID; + Scene.RegionInfo.RegionSettings.Save(); TriggerRegionInfoChange(); } @@ -261,17 +264,17 @@ namespace OpenSim.Region.CoreModules.World.Estate { // EstateAccessDelta handles Estate Managers, Sim Access, Sim Banlist, allowed Groups.. etc. - if (user == m_scene.RegionInfo.EstateSettings.EstateOwner) + if (user == Scene.RegionInfo.EstateSettings.EstateOwner) return; // never process EO if ((estateAccessType & 4) != 0) // User add { - if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) + if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) { - m_scene.RegionInfo.EstateSettings.AddEstateUser(user); - m_scene.RegionInfo.EstateSettings.Save(); + Scene.RegionInfo.EstateSettings.AddEstateUser(user); + Scene.RegionInfo.EstateSettings.Save(); TriggerEstateInfoChange(); - remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AccessOptions, m_scene.RegionInfo.EstateSettings.EstateAccess, m_scene.RegionInfo.EstateSettings.EstateID); + remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AccessOptions, Scene.RegionInfo.EstateSettings.EstateAccess, Scene.RegionInfo.EstateSettings.EstateID); } else { @@ -281,13 +284,13 @@ namespace OpenSim.Region.CoreModules.World.Estate } if ((estateAccessType & 8) != 0) // User remove { - if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) + if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) { - m_scene.RegionInfo.EstateSettings.RemoveEstateUser(user); - m_scene.RegionInfo.EstateSettings.Save(); + Scene.RegionInfo.EstateSettings.RemoveEstateUser(user); + Scene.RegionInfo.EstateSettings.Save(); TriggerEstateInfoChange(); - remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AccessOptions, m_scene.RegionInfo.EstateSettings.EstateAccess, m_scene.RegionInfo.EstateSettings.EstateID); + remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AccessOptions, Scene.RegionInfo.EstateSettings.EstateAccess, Scene.RegionInfo.EstateSettings.EstateID); } else { @@ -296,12 +299,12 @@ namespace OpenSim.Region.CoreModules.World.Estate } if ((estateAccessType & 16) != 0) // Group add { - if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) + if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) { - m_scene.RegionInfo.EstateSettings.AddEstateGroup(user); - m_scene.RegionInfo.EstateSettings.Save(); + Scene.RegionInfo.EstateSettings.AddEstateGroup(user); + Scene.RegionInfo.EstateSettings.Save(); TriggerEstateInfoChange(); - remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, m_scene.RegionInfo.EstateSettings.EstateGroups, m_scene.RegionInfo.EstateSettings.EstateID); + remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, Scene.RegionInfo.EstateSettings.EstateGroups, Scene.RegionInfo.EstateSettings.EstateID); } else { @@ -310,13 +313,13 @@ namespace OpenSim.Region.CoreModules.World.Estate } if ((estateAccessType & 32) != 0) // Group remove { - if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) + if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) { - m_scene.RegionInfo.EstateSettings.RemoveEstateGroup(user); - m_scene.RegionInfo.EstateSettings.Save(); + Scene.RegionInfo.EstateSettings.RemoveEstateGroup(user); + Scene.RegionInfo.EstateSettings.Save(); TriggerEstateInfoChange(); - remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, m_scene.RegionInfo.EstateSettings.EstateGroups, m_scene.RegionInfo.EstateSettings.EstateID); + remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, Scene.RegionInfo.EstateSettings.EstateGroups, Scene.RegionInfo.EstateSettings.EstateID); } else { @@ -325,9 +328,9 @@ namespace OpenSim.Region.CoreModules.World.Estate } if ((estateAccessType & 64) != 0) // Ban add { - if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || m_scene.Permissions.BypassPermissions()) + if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || Scene.Permissions.BypassPermissions()) { - EstateBan[] banlistcheck = m_scene.RegionInfo.EstateSettings.EstateBans; + EstateBan[] banlistcheck = Scene.RegionInfo.EstateSettings.EstateBans; bool alreadyInList = false; @@ -346,20 +349,20 @@ namespace OpenSim.Region.CoreModules.World.Estate EstateBan item = new EstateBan(); item.BannedUserID = user; - item.EstateID = m_scene.RegionInfo.EstateSettings.EstateID; + item.EstateID = Scene.RegionInfo.EstateSettings.EstateID; item.BannedHostAddress = "0.0.0.0"; item.BannedHostIPMask = "0.0.0.0"; - m_scene.RegionInfo.EstateSettings.AddBan(item); - m_scene.RegionInfo.EstateSettings.Save(); + Scene.RegionInfo.EstateSettings.AddBan(item); + Scene.RegionInfo.EstateSettings.Save(); TriggerEstateInfoChange(); - ScenePresence s = m_scene.GetScenePresence(user); + ScenePresence s = Scene.GetScenePresence(user); if (s != null) { if (!s.IsChildAgent) { - m_scene.TeleportClientHome(user, s.ControllingClient); + Scene.TeleportClientHome(user, s.ControllingClient); } } @@ -369,7 +372,7 @@ namespace OpenSim.Region.CoreModules.World.Estate remote_client.SendAlertMessage("User is already on the region ban list"); } //m_scene.RegionInfo.regionBanlist.Add(Manager(user); - remote_client.SendBannedUserList(invoice, m_scene.RegionInfo.EstateSettings.EstateBans, m_scene.RegionInfo.EstateSettings.EstateID); + remote_client.SendBannedUserList(invoice, Scene.RegionInfo.EstateSettings.EstateBans, Scene.RegionInfo.EstateSettings.EstateID); } else { @@ -378,9 +381,9 @@ namespace OpenSim.Region.CoreModules.World.Estate } if ((estateAccessType & 128) != 0) // Ban remove { - if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || m_scene.Permissions.BypassPermissions()) + if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || Scene.Permissions.BypassPermissions()) { - EstateBan[] banlistcheck = m_scene.RegionInfo.EstateSettings.EstateBans; + EstateBan[] banlistcheck = Scene.RegionInfo.EstateSettings.EstateBans; bool alreadyInList = false; EstateBan listitem = null; @@ -393,20 +396,21 @@ namespace OpenSim.Region.CoreModules.World.Estate listitem = banlistcheck[i]; break; } - } + if (alreadyInList && listitem != null) { - m_scene.RegionInfo.EstateSettings.RemoveBan(listitem.BannedUserID); - m_scene.RegionInfo.EstateSettings.Save(); + Scene.RegionInfo.EstateSettings.RemoveBan(listitem.BannedUserID); + Scene.RegionInfo.EstateSettings.Save(); TriggerEstateInfoChange(); } else { remote_client.SendAlertMessage("User is not on the region ban list"); } + //m_scene.RegionInfo.regionBanlist.Add(Manager(user); - remote_client.SendBannedUserList(invoice, m_scene.RegionInfo.EstateSettings.EstateBans, m_scene.RegionInfo.EstateSettings.EstateID); + remote_client.SendBannedUserList(invoice, Scene.RegionInfo.EstateSettings.EstateBans, Scene.RegionInfo.EstateSettings.EstateID); } else { @@ -415,12 +419,12 @@ namespace OpenSim.Region.CoreModules.World.Estate } if ((estateAccessType & 256) != 0) // Manager add { - if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) + if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) { - m_scene.RegionInfo.EstateSettings.AddEstateManager(user); - m_scene.RegionInfo.EstateSettings.Save(); + Scene.RegionInfo.EstateSettings.AddEstateManager(user); + Scene.RegionInfo.EstateSettings.Save(); TriggerEstateInfoChange(); - remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateID); + remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.EstateManagers, Scene.RegionInfo.EstateSettings.EstateManagers, Scene.RegionInfo.EstateSettings.EstateID); } else { @@ -429,13 +433,13 @@ namespace OpenSim.Region.CoreModules.World.Estate } if ((estateAccessType & 512) != 0) // Manager remove { - if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) + if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) { - m_scene.RegionInfo.EstateSettings.RemoveEstateManager(user); - m_scene.RegionInfo.EstateSettings.Save(); + Scene.RegionInfo.EstateSettings.RemoveEstateManager(user); + Scene.RegionInfo.EstateSettings.Save(); TriggerEstateInfoChange(); - remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateID); + remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.EstateManagers, Scene.RegionInfo.EstateSettings.EstateManagers, Scene.RegionInfo.EstateSettings.EstateID); } else { @@ -447,7 +451,7 @@ namespace OpenSim.Region.CoreModules.World.Estate private void SendSimulatorBlueBoxMessage( IClientAPI remote_client, UUID invoice, UUID senderID, UUID sessionID, string senderName, string message) { - IDialogModule dm = m_scene.RequestModuleInterface(); + IDialogModule dm = Scene.RequestModuleInterface(); if (dm != null) dm.SendNotificationToUsersInRegion(senderID, senderName, message); @@ -462,61 +466,62 @@ namespace OpenSim.Region.CoreModules.World.Estate private void handleEstateDebugRegionRequest(IClientAPI remote_client, UUID invoice, UUID senderID, bool scripted, bool collisionEvents, bool physics) { if (physics) - m_scene.RegionInfo.RegionSettings.DisablePhysics = true; + Scene.RegionInfo.RegionSettings.DisablePhysics = true; else - m_scene.RegionInfo.RegionSettings.DisablePhysics = false; + Scene.RegionInfo.RegionSettings.DisablePhysics = false; if (scripted) - m_scene.RegionInfo.RegionSettings.DisableScripts = true; + Scene.RegionInfo.RegionSettings.DisableScripts = true; else - m_scene.RegionInfo.RegionSettings.DisableScripts = false; + Scene.RegionInfo.RegionSettings.DisableScripts = false; if (collisionEvents) - m_scene.RegionInfo.RegionSettings.DisableCollisions = true; + Scene.RegionInfo.RegionSettings.DisableCollisions = true; else - m_scene.RegionInfo.RegionSettings.DisableCollisions = false; + Scene.RegionInfo.RegionSettings.DisableCollisions = false; - m_scene.RegionInfo.RegionSettings.Save(); + Scene.RegionInfo.RegionSettings.Save(); TriggerRegionInfoChange(); - m_scene.SetSceneCoreDebug(scripted, collisionEvents, physics); + Scene.SetSceneCoreDebug(scripted, collisionEvents, physics); } private void handleEstateTeleportOneUserHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID, UUID prey) { - if (!m_scene.Permissions.CanIssueEstateCommand(remover_client.AgentId, false)) + if (!Scene.Permissions.CanIssueEstateCommand(remover_client.AgentId, false)) return; if (prey != UUID.Zero) { - ScenePresence s = m_scene.GetScenePresence(prey); + ScenePresence s = Scene.GetScenePresence(prey); if (s != null) { - m_scene.TeleportClientHome(prey, s.ControllingClient); + Scene.TeleportClientHome(prey, s.ControllingClient); } } } private void handleEstateTeleportAllUsersHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID) { - if (!m_scene.Permissions.CanIssueEstateCommand(remover_client.AgentId, false)) + if (!Scene.Permissions.CanIssueEstateCommand(remover_client.AgentId, false)) return; - m_scene.ForEachScenePresence(delegate(ScenePresence sp) + Scene.ForEachScenePresence(delegate(ScenePresence sp) { if (sp.UUID != senderID) { - ScenePresence p = m_scene.GetScenePresence(sp.UUID); + ScenePresence p = Scene.GetScenePresence(sp.UUID); // make sure they are still there, we could be working down a long list // Also make sure they are actually in the region if (p != null && !p.IsChildAgent) { - m_scene.TeleportClientHome(p.UUID, p.ControllingClient); + Scene.TeleportClientHome(p.UUID, p.ControllingClient); } } }); } + private void AbortTerrainXferHandler(IClientAPI remoteClient, ulong XferID) { if (TerrainUploader != null) @@ -547,11 +552,11 @@ namespace OpenSim.Region.CoreModules.World.Estate TerrainUploader = null; } remoteClient.SendAlertMessage("Terrain Upload Complete. Loading...."); - ITerrainModule terr = m_scene.RequestModuleInterface(); + ITerrainModule terr = Scene.RequestModuleInterface(); if (terr != null) { - m_log.Warn("[CLIENT]: Got Request to Send Terrain in region " + m_scene.RegionInfo.RegionName); + m_log.Warn("[CLIENT]: Got Request to Send Terrain in region " + Scene.RegionInfo.RegionName); try { @@ -597,7 +602,6 @@ namespace OpenSim.Region.CoreModules.World.Estate private void handleUploadTerrain(IClientAPI remote_client, string clientFileName) { - if (TerrainUploader == null) { @@ -615,16 +619,16 @@ namespace OpenSim.Region.CoreModules.World.Estate { remote_client.SendAlertMessage("Another Terrain Upload is in progress. Please wait your turn!"); } - } + private void handleTerrainRequest(IClientAPI remote_client, string clientFileName) { // Save terrain here - ITerrainModule terr = m_scene.RequestModuleInterface(); + ITerrainModule terr = Scene.RequestModuleInterface(); if (terr != null) { - m_log.Warn("[CLIENT]: Got Request to Send Terrain in region " + m_scene.RegionInfo.RegionName); + m_log.Warn("[CLIENT]: Got Request to Send Terrain in region " + Scene.RegionInfo.RegionName); if (File.Exists(Util.dataDir() + "/terrain.raw")) { File.Delete(Util.dataDir() + "/terrain.raw"); @@ -635,7 +639,7 @@ namespace OpenSim.Region.CoreModules.World.Estate byte[] bdata = new byte[input.Length]; input.Read(bdata, 0, (int)input.Length); remote_client.SendAlertMessage("Terrain file written, starting download..."); - m_scene.XferManager.AddNewFile("terrain.raw", bdata); + Scene.XferManager.AddNewFile("terrain.raw", bdata); // Tell client about it m_log.Warn("[CLIENT]: Sending Terrain to " + remote_client.Name); remote_client.SendInitiateDownload("terrain.raw", clientFileName); @@ -645,35 +649,35 @@ namespace OpenSim.Region.CoreModules.World.Estate private void HandleRegionInfoRequest(IClientAPI remote_client) { RegionInfoForEstateMenuArgs args = new RegionInfoForEstateMenuArgs(); - args.billableFactor = m_scene.RegionInfo.EstateSettings.BillableFactor; - args.estateID = m_scene.RegionInfo.EstateSettings.EstateID; - args.maxAgents = (byte)m_scene.RegionInfo.RegionSettings.AgentLimit; - args.objectBonusFactor = (float)m_scene.RegionInfo.RegionSettings.ObjectBonus; - args.parentEstateID = m_scene.RegionInfo.EstateSettings.ParentEstateID; - args.pricePerMeter = m_scene.RegionInfo.EstateSettings.PricePerMeter; - args.redirectGridX = m_scene.RegionInfo.EstateSettings.RedirectGridX; - args.redirectGridY = m_scene.RegionInfo.EstateSettings.RedirectGridY; + args.billableFactor = Scene.RegionInfo.EstateSettings.BillableFactor; + args.estateID = Scene.RegionInfo.EstateSettings.EstateID; + args.maxAgents = (byte)Scene.RegionInfo.RegionSettings.AgentLimit; + args.objectBonusFactor = (float)Scene.RegionInfo.RegionSettings.ObjectBonus; + args.parentEstateID = Scene.RegionInfo.EstateSettings.ParentEstateID; + args.pricePerMeter = Scene.RegionInfo.EstateSettings.PricePerMeter; + args.redirectGridX = Scene.RegionInfo.EstateSettings.RedirectGridX; + args.redirectGridY = Scene.RegionInfo.EstateSettings.RedirectGridY; args.regionFlags = GetRegionFlags(); - args.simAccess = m_scene.RegionInfo.AccessLevel; - args.sunHour = (float)m_scene.RegionInfo.RegionSettings.SunPosition; - args.terrainLowerLimit = (float)m_scene.RegionInfo.RegionSettings.TerrainLowerLimit; - args.terrainRaiseLimit = (float)m_scene.RegionInfo.RegionSettings.TerrainRaiseLimit; - args.useEstateSun = m_scene.RegionInfo.RegionSettings.UseEstateSun; - args.waterHeight = (float)m_scene.RegionInfo.RegionSettings.WaterHeight; - args.simName = m_scene.RegionInfo.RegionName; - args.regionType = m_scene.RegionInfo.RegionType; + args.simAccess = Scene.RegionInfo.AccessLevel; + args.sunHour = (float)Scene.RegionInfo.RegionSettings.SunPosition; + args.terrainLowerLimit = (float)Scene.RegionInfo.RegionSettings.TerrainLowerLimit; + args.terrainRaiseLimit = (float)Scene.RegionInfo.RegionSettings.TerrainRaiseLimit; + args.useEstateSun = Scene.RegionInfo.RegionSettings.UseEstateSun; + args.waterHeight = (float)Scene.RegionInfo.RegionSettings.WaterHeight; + args.simName = Scene.RegionInfo.RegionName; + args.regionType = Scene.RegionInfo.RegionType; remote_client.SendRegionInfoToEstateMenu(args); } private void HandleEstateCovenantRequest(IClientAPI remote_client) { - remote_client.SendEstateCovenantInformation(m_scene.RegionInfo.RegionSettings.Covenant); + remote_client.SendEstateCovenantInformation(Scene.RegionInfo.RegionSettings.Covenant); } private void HandleLandStatRequest(int parcelID, uint reportType, uint requestFlags, string filter, IClientAPI remoteClient) { - if (!m_scene.Permissions.CanIssueEstateCommand(remoteClient.AgentId, false)) + if (!Scene.Permissions.CanIssueEstateCommand(remoteClient.AgentId, false)) return; Dictionary SceneData = new Dictionary(); @@ -681,11 +685,11 @@ namespace OpenSim.Region.CoreModules.World.Estate if (reportType == 1) { - SceneData = m_scene.PhysicsScene.GetTopColliders(); + SceneData = Scene.PhysicsScene.GetTopColliders(); } else if (reportType == 0) { - SceneData = m_scene.SceneGraph.GetTopScripts(); + SceneData = Scene.SceneGraph.GetTopScripts(); } List SceneReport = new List(); @@ -693,7 +697,7 @@ namespace OpenSim.Region.CoreModules.World.Estate { foreach (uint obj in SceneData.Keys) { - SceneObjectPart prt = m_scene.GetSceneObjectPart(obj); + SceneObjectPart prt = Scene.GetSceneObjectPart(obj); if (prt != null) { if (prt.ParentGroup != null) @@ -765,7 +769,7 @@ namespace OpenSim.Region.CoreModules.World.Estate { // string lookupname = m_scene.CommsManager.UUIDNameRequestString(uuidarr[i]); - IUserManagement userManager = m_scene.RequestModuleInterface(); + IUserManagement userManager = Scene.RequestModuleInterface(); if (userManager != null) userManager.GetUserName(uuidarr[i]); @@ -780,7 +784,7 @@ namespace OpenSim.Region.CoreModules.World.Estate public void sendRegionInfoPacketToAll() { - m_scene.ForEachScenePresence(delegate(ScenePresence sp) + Scene.ForEachScenePresence(delegate(ScenePresence sp) { if (!sp.IsChildAgent) HandleRegionInfoRequest(sp.ControllingClient); @@ -791,99 +795,99 @@ namespace OpenSim.Region.CoreModules.World.Estate { RegionHandshakeArgs args = new RegionHandshakeArgs(); - args.isEstateManager = m_scene.RegionInfo.EstateSettings.IsEstateManager(remoteClient.AgentId); - if (m_scene.RegionInfo.EstateSettings.EstateOwner != UUID.Zero && m_scene.RegionInfo.EstateSettings.EstateOwner == remoteClient.AgentId) + args.isEstateManager = Scene.RegionInfo.EstateSettings.IsEstateManager(remoteClient.AgentId); + if (Scene.RegionInfo.EstateSettings.EstateOwner != UUID.Zero && Scene.RegionInfo.EstateSettings.EstateOwner == remoteClient.AgentId) args.isEstateManager = true; - args.billableFactor = m_scene.RegionInfo.EstateSettings.BillableFactor; - args.terrainStartHeight0 = (float)m_scene.RegionInfo.RegionSettings.Elevation1SW; - args.terrainHeightRange0 = (float)m_scene.RegionInfo.RegionSettings.Elevation2SW; - args.terrainStartHeight1 = (float)m_scene.RegionInfo.RegionSettings.Elevation1NW; - args.terrainHeightRange1 = (float)m_scene.RegionInfo.RegionSettings.Elevation2NW; - args.terrainStartHeight2 = (float)m_scene.RegionInfo.RegionSettings.Elevation1SE; - args.terrainHeightRange2 = (float)m_scene.RegionInfo.RegionSettings.Elevation2SE; - args.terrainStartHeight3 = (float)m_scene.RegionInfo.RegionSettings.Elevation1NE; - args.terrainHeightRange3 = (float)m_scene.RegionInfo.RegionSettings.Elevation2NE; - args.simAccess = m_scene.RegionInfo.AccessLevel; - args.waterHeight = (float)m_scene.RegionInfo.RegionSettings.WaterHeight; + args.billableFactor = Scene.RegionInfo.EstateSettings.BillableFactor; + args.terrainStartHeight0 = (float)Scene.RegionInfo.RegionSettings.Elevation1SW; + args.terrainHeightRange0 = (float)Scene.RegionInfo.RegionSettings.Elevation2SW; + args.terrainStartHeight1 = (float)Scene.RegionInfo.RegionSettings.Elevation1NW; + args.terrainHeightRange1 = (float)Scene.RegionInfo.RegionSettings.Elevation2NW; + args.terrainStartHeight2 = (float)Scene.RegionInfo.RegionSettings.Elevation1SE; + args.terrainHeightRange2 = (float)Scene.RegionInfo.RegionSettings.Elevation2SE; + args.terrainStartHeight3 = (float)Scene.RegionInfo.RegionSettings.Elevation1NE; + args.terrainHeightRange3 = (float)Scene.RegionInfo.RegionSettings.Elevation2NE; + args.simAccess = Scene.RegionInfo.AccessLevel; + args.waterHeight = (float)Scene.RegionInfo.RegionSettings.WaterHeight; args.regionFlags = GetRegionFlags(); - args.regionName = m_scene.RegionInfo.RegionName; - args.SimOwner = m_scene.RegionInfo.EstateSettings.EstateOwner; + args.regionName = Scene.RegionInfo.RegionName; + args.SimOwner = Scene.RegionInfo.EstateSettings.EstateOwner; args.terrainBase0 = UUID.Zero; args.terrainBase1 = UUID.Zero; args.terrainBase2 = UUID.Zero; args.terrainBase3 = UUID.Zero; - args.terrainDetail0 = m_scene.RegionInfo.RegionSettings.TerrainTexture1; - args.terrainDetail1 = m_scene.RegionInfo.RegionSettings.TerrainTexture2; - args.terrainDetail2 = m_scene.RegionInfo.RegionSettings.TerrainTexture3; - args.terrainDetail3 = m_scene.RegionInfo.RegionSettings.TerrainTexture4; + args.terrainDetail0 = Scene.RegionInfo.RegionSettings.TerrainTexture1; + args.terrainDetail1 = Scene.RegionInfo.RegionSettings.TerrainTexture2; + args.terrainDetail2 = Scene.RegionInfo.RegionSettings.TerrainTexture3; + args.terrainDetail3 = Scene.RegionInfo.RegionSettings.TerrainTexture4; - remoteClient.SendRegionHandshake(m_scene.RegionInfo,args); + remoteClient.SendRegionHandshake(Scene.RegionInfo,args); } public void sendRegionHandshakeToAll() { - m_scene.ForEachClient(sendRegionHandshake); + Scene.ForEachClient(sendRegionHandshake); } public void handleEstateChangeInfo(IClientAPI remoteClient, UUID invoice, UUID senderID, UInt32 parms1, UInt32 parms2) { if (parms2 == 0) { - m_scene.RegionInfo.EstateSettings.UseGlobalTime = true; - m_scene.RegionInfo.EstateSettings.SunPosition = 0.0; + Scene.RegionInfo.EstateSettings.UseGlobalTime = true; + Scene.RegionInfo.EstateSettings.SunPosition = 0.0; } else { - m_scene.RegionInfo.EstateSettings.UseGlobalTime = false; - m_scene.RegionInfo.EstateSettings.SunPosition = (parms2 - 0x1800)/1024.0; + Scene.RegionInfo.EstateSettings.UseGlobalTime = false; + Scene.RegionInfo.EstateSettings.SunPosition = (parms2 - 0x1800)/1024.0; } if ((parms1 & 0x00000010) != 0) - m_scene.RegionInfo.EstateSettings.FixedSun = true; + Scene.RegionInfo.EstateSettings.FixedSun = true; else - m_scene.RegionInfo.EstateSettings.FixedSun = false; + Scene.RegionInfo.EstateSettings.FixedSun = false; if ((parms1 & 0x00008000) != 0) - m_scene.RegionInfo.EstateSettings.PublicAccess = true; + Scene.RegionInfo.EstateSettings.PublicAccess = true; else - m_scene.RegionInfo.EstateSettings.PublicAccess = false; + Scene.RegionInfo.EstateSettings.PublicAccess = false; if ((parms1 & 0x10000000) != 0) - m_scene.RegionInfo.EstateSettings.AllowVoice = true; + Scene.RegionInfo.EstateSettings.AllowVoice = true; else - m_scene.RegionInfo.EstateSettings.AllowVoice = false; + Scene.RegionInfo.EstateSettings.AllowVoice = false; if ((parms1 & 0x00100000) != 0) - m_scene.RegionInfo.EstateSettings.AllowDirectTeleport = true; + Scene.RegionInfo.EstateSettings.AllowDirectTeleport = true; else - m_scene.RegionInfo.EstateSettings.AllowDirectTeleport = false; + Scene.RegionInfo.EstateSettings.AllowDirectTeleport = false; if ((parms1 & 0x00800000) != 0) - m_scene.RegionInfo.EstateSettings.DenyAnonymous = true; + Scene.RegionInfo.EstateSettings.DenyAnonymous = true; else - m_scene.RegionInfo.EstateSettings.DenyAnonymous = false; + Scene.RegionInfo.EstateSettings.DenyAnonymous = false; if ((parms1 & 0x01000000) != 0) - m_scene.RegionInfo.EstateSettings.DenyIdentified = true; + Scene.RegionInfo.EstateSettings.DenyIdentified = true; else - m_scene.RegionInfo.EstateSettings.DenyIdentified = false; + Scene.RegionInfo.EstateSettings.DenyIdentified = false; if ((parms1 & 0x02000000) != 0) - m_scene.RegionInfo.EstateSettings.DenyTransacted = true; + Scene.RegionInfo.EstateSettings.DenyTransacted = true; else - m_scene.RegionInfo.EstateSettings.DenyTransacted = false; + Scene.RegionInfo.EstateSettings.DenyTransacted = false; if ((parms1 & 0x40000000) != 0) - m_scene.RegionInfo.EstateSettings.DenyMinors = true; + Scene.RegionInfo.EstateSettings.DenyMinors = true; else - m_scene.RegionInfo.EstateSettings.DenyMinors = false; + Scene.RegionInfo.EstateSettings.DenyMinors = false; - m_scene.RegionInfo.EstateSettings.Save(); + Scene.RegionInfo.EstateSettings.Save(); TriggerEstateInfoChange(); - m_scene.TriggerEstateSunUpdate(); + Scene.TriggerEstateSunUpdate(); sendDetailedEstateData(remoteClient, invoice); } @@ -893,121 +897,21 @@ namespace OpenSim.Region.CoreModules.World.Estate #region IRegionModule Members public void Initialise(Scene scene, IConfigSource source) - { - m_scene = scene; - m_scene.RegisterModuleInterface(this); - m_scene.EventManager.OnNewClient += EventManager_OnNewClient; - m_scene.EventManager.OnRequestChangeWaterHeight += changeWaterHeight; - - m_scene.AddCommand(this, "set terrain texture", - "set terrain texture [] []", - "Sets the terrain to , if or are specified, it will only " + - "set it on regions with a matching coordinate. Specify -1 in or to wildcard" + - " that coordinate.", - consoleSetTerrainTexture); - - m_scene.AddCommand(this, "set terrain heights", - "set terrain heights [] []", - "Sets the terrain texture heights on corner # to /, if or are specified, it will only " + - "set it on regions with a matching coordinate. Specify -1 in or to wildcard" + - " that coordinate. Corner # SW = 0, NW = 1, SE = 2, NE = 3.", - consoleSetTerrainHeights); - } - - #region Console Commands - - public void consoleSetTerrainTexture(string module, string[] args) - { - string num = args[3]; - string uuid = args[4]; - int x = (args.Length > 5 ? int.Parse(args[5]) : -1); - int y = (args.Length > 6 ? int.Parse(args[6]) : -1); - - if (x == -1 || m_scene.RegionInfo.RegionLocX == x) - { - if (y == -1 || m_scene.RegionInfo.RegionLocY == y) - { - int corner = int.Parse(num); - UUID texture = UUID.Parse(uuid); - - m_log.Debug("[ESTATEMODULE] Setting terrain textures for " + m_scene.RegionInfo.RegionName + - string.Format(" (C#{0} = {1})", corner, texture)); - - switch (corner) - { - case 0: - m_scene.RegionInfo.RegionSettings.TerrainTexture1 = texture; - break; - case 1: - m_scene.RegionInfo.RegionSettings.TerrainTexture2 = texture; - break; - case 2: - m_scene.RegionInfo.RegionSettings.TerrainTexture3 = texture; - break; - case 3: - m_scene.RegionInfo.RegionSettings.TerrainTexture4 = texture; - break; - } - m_scene.RegionInfo.RegionSettings.Save(); - TriggerRegionInfoChange(); - sendRegionInfoPacketToAll(); - - } - } - } - - public void consoleSetTerrainHeights(string module, string[] args) - { - string num = args[3]; - string min = args[4]; - string max = args[5]; - int x = (args.Length > 6 ? int.Parse(args[6]) : -1); - int y = (args.Length > 7 ? int.Parse(args[7]) : -1); - - if (x == -1 || m_scene.RegionInfo.RegionLocX == x) - { - if (y == -1 || m_scene.RegionInfo.RegionLocY == y) - { - int corner = int.Parse(num); - float lowValue = float.Parse(min, Culture.NumberFormatInfo); - float highValue = float.Parse(max, Culture.NumberFormatInfo); - - m_log.Debug("[ESTATEMODULE] Setting terrain heights " + m_scene.RegionInfo.RegionName + - string.Format(" (C{0}, {1}-{2}", corner, lowValue, highValue)); - - switch (corner) - { - case 0: - m_scene.RegionInfo.RegionSettings.Elevation1SW = lowValue; - m_scene.RegionInfo.RegionSettings.Elevation2SW = highValue; - break; - case 1: - m_scene.RegionInfo.RegionSettings.Elevation1NW = lowValue; - m_scene.RegionInfo.RegionSettings.Elevation2NW = highValue; - break; - case 2: - m_scene.RegionInfo.RegionSettings.Elevation1SE = lowValue; - m_scene.RegionInfo.RegionSettings.Elevation2SE = highValue; - break; - case 3: - m_scene.RegionInfo.RegionSettings.Elevation1NE = lowValue; - m_scene.RegionInfo.RegionSettings.Elevation2NE = highValue; - break; - } - m_scene.RegionInfo.RegionSettings.Save(); - TriggerRegionInfoChange(); - sendRegionHandshakeToAll(); - } - } + { + Scene = scene; + Scene.RegisterModuleInterface(this); + Scene.EventManager.OnNewClient += EventManager_OnNewClient; + Scene.EventManager.OnRequestChangeWaterHeight += changeWaterHeight; + + m_commands = new EstateManagementCommands(this); + m_commands.Initialise(); } - #endregion - public void PostInitialise() { // Sets up the sun module based no the saved Estate and Region Settings // DO NOT REMOVE or the sun will stop working - m_scene.TriggerEstateSunUpdate(); + Scene.TriggerEstateSunUpdate(); } public void Close() @@ -1031,14 +935,14 @@ namespace OpenSim.Region.CoreModules.World.Estate public void changeWaterHeight(float height) { setRegionTerrainSettings(height, - (float)m_scene.RegionInfo.RegionSettings.TerrainRaiseLimit, - (float)m_scene.RegionInfo.RegionSettings.TerrainLowerLimit, - m_scene.RegionInfo.RegionSettings.UseEstateSun, - m_scene.RegionInfo.RegionSettings.FixedSun, - (float)m_scene.RegionInfo.RegionSettings.SunPosition, - m_scene.RegionInfo.EstateSettings.UseGlobalTime, - m_scene.RegionInfo.EstateSettings.FixedSun, - (float)m_scene.RegionInfo.EstateSettings.SunPosition); + (float)Scene.RegionInfo.RegionSettings.TerrainRaiseLimit, + (float)Scene.RegionInfo.RegionSettings.TerrainLowerLimit, + Scene.RegionInfo.RegionSettings.UseEstateSun, + Scene.RegionInfo.RegionSettings.FixedSun, + (float)Scene.RegionInfo.RegionSettings.SunPosition, + Scene.RegionInfo.EstateSettings.UseGlobalTime, + Scene.RegionInfo.EstateSettings.FixedSun, + (float)Scene.RegionInfo.EstateSettings.SunPosition); sendRegionInfoPacketToAll(); } @@ -1078,32 +982,32 @@ namespace OpenSim.Region.CoreModules.World.Estate // Fully implemented // - if (m_scene.RegionInfo.RegionSettings.AllowDamage) + if (Scene.RegionInfo.RegionSettings.AllowDamage) flags |= RegionFlags.AllowDamage; - if (m_scene.RegionInfo.RegionSettings.BlockTerraform) + if (Scene.RegionInfo.RegionSettings.BlockTerraform) flags |= RegionFlags.BlockTerraform; - if (!m_scene.RegionInfo.RegionSettings.AllowLandResell) + if (!Scene.RegionInfo.RegionSettings.AllowLandResell) flags |= RegionFlags.BlockLandResell; - if (m_scene.RegionInfo.RegionSettings.DisableCollisions) + if (Scene.RegionInfo.RegionSettings.DisableCollisions) flags |= RegionFlags.SkipCollisions; - if (m_scene.RegionInfo.RegionSettings.DisableScripts) + if (Scene.RegionInfo.RegionSettings.DisableScripts) flags |= RegionFlags.SkipScripts; - if (m_scene.RegionInfo.RegionSettings.DisablePhysics) + if (Scene.RegionInfo.RegionSettings.DisablePhysics) flags |= RegionFlags.SkipPhysics; - if (m_scene.RegionInfo.RegionSettings.BlockFly) + if (Scene.RegionInfo.RegionSettings.BlockFly) flags |= RegionFlags.NoFly; - if (m_scene.RegionInfo.RegionSettings.RestrictPushing) + if (Scene.RegionInfo.RegionSettings.RestrictPushing) flags |= RegionFlags.RestrictPushObject; - if (m_scene.RegionInfo.RegionSettings.AllowLandJoinDivide) + if (Scene.RegionInfo.RegionSettings.AllowLandJoinDivide) flags |= RegionFlags.AllowParcelChanges; - if (m_scene.RegionInfo.RegionSettings.BlockShowInSearch) + if (Scene.RegionInfo.RegionSettings.BlockShowInSearch) flags |= RegionFlags.BlockParcelSearch; - if (m_scene.RegionInfo.RegionSettings.FixedSun) + if (Scene.RegionInfo.RegionSettings.FixedSun) flags |= RegionFlags.SunFixed; - if (m_scene.RegionInfo.RegionSettings.Sandbox) + if (Scene.RegionInfo.RegionSettings.Sandbox) flags |= RegionFlags.Sandbox; - if (m_scene.RegionInfo.EstateSettings.AllowVoice) + if (Scene.RegionInfo.EstateSettings.AllowVoice) flags |= RegionFlags.AllowVoice; // Fudge these to always on, so the menu options activate @@ -1125,32 +1029,32 @@ namespace OpenSim.Region.CoreModules.World.Estate { RegionFlags flags = RegionFlags.None; - if (m_scene.RegionInfo.EstateSettings.FixedSun) + if (Scene.RegionInfo.EstateSettings.FixedSun) flags |= RegionFlags.SunFixed; - if (m_scene.RegionInfo.EstateSettings.PublicAccess) + if (Scene.RegionInfo.EstateSettings.PublicAccess) flags |= (RegionFlags.PublicAllowed | RegionFlags.ExternallyVisible); - if (m_scene.RegionInfo.EstateSettings.AllowVoice) + if (Scene.RegionInfo.EstateSettings.AllowVoice) flags |= RegionFlags.AllowVoice; - if (m_scene.RegionInfo.EstateSettings.AllowDirectTeleport) + if (Scene.RegionInfo.EstateSettings.AllowDirectTeleport) flags |= RegionFlags.AllowDirectTeleport; - if (m_scene.RegionInfo.EstateSettings.DenyAnonymous) + if (Scene.RegionInfo.EstateSettings.DenyAnonymous) flags |= RegionFlags.DenyAnonymous; - if (m_scene.RegionInfo.EstateSettings.DenyIdentified) + if (Scene.RegionInfo.EstateSettings.DenyIdentified) flags |= RegionFlags.DenyIdentified; - if (m_scene.RegionInfo.EstateSettings.DenyTransacted) + if (Scene.RegionInfo.EstateSettings.DenyTransacted) flags |= RegionFlags.DenyTransacted; - if (m_scene.RegionInfo.EstateSettings.AbuseEmailToEstateOwner) + if (Scene.RegionInfo.EstateSettings.AbuseEmailToEstateOwner) flags |= RegionFlags.AbuseEmailToEstateOwner; - if (m_scene.RegionInfo.EstateSettings.BlockDwell) + if (Scene.RegionInfo.EstateSettings.BlockDwell) flags |= RegionFlags.BlockDwell; - if (m_scene.RegionInfo.EstateSettings.EstateSkipScripts) + if (Scene.RegionInfo.EstateSettings.EstateSkipScripts) flags |= RegionFlags.EstateSkipScripts; - if (m_scene.RegionInfo.EstateSettings.ResetHomeOnTeleport) + if (Scene.RegionInfo.EstateSettings.ResetHomeOnTeleport) flags |= RegionFlags.ResetHomeOnTeleport; - if (m_scene.RegionInfo.EstateSettings.TaxFree) + if (Scene.RegionInfo.EstateSettings.TaxFree) flags |= RegionFlags.TaxFree; - if (m_scene.RegionInfo.EstateSettings.DenyMinors) + if (Scene.RegionInfo.EstateSettings.DenyMinors) flags |= (RegionFlags)(1 << 30); return (uint)flags; @@ -1158,38 +1062,38 @@ namespace OpenSim.Region.CoreModules.World.Estate public bool IsManager(UUID avatarID) { - if (avatarID == m_scene.RegionInfo.EstateSettings.EstateOwner) + if (avatarID == Scene.RegionInfo.EstateSettings.EstateOwner) return true; - List ems = new List(m_scene.RegionInfo.EstateSettings.EstateManagers); + List ems = new List(Scene.RegionInfo.EstateSettings.EstateManagers); if (ems.Contains(avatarID)) return true; return false; } - protected void TriggerRegionInfoChange() + public void TriggerRegionInfoChange() { ChangeDelegate change = OnRegionInfoChange; if (change != null) - change(m_scene.RegionInfo.RegionID); + change(Scene.RegionInfo.RegionID); } - protected void TriggerEstateInfoChange() + public void TriggerEstateInfoChange() { ChangeDelegate change = OnEstateInfoChange; if (change != null) - change(m_scene.RegionInfo.RegionID); + change(Scene.RegionInfo.RegionID); } - protected void TriggerEstateMessage(UUID fromID, string fromName, string message) + public void TriggerEstateMessage(UUID fromID, string fromName, string message) { MessageDelegate onmessage = OnEstateMessage; if (onmessage != null) - onmessage(m_scene.RegionInfo.RegionID, fromID, fromName, message); + onmessage(Scene.RegionInfo.RegionID, fromID, fromName, message); } } } -- cgit v1.1 From 7e21c1eadf28e86b29fdd24b33e29950e195c6db Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 12 Feb 2011 00:46:01 +0000 Subject: Hack in a crude temporary "estate show" command This will show the estate for each region, along with that estate's id and the estate owner. This is temporary because the command output might change. This commit also converts the estate module from the old to the new region module format --- .../World/Estate/EstateManagementCommands.cs | 74 +++++++++++++++++++++- .../World/Estate/EstateManagementModule.cs | 40 ++++++------ .../Region/Framework/Interfaces/IEstateModule.cs | 2 +- 3 files changed, 94 insertions(+), 22 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs index 14f5b1e..f6d1a82 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs @@ -30,21 +30,29 @@ using System.Collections.Generic; using System.IO; using System.Reflection; using System.Security; +using System.Text; using log4net; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; +using OpenSim.Framework.Console; +using OpenSim.Region.CoreModules.Framework.InterfaceCommander; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules.World.Estate { + /// + /// Estate management console commands. + /// public class EstateManagementCommands { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); protected EstateManagementModule m_module; + protected Commander m_commander = new Commander("estate"); + public EstateManagementCommands(EstateManagementModule module) { m_module = module; @@ -52,20 +60,60 @@ namespace OpenSim.Region.CoreModules.World.Estate public void Initialise() { - m_module.Scene.AddCommand(this, "set terrain texture", + m_log.DebugFormat("[ESTATE MODULE]: Setting up estate commands for region {0}", m_module.Scene.RegionInfo.RegionName); + + m_module.Scene.AddCommand(m_module, "set terrain texture", "set terrain texture [] []", "Sets the terrain to , if or are specified, it will only " + "set it on regions with a matching coordinate. Specify -1 in or to wildcard" + " that coordinate.", consoleSetTerrainTexture); - m_module.Scene.AddCommand(this, "set terrain heights", + m_module.Scene.AddCommand(m_module, "set terrain heights", "set terrain heights [] []", "Sets the terrain texture heights on corner # to /, if or are specified, it will only " + "set it on regions with a matching coordinate. Specify -1 in or to wildcard" + " that coordinate. Corner # SW = 0, NW = 1, SE = 2, NE = 3.", consoleSetTerrainHeights); - } + + Command showCommand + = new Command("show", CommandIntentions.COMMAND_STATISTICAL, ShowEstatesCommand, "Shows all estates on the simulator."); + + m_commander.RegisterCommand("show", showCommand); + + m_module.Scene.RegisterModuleCommander(m_commander); + + m_module.Scene.EventManager.OnPluginConsole += EventManagerOnPluginConsole; + } + + public void Close() + { + m_module.Scene.EventManager.OnPluginConsole -= EventManagerOnPluginConsole; + m_module.Scene.UnregisterModuleCommander(m_commander.Name); + } + + /// + /// Processes commandline input. Do not call directly. + /// + /// Commandline arguments + protected void EventManagerOnPluginConsole(string[] args) + { + if (args[0] == "estate") + { + if (args.Length == 1) + { + m_commander.ProcessConsoleCommand("help", new string[0]); + return; + } + + string[] tmpArgs = new string[args.Length - 2]; + int i; + for (i = 2; i < args.Length; i++) + tmpArgs[i - 2] = args[i]; + + m_commander.ProcessConsoleCommand(args[1], tmpArgs); + } + } protected void consoleSetTerrainTexture(string module, string[] args) { @@ -152,5 +200,25 @@ namespace OpenSim.Region.CoreModules.World.Estate } } } + + protected void ShowEstatesCommand(Object[] args) + { + StringBuilder report = new StringBuilder(); + RegionInfo ri = m_module.Scene.RegionInfo; + EstateSettings es = ri.EstateSettings; + + report.AppendFormat("Estate information for region {0}\n", ri.RegionName); + report.AppendFormat( + "{0,-20} {1,-7} {2,-20}\n", + "Estate Name", + "ID", + "Owner"); + + report.AppendFormat( + "{0,-20} {1,-7} {2,-20}\n", + es.EstateName, es.EstateID, m_module.UserManager.GetUserName(es.EstateOwner)); + + MainConsole.Instance.Output(report.ToString()); + } } } \ No newline at end of file diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 54d3c61..57ab135 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -31,6 +31,7 @@ using System.IO; using System.Reflection; using System.Security; using log4net; +using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; @@ -39,15 +40,17 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules.World.Estate { - public class EstateManagementModule : IEstateModule + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "EstateManagementModule")] + public class EstateManagementModule : IEstateModule, INonSharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private delegate void LookupUUIDS(List uuidLst); public Scene Scene { get; private set; } + public IUserManagement UserManager { get; private set; } - protected EstateManagementCommands m_commands; + protected EstateManagementCommands m_commands; private EstateTerrainXferHandler TerrainUploader; @@ -895,9 +898,15 @@ namespace OpenSim.Region.CoreModules.World.Estate #endregion #region IRegionModule Members + + public string Name { get { return "EstateManagementModule"; } } + + public Type ReplaceableInterface { get { return null; } } - public void Initialise(Scene scene, IConfigSource source) - { + public void Initialise(IConfigSource source) {} + + public void AddRegion(Scene scene) + { Scene = scene; Scene.RegisterModuleInterface(this); Scene.EventManager.OnNewClient += EventManager_OnNewClient; @@ -906,26 +915,21 @@ namespace OpenSim.Region.CoreModules.World.Estate m_commands = new EstateManagementCommands(this); m_commands.Initialise(); } - - public void PostInitialise() + + public void RemoveRegion(Scene scene) {} + + public void RegionLoaded(Scene scene) { // Sets up the sun module based no the saved Estate and Region Settings // DO NOT REMOVE or the sun will stop working - Scene.TriggerEstateSunUpdate(); - } - - public void Close() - { - } - - public string Name - { - get { return "EstateManagementModule"; } + scene.TriggerEstateSunUpdate(); + + UserManager = scene.RequestModuleInterface(); } - public bool IsSharedModule + public void Close() { - get { return false; } + m_commands.Close(); } #endregion diff --git a/OpenSim/Region/Framework/Interfaces/IEstateModule.cs b/OpenSim/Region/Framework/Interfaces/IEstateModule.cs index c850f7f..721f0ee 100644 --- a/OpenSim/Region/Framework/Interfaces/IEstateModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IEstateModule.cs @@ -32,7 +32,7 @@ namespace OpenSim.Region.Framework.Interfaces public delegate void ChangeDelegate(UUID regionID); public delegate void MessageDelegate(UUID regionID, UUID fromID, string fromName, string message); - public interface IEstateModule : IRegionModule + public interface IEstateModule { event ChangeDelegate OnRegionInfoChange; event ChangeDelegate OnEstateInfoChange; -- cgit v1.1 From 03d82a5a8524cfba07d95456d59be6f35ab72048 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 12 Feb 2011 01:08:56 +0000 Subject: Fix bug where "My estate" name was always used even if the user entered a different name on initial setup. Turns out we had stopped saving estate settings immediately after the name change. The scene constructor then reloade the settings and oblitereted the different name. This code could be more efficient since there's no reason for scene to reload the settings when they are already known to be valid. Thanks to Thoneve for the spot on this. --- OpenSim/Region/Application/OpenSimBase.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 1652b82..e950613 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -795,9 +795,7 @@ namespace OpenSim /// /// Load the estate information for the provided RegionInfo object. /// - /// - /// A - /// + /// public void PopulateRegionEstateInfo(RegionInfo regInfo) { IEstateDataService estateDataService = EstateDataService; @@ -819,7 +817,13 @@ namespace OpenSim regInfo.EstateSettings = estateDataService.LoadEstateSettings(regInfo.RegionID, true); regInfo.EstateSettings.EstateName = MainConsole.Instance.CmdPrompt("New estate name", regInfo.EstateSettings.EstateName); - //regInfo.EstateSettings.Save(); + + // FIXME: Later on, the scene constructor will reload the estate settings no matter what. + // Therefore, we need to do an initial save here otherwise the new estate name will be reset + // back to the default. The reloading of estate settings by scene could be eliminated if it + // knows that the passed in settings in RegionInfo are already valid. Also, it might be + // possible to eliminate some additional later saves made by callers of this method. + regInfo.EstateSettings.Save(); break; } else -- cgit v1.1 From 9801bf03f8ab59e1fe8d439a216ca48a5bd68dc7 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 12 Feb 2011 01:14:12 +0000 Subject: minor: add comment explaining that GetRegionsByName needs to stay in TeleportAgent for its side effects. --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 3f8735e..688dfe4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -702,6 +702,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // and convert the regionName to the target region if (regionName.Contains(".") && regionName.Contains(":")) { + // Even though we use none of the results, we need to perform this call because it appears + // to have some the side effect of setting up hypergrid teleport locations. World.GridService.GetRegionsByName(World.RegionInfo.ScopeID, regionName, 1); // List regions = World.GridService.GetRegionsByName(World.RegionInfo.ScopeID, regionName, 1); -- cgit v1.1 From a8ced66e873d09bd1c9fd0cfe5d0487bf0ee27e7 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 12 Feb 2011 07:28:21 -0800 Subject: Improved error message on TP failure --- .../Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 80a8041..1337143 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -243,7 +243,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer } catch (Exception e) { - m_log.WarnFormat("[ENTITY TRANSFER MODULE]: Exception on teleport: {0}\n{1}", e.Message, e.StackTrace); + m_log.WarnFormat("[ENTITY TRANSFER MODULE]: Exception on teleport: {0} {1}", e.Message, e.StackTrace); sp.ControllingClient.SendTeleportFailed("Internal error"); } } -- cgit v1.1