From 39a748b47a5eb8020f167287c84a91bee0881cca Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 13 Aug 2010 20:23:53 +0100 Subject: refactor: Use SOP.Flags rather than SOP.ObjectFlags --- .../CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 1a7da61..eef0c73 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) Contributors, http://opensimulator.org/ * See CONTRIBUTORS.TXT for a full list of copyright holders. * @@ -543,7 +543,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess if (attachment) { - group.RootPart.ObjectFlags |= (uint)PrimFlags.Phantom; + group.RootPart.Flags |= PrimFlags.Phantom; group.RootPart.IsAttachment = true; } -- cgit v1.1 From 5f5c65e4bae1f2a84d6972697d0413137f6b1da1 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 13 Aug 2010 20:34:46 +0100 Subject: refactor: move more map tile generation code from scene to IWorldMapModule --- .../Region/CoreModules/World/WorldMap/WorldMapModule.cs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index 9d9967a..f036d85 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -1000,11 +1000,24 @@ namespace OpenSim.Region.CoreModules.World.WorldMap return responsemap; } - public void RegenerateMaptile(byte[] data) + public void GenerateMaptile() { + // Cannot create a map for a nonexistant heightmap + if (m_scene.Heightmap == null) + return; + + //create a texture asset of the terrain + IMapImageGenerator terrain = m_scene.RequestModuleInterface(); + if (terrain == null) + return; + + byte[] data = terrain.WriteJpeg2000Image("defaultstripe.png"); + if (data == null) + return; + UUID lastMapRegionUUID = m_scene.RegionInfo.RegionSettings.TerrainImageID; - m_log.Debug("[MAPTILE]: STORING MAPTILE IMAGE"); + m_log.Debug("[WORLDMAP]: STORING MAPTILE IMAGE"); m_scene.RegionInfo.RegionSettings.TerrainImageID = UUID.Random(); -- cgit v1.1 From fd23f270c6914b7aa628f96daa9608745d3a20b3 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 13 Aug 2010 21:01:10 +0100 Subject: refactor: remove Scene.SetRootAgentScene() in favour of existing event with same name --- .../Avatar/Inventory/Transfer/InventoryTransferModule.cs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index 2f1e9dd..8b77a5f 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs @@ -82,6 +82,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer scene.EventManager.OnNewClient += OnNewClient; scene.EventManager.OnClientClosed += ClientLoggedOut; scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; + scene.EventManager.OnSetRootAgentScene += OnSetRootAgentScene; } public void RegionLoaded(Scene scene) @@ -98,9 +99,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer scene.EventManager.OnNewClient -= OnNewClient; scene.EventManager.OnClientClosed -= ClientLoggedOut; scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage; + scene.EventManager.OnSetRootAgentScene -= OnSetRootAgentScene; } } - } public void RemoveRegion(Scene scene) @@ -108,6 +109,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer scene.EventManager.OnNewClient -= OnNewClient; scene.EventManager.OnClientClosed -= ClientLoggedOut; scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage; + scene.EventManager.OnSetRootAgentScene -= OnSetRootAgentScene; m_Scenelist.Remove(scene); } @@ -136,6 +138,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer // Inventory giving is conducted via instant message client.OnInstantMessage += OnInstantMessage; } + + protected void OnSetRootAgentScene(UUID id, Scene scene) + { + m_AgentRegions[id] = scene; + } private Scene FindClientScene(UUID agentId) { @@ -160,7 +167,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer if (scene == null) // Something seriously wrong here. return; - if (im.dialog == (byte) InstantMessageDialog.InventoryOffered) { //m_log.DebugFormat("Asset type {0}", ((AssetType)im.binaryBucket[0])); @@ -346,11 +352,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer } } - public void SetRootAgentScene(UUID agentID, Scene scene) - { - m_AgentRegions[agentID] = scene; - } - public bool NeedSceneCacheClear(UUID agentID, Scene scene) { if (!m_AgentRegions.ContainsKey(agentID)) -- cgit v1.1 From 5d20f04e08c65b37bbdda187c30ce038872307ab Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 13 Aug 2010 21:18:26 +0100 Subject: refactor: move Scene.TerrainUnAcked() handling into TerrainModule --- OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs index 2c5e444..cb80111 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs @@ -586,8 +586,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain client.OnModifyTerrain += client_OnModifyTerrain; client.OnBakeTerrain += client_OnBakeTerrain; client.OnLandUndo += client_OnLandUndo; + client.OnUnackedTerrain += client_OnUnackedTerrain; } - + /// /// Checks to see if the terrain has been modified since last check /// but won't attempt to limit those changes to the limits specified in the estate settings @@ -808,6 +809,12 @@ namespace OpenSim.Region.CoreModules.World.Terrain InterfaceBakeTerrain(null); //bake terrain does not use the passed in parameter } } + + protected void client_OnUnackedTerrain(IClientAPI client, int patchX, int patchY) + { + //m_log.Debug("Terrain packet unacked, resending patch: " + patchX + " , " + patchY); + client.SendLayerData(patchX, patchY, m_scene.Heightmap.GetFloatsSerialised()); + } private void StoreUndoState() { -- cgit v1.1 From b30635a454a2d4c8753023efaeb41118be1ef40e Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 13 Aug 2010 21:39:43 +0100 Subject: Establish new Objects/BuySellModule Move Scene.ObjectSaleInfo() to this --- .../World/Objects/BuySell/BuySellModule.cs | 98 ++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs new file mode 100644 index 0000000..326eea9 --- /dev/null +++ b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs @@ -0,0 +1,98 @@ +/* + * 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.Reflection; +using log4net; +using Mono.Addins; +using Nini.Config; +using OpenMetaverse; +using OpenMetaverse.Packets; +using OpenSim.Framework; +using OpenSim.Region.Framework; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.Framework.Scenes; + +namespace OpenSim.Region.CoreModules.World.Objects.BuySell +{ + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "BuySellModule")] + public class BuySellModule : INonSharedRegionModule + { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + protected Scene m_scene = null; + + public string Name { get { return "Object BuySell Module"; } } + public Type ReplaceableInterface { get { return null; } } + + public void Initialise(IConfigSource source) {} + + public void AddRegion(Scene scene) + { + m_scene = scene; + m_scene.EventManager.OnNewClient += SubscribeToClientEvents; + } + + public void RemoveRegion(Scene scene) + { + m_scene.EventManager.OnNewClient -= SubscribeToClientEvents; + } + + public void RegionLoaded(Scene scene) {} + + public void Close() + { + RemoveRegion(m_scene); + } + + public void SubscribeToClientEvents(IClientAPI client) + { + client.OnObjectSaleInfo += ObjectSaleInfo; + } + + protected void ObjectSaleInfo( + IClientAPI client, UUID agentID, UUID sessionID, uint localID, byte saleType, int salePrice) + { + SceneObjectPart part = m_scene.GetSceneObjectPart(localID); + if (part == null || part.ParentGroup == null) + return; + + if (part.ParentGroup.IsDeleted) + return; + + part = part.ParentGroup.RootPart; + + part.ObjectSaleType = saleType; + part.SalePrice = salePrice; + + part.ParentGroup.HasGroupChanged = true; + + part.GetProperties(client); + } + } +} \ No newline at end of file -- cgit v1.1 From 9d84dfb687f3387773f67497d4c39386636853fa Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 13 Aug 2010 21:44:44 +0100 Subject: minor: remove mono compiler warning --- OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs index a895d6e..032e55a 100644 --- a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs @@ -93,7 +93,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule { string deadAvatarMessage; ScenePresence killingAvatar = null; - string killingAvatarMessage; +// string killingAvatarMessage; if (killerObjectLocalID == 0) deadAvatarMessage = "You committed suicide!"; @@ -118,14 +118,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule deadAvatarMessage = String.Format("You impaled yourself on {0} owned by {1}!", part.Name, deadAvatar.Scene.GetUserName(part.OwnerID)); else { - killingAvatarMessage = String.Format("You fragged {0}!", deadAvatar.Name); +// killingAvatarMessage = String.Format("You fragged {0}!", deadAvatar.Name); deadAvatarMessage = String.Format("You got killed by {0}!", killingAvatar.Name); } } } else { - killingAvatarMessage = String.Format("You fragged {0}!", deadAvatar.Name); +// killingAvatarMessage = String.Format("You fragged {0}!", deadAvatar.Name); deadAvatarMessage = String.Format("You got killed by {0}!", killingAvatar.Name); } } -- cgit v1.1 From e89f0b3f71dc8bd439fcfc23d12b305369eac36b Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 13 Aug 2010 22:29:42 +0100 Subject: refactor: move Scene.PerformObjectBuy into BuySellModule --- .../World/Objects/BuySell/BuySellModule.cs | 169 ++++++++++++++++++++- 1 file changed, 167 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs index 326eea9..b0ddd8f 100644 --- a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs +++ b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs @@ -37,15 +37,17 @@ using OpenSim.Framework; using OpenSim.Region.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; +using OpenSim.Region.Framework.Scenes.Serialization; namespace OpenSim.Region.CoreModules.World.Objects.BuySell { [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "BuySellModule")] - public class BuySellModule : INonSharedRegionModule + public class BuySellModule : IBuySellModule, INonSharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); protected Scene m_scene = null; + protected IDialogModule m_dialogModule; public string Name { get { return "Object BuySell Module"; } } public Type ReplaceableInterface { get { return null; } } @@ -55,6 +57,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell public void AddRegion(Scene scene) { m_scene = scene; + m_scene.RegisterModuleInterface(this); m_scene.EventManager.OnNewClient += SubscribeToClientEvents; } @@ -63,7 +66,10 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell m_scene.EventManager.OnNewClient -= SubscribeToClientEvents; } - public void RegionLoaded(Scene scene) {} + public void RegionLoaded(Scene scene) + { + m_dialogModule = scene.RequestModuleInterface(); + } public void Close() { @@ -93,6 +99,165 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell part.ParentGroup.HasGroupChanged = true; part.GetProperties(client); + } + + public bool BuyObject(IClientAPI remoteClient, UUID categoryID, uint localID, byte saleType) + { + SceneObjectPart part = m_scene.GetSceneObjectPart(localID); + + if (part == null) + return false; + + if (part.ParentGroup == null) + return false; + + SceneObjectGroup group = part.ParentGroup; + + switch (saleType) + { + case 1: // Sell as original (in-place sale) + uint effectivePerms = group.GetEffectivePermissions(); + + if ((effectivePerms & (uint)PermissionMask.Transfer) == 0) + { + if (m_dialogModule != null) + m_dialogModule.SendAlertToUser(remoteClient, "This item doesn't appear to be for sale"); + return false; + } + + group.SetOwnerId(remoteClient.AgentId); + group.SetRootPartOwner(part, remoteClient.AgentId, remoteClient.ActiveGroupId); + + List partList = new List(group.Children.Values); + + if (m_scene.Permissions.PropagatePermissions()) + { + foreach (SceneObjectPart child in partList) + { + child.Inventory.ChangeInventoryOwner(remoteClient.AgentId); + child.TriggerScriptChangedEvent(Changed.OWNER); + child.ApplyNextOwnerPermissions(); + } + } + + part.ObjectSaleType = 0; + part.SalePrice = 10; + + group.HasGroupChanged = true; + part.GetProperties(remoteClient); + part.TriggerScriptChangedEvent(Changed.OWNER); + group.ResumeScripts(); + part.ScheduleFullUpdate(); + + break; + + case 2: // Sell a copy + Vector3 inventoryStoredPosition = new Vector3 + (((group.AbsolutePosition.X > (int)Constants.RegionSize) + ? 250 + : group.AbsolutePosition.X) + , + (group.AbsolutePosition.X > (int)Constants.RegionSize) + ? 250 + : group.AbsolutePosition.X, + group.AbsolutePosition.Z); + + Vector3 originalPosition = group.AbsolutePosition; + + group.AbsolutePosition = inventoryStoredPosition; + + string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(group); + group.AbsolutePosition = originalPosition; + + uint perms = group.GetEffectivePermissions(); + + if ((perms & (uint)PermissionMask.Transfer) == 0) + { + if (m_dialogModule != null) + m_dialogModule.SendAlertToUser(remoteClient, "This item doesn't appear to be for sale"); + return false; + } + + AssetBase asset = m_scene.CreateAsset( + group.GetPartName(localID), + group.GetPartDescription(localID), + (sbyte)AssetType.Object, + Utils.StringToBytes(sceneObjectXml), + group.OwnerID); + m_scene.AssetService.Store(asset); + + InventoryItemBase item = new InventoryItemBase(); + item.CreatorId = part.CreatorID.ToString(); + + item.ID = UUID.Random(); + item.Owner = remoteClient.AgentId; + item.AssetID = asset.FullID; + item.Description = asset.Description; + item.Name = asset.Name; + item.AssetType = asset.Type; + item.InvType = (int)InventoryType.Object; + item.Folder = categoryID; + + uint nextPerms=(perms & 7) << 13; + if ((nextPerms & (uint)PermissionMask.Copy) == 0) + perms &= ~(uint)PermissionMask.Copy; + if ((nextPerms & (uint)PermissionMask.Transfer) == 0) + perms &= ~(uint)PermissionMask.Transfer; + if ((nextPerms & (uint)PermissionMask.Modify) == 0) + perms &= ~(uint)PermissionMask.Modify; + + item.BasePermissions = perms & part.NextOwnerMask; + item.CurrentPermissions = perms & part.NextOwnerMask; + item.NextPermissions = part.NextOwnerMask; + item.EveryOnePermissions = part.EveryoneMask & + part.NextOwnerMask; + item.GroupPermissions = part.GroupMask & + part.NextOwnerMask; + item.CurrentPermissions |= 16; // Slam! + item.CreationDate = Util.UnixTimeSinceEpoch(); + + if (m_scene.InventoryService.AddItem(item)) + { + remoteClient.SendInventoryItemCreateUpdate(item, 0); + } + else + { + if (m_dialogModule != null) + m_dialogModule.SendAlertToUser(remoteClient, "Cannot buy now. Your inventory is unavailable"); + return false; + } + break; + + case 3: // Sell contents + List invList = part.Inventory.GetInventoryList(); + + bool okToSell = true; + + foreach (UUID invID in invList) + { + TaskInventoryItem item1 = part.Inventory.GetInventoryItem(invID); + if ((item1.CurrentPermissions & + (uint)PermissionMask.Transfer) == 0) + { + okToSell = false; + break; + } + } + + if (!okToSell) + { + if (m_dialogModule != null) + m_dialogModule.SendAlertToUser( + remoteClient, "This item's inventory doesn't appear to be for sale"); + return false; + } + + if (invList.Count > 0) + m_scene.MoveTaskInventoryItems(remoteClient.AgentId, part.Name, part, invList); + break; + } + + return true; } } } \ No newline at end of file -- cgit v1.1 From ab6dc478188e1609d9656e65d410d08270066bf0 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 13 Aug 2010 23:15:11 +0100 Subject: refactor: move binary statistics logging from scene into separate region module --- .../Statistics/Logging/BinaryLoggingModule.cs | 169 +++++++++++++++++++++ 1 file changed, 169 insertions(+) create mode 100644 OpenSim/Region/CoreModules/Framework/Statistics/Logging/BinaryLoggingModule.cs (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/Framework/Statistics/Logging/BinaryLoggingModule.cs b/OpenSim/Region/CoreModules/Framework/Statistics/Logging/BinaryLoggingModule.cs new file mode 100644 index 0000000..b75a700 --- /dev/null +++ b/OpenSim/Region/CoreModules/Framework/Statistics/Logging/BinaryLoggingModule.cs @@ -0,0 +1,169 @@ +/* + * 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 log4net; +using Mono.Addins; +using Nini.Config; +using OpenMetaverse; +using OpenMetaverse.Packets; +using OpenSim.Framework; +using OpenSim.Region.Framework; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.Framework.Scenes; + +namespace OpenSim.Region.CoreModules.Avatar.Attachments +{ + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "BinaryLoggingModule")] + public class BinaryLoggingModule : INonSharedRegionModule + { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + protected bool m_collectStats; + protected Scene m_scene = null; + + public string Name { get { return "Binary Statistics Logging Module"; } } + public Type ReplaceableInterface { get { return null; } } + + public void Initialise(IConfigSource source) + { + try + { + IConfig statConfig = source.Configs["Statistics.Binary"]; + if (statConfig.Contains("enabled") && statConfig.GetBoolean("enabled")) + { + if (statConfig.Contains("collect_region_stats")) + { + if (statConfig.GetBoolean("collect_region_stats")) + { + m_collectStats = true; + } + } + if (statConfig.Contains("region_stats_period_seconds")) + { + m_statLogPeriod = TimeSpan.FromSeconds(statConfig.GetInt("region_stats_period_seconds")); + } + if (statConfig.Contains("stats_dir")) + { + m_statsDir = statConfig.GetString("stats_dir"); + } + } + } + catch + { + // if it doesn't work, we don't collect anything + } + } + + public void AddRegion(Scene scene) + { + m_scene = scene; + } + + public void RemoveRegion(Scene scene) + { + } + + public void RegionLoaded(Scene scene) + { + if (m_collectStats) + m_scene.StatsReporter.OnSendStatsResult += LogSimStats; + } + + public void Close() + { + } + + public class StatLogger + { + public DateTime StartTime; + public string Path; + public System.IO.BinaryWriter Log; + } + + static StatLogger m_statLog = null; + static TimeSpan m_statLogPeriod = TimeSpan.FromSeconds(300); + static string m_statsDir = String.Empty; + static Object m_statLockObject = new Object(); + + private void LogSimStats(SimStats stats) + { + SimStatsPacket pack = new SimStatsPacket(); + pack.Region = new SimStatsPacket.RegionBlock(); + pack.Region.RegionX = stats.RegionX; + pack.Region.RegionY = stats.RegionY; + pack.Region.RegionFlags = stats.RegionFlags; + pack.Region.ObjectCapacity = stats.ObjectCapacity; + //pack.Region = //stats.RegionBlock; + pack.Stat = stats.StatsBlock; + pack.Header.Reliable = false; + + // note that we are inside the reporter lock when called + DateTime now = DateTime.Now; + + // hide some time information into the packet + pack.Header.Sequence = (uint)now.Ticks; + + lock (m_statLockObject) // m_statLog is shared so make sure there is only executer here + { + try + { + if (m_statLog == null || now > m_statLog.StartTime + m_statLogPeriod) + { + // First log file or time has expired, start writing to a new log file + if (m_statLog != null && m_statLog.Log != null) + { + m_statLog.Log.Close(); + } + m_statLog = new StatLogger(); + m_statLog.StartTime = now; + m_statLog.Path = (m_statsDir.Length > 0 ? m_statsDir + System.IO.Path.DirectorySeparatorChar.ToString() : "") + + String.Format("stats-{0}.log", now.ToString("yyyyMMddHHmmss")); + m_statLog.Log = new BinaryWriter(File.Open(m_statLog.Path, FileMode.Append, FileAccess.Write)); + } + + // Write the serialized data to disk + if (m_statLog != null && m_statLog.Log != null) + m_statLog.Log.Write(pack.ToBytes()); + } + catch (Exception ex) + { + m_log.Error("statistics gathering failed: " + ex.Message, ex); + if (m_statLog != null && m_statLog.Log != null) + { + m_statLog.Log.Close(); + } + m_statLog = null; + } + } + return; + } + } +} -- cgit v1.1 From 8acb401a1455430336c41ac9becb0c16390612f0 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 13 Aug 2010 23:28:28 +0100 Subject: minor: remove mono compiler warnings --- .../EntityTransfer/EntityTransferModule.cs | 26 ++++++++-------- .../Framework/InventoryAccess/HGAssetMapper.cs | 2 +- .../InventoryAccess/HGInventoryAccessModule.cs | 4 +-- .../CoreModules/Framework/Library/LibraryModule.cs | 16 +++++----- .../InterGrid/OpenGridProtocolModule.cs | 35 +++++++++++----------- .../Inventory/RemoteInventoryServiceConnector.cs | 5 ++-- .../Inventory/RemoteXInventoryServiceConnector.cs | 5 ++-- .../CoreModules/World/Land/LandManagementModule.cs | 12 ++++---- .../World/Objects/BuySell/BuySellModule.cs | 2 +- .../CoreModules/World/WorldMap/MapSearchModule.cs | 18 +++++------ 10 files changed, 62 insertions(+), 63 deletions(-) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index ab1cfc3..364d340 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) Contributors, http://opensimulator.org/ * See CONTRIBUTORS.TXT for a full list of copyright holders. * @@ -1265,18 +1265,18 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer return handles; } - private void Dump(string msg, List handles) - { - m_log.InfoFormat("-------------- HANDLE DUMP ({0}) ---------", msg); - foreach (ulong handle in handles) - { - uint x, y; - Utils.LongToUInts(handle, out x, out y); - x = x / Constants.RegionSize; - y = y / Constants.RegionSize; - m_log.InfoFormat("({0}, {1})", x, y); - } - } +// private void Dump(string msg, List handles) +// { +// m_log.InfoFormat("-------------- HANDLE DUMP ({0}) ---------", msg); +// foreach (ulong handle in handles) +// { +// uint x, y; +// Utils.LongToUInts(handle, out x, out y); +// x = x / Constants.RegionSize; +// y = y / Constants.RegionSize; +// m_log.InfoFormat("({0}, {1})", x, y); +// } +// } #endregion diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs index b13b9d8..ccb892e 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs @@ -95,7 +95,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess try { asset1.ID = url + "/" + asset.ID; - UUID temp = UUID.Zero; +// UUID temp = UUID.Zero; // TODO: if the creator is local, stick this grid's URL in front //if (UUID.TryParse(asset.Metadata.CreatorID, out temp)) // asset1.Metadata.CreatorID = ??? + "/" + asset.Metadata.CreatorID; diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs index 8ccc941..c673b31 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) Contributors, http://opensimulator.org/ * See CONTRIBUTORS.TXT for a full list of copyright holders. * @@ -54,7 +54,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess get { return m_assMapper; } } - private bool m_Initialized = false; +// private bool m_Initialized = false; #region INonSharedRegionModule diff --git a/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs b/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs index 9c20d68..d570608 100644 --- a/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs +++ b/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs @@ -51,7 +51,7 @@ namespace OpenSim.Region.CoreModules.Framework.Library private static bool m_HasRunOnce = false; private bool m_Enabled = false; - private string m_LibraryName = "OpenSim Library"; +// private string m_LibraryName = "OpenSim Library"; private Scene m_Scene; private ILibraryService m_Library; @@ -212,13 +212,13 @@ namespace OpenSim.Region.CoreModules.Framework.Library } } - private void DumpLibrary() - { - InventoryFolderImpl lib = m_Library.LibraryRootFolder; - - m_log.DebugFormat(" - folder {0}", lib.Name); - DumpFolder(lib); - } +// private void DumpLibrary() +// { +// InventoryFolderImpl lib = m_Library.LibraryRootFolder; +// +// m_log.DebugFormat(" - folder {0}", lib.Name); +// DumpFolder(lib); +// } // // private void DumpLibrary() // { diff --git a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs index e95d2f8..87a0a8d 100644 --- a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs +++ b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs @@ -91,7 +91,7 @@ namespace OpenSim.Region.CoreModules.InterGrid private string httpsCN = ""; private bool httpSSL = false; private uint httpsslport = 0; - private bool GridMode = false; +// private bool GridMode = false; #region IRegionModule Members @@ -126,10 +126,10 @@ namespace OpenSim.Region.CoreModules.InterGrid } - if (startupcfg != null) - { - GridMode = enabled = startupcfg.GetBoolean("gridmode", false); - } +// if (startupcfg != null) +// { +// GridMode = enabled = startupcfg.GetBoolean("gridmode", false); +// } if (cfg != null) { @@ -1213,18 +1213,19 @@ namespace OpenSim.Region.CoreModules.InterGrid } } - private string CreateRandomStr(int len) - { - Random rnd = new Random(Environment.TickCount); - string returnstring = ""; - string chars = "abcdefghijklmnopqrstuvwxyz0123456789"; - - for (int i = 0; i < len; i++) - { - returnstring += chars.Substring(rnd.Next(chars.Length), 1); - } - return returnstring; - } +// private string CreateRandomStr(int len) +// { +// Random rnd = new Random(Environment.TickCount); +// string returnstring = ""; +// string chars = "abcdefghijklmnopqrstuvwxyz0123456789"; +// +// for (int i = 0; i < len; i++) +// { +// returnstring += chars.Substring(rnd.Next(chars.Length), 1); +// } +// return returnstring; +// } + // Temporary hack to allow teleporting to and from Vaak private static bool customXertificateValidation(object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors error) { diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs index aa3b30d..153aeec 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs @@ -32,7 +32,6 @@ 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; @@ -48,7 +47,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory private bool m_Enabled = false; private bool m_Initialized = false; - private Scene m_Scene; +// private Scene m_Scene; private InventoryServicesConnector m_RemoteConnector; public Type ReplaceableInterface @@ -105,7 +104,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory public void AddRegion(Scene scene) { - m_Scene = scene; +// m_Scene = scene; //m_log.Debug("[XXXX] Adding scene " + m_Scene.RegionInfo.RegionName); if (!m_Enabled) diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs index 277060d..ada26cc 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs @@ -32,7 +32,6 @@ 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; @@ -48,7 +47,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory private bool m_Enabled = false; private bool m_Initialized = false; - private Scene m_Scene; +// private Scene m_Scene; private XInventoryServicesConnector m_RemoteConnector; public Type ReplaceableInterface @@ -109,7 +108,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory public void AddRegion(Scene scene) { - m_Scene = scene; +// m_Scene = scene; //m_log.Debug("[XXXX] Adding scene " + m_Scene.RegionInfo.RegionName); if (!m_Enabled) diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 31aa017..15dc301 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -139,12 +139,12 @@ namespace OpenSim.Region.CoreModules.World.Land { } - private bool OnVerifyUserConnection(ScenePresence scenePresence, out string reason) - { - ILandObject nearestParcel = m_scene.GetNearestAllowedParcel(scenePresence.UUID, scenePresence.AbsolutePosition.X, scenePresence.AbsolutePosition.Y); - reason = "You are not allowed to enter this sim."; - return nearestParcel != null; - } +// private bool OnVerifyUserConnection(ScenePresence scenePresence, out string reason) +// { +// ILandObject nearestParcel = m_scene.GetNearestAllowedParcel(scenePresence.UUID, scenePresence.AbsolutePosition.X, scenePresence.AbsolutePosition.Y); +// reason = "You are not allowed to enter this sim."; +// return nearestParcel != null; +// } void EventManagerOnNewClient(IClientAPI client) { diff --git a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs index b0ddd8f..62abd4c 100644 --- a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs +++ b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs @@ -44,7 +44,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "BuySellModule")] public class BuySellModule : IBuySellModule, INonSharedRegionModule { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); +// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); protected Scene m_scene = null; protected IDialogModule m_dialogModule; diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs index a1a4f9e..9f88517 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs @@ -138,14 +138,14 @@ namespace OpenSim.Region.CoreModules.World.WorldMap remoteClient.SendMapBlock(blocks, 2); } - private Scene GetClientScene(IClientAPI client) - { - foreach (Scene s in m_scenes) - { - if (client.Scene.RegionInfo.RegionHandle == s.RegionInfo.RegionHandle) - return s; - } - return m_scene; - } +// private Scene GetClientScene(IClientAPI client) +// { +// foreach (Scene s in m_scenes) +// { +// if (client.Scene.RegionInfo.RegionHandle == s.RegionInfo.RegionHandle) +// return s; +// } +// return m_scene; +// } } } -- cgit v1.1 From 1463691cb6d022efbb2a0c5742a032f03a940cee Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 14 Aug 2010 00:48:12 +0100 Subject: In EventQueueHelper.uintToByteArray, fetch big end-ian bytes directly from libomv rather than little endian then swapping This avoids a problem with failing to swap on big-endian machines. This addresses http://opensimulator.org/mantis/view.php?id=4849 Thanks to Valy- for pointing this out and submitting a suggestion patch --- .../CoreModules/Framework/EventQueue/EventQueueHelper.cs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs index efa60bb..53a2a7d 100644 --- a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs +++ b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs @@ -54,12 +54,10 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue } private static byte[] uintToByteArray(uint uIntValue) - { - byte[] resultbytes = Utils.UIntToBytes(uIntValue); - if (BitConverter.IsLittleEndian) - Array.Reverse(resultbytes); - - return resultbytes; + { + byte[] result = new byte[4]; + Utils.UIntToBytesBig(uIntValue, result, 0); + return result; } public static OSD buildEvent(string eventName, OSD eventBody) -- cgit v1.1 From 5d29c0ec9d917c9edd251f8bf171c44e6922c4cf Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 15 Aug 2010 18:10:54 -0700 Subject: Addresses mantis #4929. Agent was being logged off the grid too soon -- things may still fail. --- .../Framework/EntityTransfer/EntityTransferModule.cs | 15 +++++++++++++-- .../Framework/EntityTransfer/HGEntityTransferModule.cs | 14 ++++++++++---- 2 files changed, 23 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 364d340..607219e 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -307,7 +307,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer string reason = String.Empty; // Let's create an agent there if one doesn't exist yet. - if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason)) + bool logout = false; + if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout)) { sp.ControllingClient.SendTeleportFailed(String.Format("Destination refused: {0}", reason)); @@ -434,8 +435,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it CrossAttachmentsIntoNewRegion(finalDestination, sp, true); + // Well, this is it. The agent is over there. + KillEntity(sp.Scene, sp.LocalId); + // May need to logout or other cleanup + AgentHasMovedAway(sp.ControllingClient.SessionId, logout); + // Now let's make it officially a child agent sp.MakeChildAgent(); @@ -483,8 +489,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer } - protected virtual bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason) + protected virtual bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout) { + logout = false; return m_aScene.SimulationService.CreateAgent(finalDestination, agentCircuit, teleportFlags, out reason); } @@ -500,6 +507,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer } + protected virtual void AgentHasMovedAway(UUID sessionID, bool logout) + { + } + protected void KillEntity(Scene scene, uint localID) { scene.SendKillObject(localID); diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index 7d26e3f..d49d18d 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs @@ -140,9 +140,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer return false; } - protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason) + protected override void AgentHasMovedAway(UUID sessionID, bool logout) + { + if (logout) + // Log them out of this grid + m_aScene.PresenceService.LogoutAgent(sessionID); + } + + protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout) { reason = string.Empty; + logout = false; int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, reg.RegionID); if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) { @@ -152,9 +160,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer string userAgentDriver = agentCircuit.ServiceURLs["HomeURI"].ToString(); IUserAgentService connector = new UserAgentServiceConnector(userAgentDriver); bool success = connector.LoginAgentToGrid(agentCircuit, reg, finalDestination, out reason); - if (success) - // Log them out of this grid - m_aScene.PresenceService.LogoutAgent(agentCircuit.SessionID); + logout = success; return success; } -- cgit v1.1 From a5044e08fb3f42588c5a64013a57120cbd9de3e3 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 15 Aug 2010 18:13:09 -0700 Subject: Better comment (related to previous commit) --- .../CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index d49d18d..1ac7508 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs @@ -160,7 +160,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer string userAgentDriver = agentCircuit.ServiceURLs["HomeURI"].ToString(); IUserAgentService connector = new UserAgentServiceConnector(userAgentDriver); bool success = connector.LoginAgentToGrid(agentCircuit, reg, finalDestination, out reason); - logout = success; + logout = success; // flag for later logout from this grid; this is an HG TP return success; } -- cgit v1.1 From 77de28965ae5fc6de3c60a28ce7d4e59643a2a70 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 16 Aug 2010 11:33:59 -0700 Subject: Work on TeleportStart: renamed method from TeleportLocationStart to TeleportStart, and now sending this upon all teleports, not just some, and in the right place (EntityTransferModule). --- .../Framework/EntityTransfer/EntityTransferModule.cs | 10 ++++------ .../Region/CoreModules/World/Estate/EstateManagementModule.cs | 3 --- 2 files changed, 4 insertions(+), 9 deletions(-) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 607219e..751d49a 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -174,9 +174,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer position.Z = newPosZ; } - // Only send this if the event queue is null - if (eq == null) - sp.ControllingClient.SendTeleportLocationStart(); + sp.ControllingClient.SendTeleportStart(teleportFlags); sp.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags); sp.Teleport(position); @@ -257,9 +255,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer ulong destinationHandle = finalDestination.RegionHandle; - if (eq == null) - sp.ControllingClient.SendTeleportLocationStart(); - // Let's do DNS resolution only once in this process, please! // This may be a costly operation. The reg.ExternalEndPoint field is not a passive field, // it's actually doing a lot of work. @@ -277,6 +272,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer return; } + sp.ControllingClient.SendTeleportStart(teleportFlags); + // the avatar.Close below will clear the child region list. We need this below for (possibly) // closing the child agents, so save it here (we need a copy as it is Clear()-ed). //List childRegions = new List(avatar.GetKnownRegionList()); @@ -320,6 +317,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer if (NeedsNewAgent(oldRegionX, newRegionX, oldRegionY, newRegionY)) { + #region IP Translation for NAT IClientIPEndpoint ipepClient; if (sp.ClientView.TryGet(out ipepClient)) diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 940b535..51f2c41 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -343,7 +343,6 @@ namespace OpenSim.Region.CoreModules.World.Estate { if (!s.IsChildAgent) { - s.ControllingClient.SendTeleportLocationStart(); m_scene.TeleportClientHome(user, s.ControllingClient); } } @@ -478,7 +477,6 @@ namespace OpenSim.Region.CoreModules.World.Estate ScenePresence s = m_scene.GetScenePresence(prey); if (s != null) { - s.ControllingClient.SendTeleportLocationStart(); m_scene.TeleportClientHome(prey, s.ControllingClient); } } @@ -498,7 +496,6 @@ namespace OpenSim.Region.CoreModules.World.Estate // Also make sure they are actually in the region if (p != null && !p.IsChildAgent) { - p.ControllingClient.SendTeleportLocationStart(); m_scene.TeleportClientHome(p.UUID, p.ControllingClient); } } -- cgit v1.1 From 69ad04cdf6ca899877a38fd4f9248f4107e3a7ce Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 16 Aug 2010 12:03:13 -0700 Subject: Attempt at sending TeleportProgress, but it doesn't seem to be doing anything at all. Left it commented, just as a reminder for where those messages could be sent. --- .../CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 751d49a..bb98dba 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -317,6 +317,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer if (NeedsNewAgent(oldRegionX, newRegionX, oldRegionY, newRegionY)) { + //sp.ControllingClient.SendTeleportProgress(teleportFlags, "Creating agent..."); #region IP Translation for NAT IClientIPEndpoint ipepClient; @@ -395,6 +396,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer agent.Position = position; SetCallbackURL(agent, sp.Scene.RegionInfo); + //sp.ControllingClient.SendTeleportProgress(teleportFlags, "Updating agent..."); + if (!UpdateAgent(reg, finalDestination, agent)) { // Region doesn't take it -- cgit v1.1 From a8c0b131f9aa62d4b6260fd37f89014e55b457cf Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Tue, 17 Aug 2010 13:50:04 -0700 Subject: * Changed a few OSD.FromBinary() calls to the more accurate OSD.FromULong() to fix the build --- OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs index 53a2a7d..e9bcae3 100644 --- a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs +++ b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs @@ -158,7 +158,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue info.Add("SimAccess", OSD.FromInteger(simAccess)); info.Add("SimIP", OSD.FromBinary(regionExternalEndPoint.Address.GetAddressBytes())); info.Add("SimPort", OSD.FromInteger(regionExternalEndPoint.Port)); - info.Add("TeleportFlags", OSD.FromBinary(1L << 4)); // AgentManager.TeleportFlags.ViaLocation + info.Add("TeleportFlags", OSD.FromULong(1L << 4)); // AgentManager.TeleportFlags.ViaLocation OSDArray infoArr = new OSDArray(); infoArr.Add(info); -- cgit v1.1