From cd321ec4d2f1f7834fb52a6e7d0a853600d8a612 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 14 Oct 2009 19:15:11 -0700 Subject: [PATCH 1/4] Moved some code up to AddRegion, so that other modules that depend on it don't crash. This code needs to be removed as soon as user services is refactored. --- .../ServiceConnectorsOut/Grid/HGGridConnector.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs index 1422addce0..046bee5b63 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs @@ -154,6 +154,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid ((ISharedRegionModule)m_GridServiceConnector).AddRegion(scene); + // Yikes!! Remove this as soon as user services get refactored + LocalAssetServerURI = scene.CommsManager.NetworkServersInfo.UserURL; + LocalInventoryServerURI = scene.CommsManager.NetworkServersInfo.InventoryURL; + LocalUserServerURI = scene.CommsManager.NetworkServersInfo.UserURL; + HGNetworkServersInfo.Init(LocalAssetServerURI, LocalInventoryServerURI, LocalUserServerURI); + } public void RemoveRegion(Scene scene) @@ -173,9 +179,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid if (!m_Initialized) { m_aScene = scene; - LocalAssetServerURI = m_aScene.CommsManager.NetworkServersInfo.UserURL; - LocalInventoryServerURI = m_aScene.CommsManager.NetworkServersInfo.InventoryURL; - LocalUserServerURI = m_aScene.CommsManager.NetworkServersInfo.UserURL; m_HypergridServiceConnector = new HypergridServiceConnector(scene.AssetService); @@ -189,9 +192,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid MainConsole.Instance.Commands.AddCommand("HGGridServicesConnector", false, "link-mapping", "link-mapping [ ] ", "Set local coordinate to map HG regions to", hgCommands.RunCommand); - // Yikes!! Remove this as soon as user services get refactored - HGNetworkServersInfo.Init(LocalAssetServerURI, LocalInventoryServerURI, LocalUserServerURI); - m_Initialized = true; } } From 4790f8576c868ac92b5f2c9e96e1f8629af09d4d Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Wed, 14 Oct 2009 19:23:44 -0700 Subject: [PATCH 2/4] * Replaced (possibly broken?) math for calculating the unix timestamp in MySQLAssetData with Utils.DateTimeToUnixTime() * Disabled UpdateAccessTime() function since it was only writing zeros anyways. This gave me a significant performance improvement for startup times and avatar logins in standalone mode * Load attachments asynchronously so avatars with lots of attachments don't have to race the timeout clock to login --- OpenSim/Data/MySQL/MySQLAssetData.cs | 10 +++++----- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 6 +++--- OpenSim/Region/Framework/Scenes/Scene.cs | 2 +- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 5 +++-- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs index 259e186629..fc05d1d45d 100644 --- a/OpenSim/Data/MySQL/MySQLAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLAssetData.cs @@ -44,7 +44,6 @@ namespace OpenSim.Data.MySQL private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private MySQLManager _dbConnection; - private long TicksToEpoch; #region IPlugin Members @@ -61,8 +60,6 @@ namespace OpenSim.Data.MySQL /// connect string override public void Initialise(string connect) { - TicksToEpoch = new DateTime(1970,1,1).Ticks; - // TODO: This will let you pass in the connect string in // the config, though someone will need to write that. if (connect == String.Empty) @@ -223,7 +220,7 @@ namespace OpenSim.Data.MySQL using (cmd) { // create unix epoch time - int now = (int)((DateTime.Now.Ticks - TicksToEpoch) / 10000000); + int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow); cmd.Parameters.AddWithValue("?id", asset.ID); cmd.Parameters.AddWithValue("?name", assetName); cmd.Parameters.AddWithValue("?description", assetDescription); @@ -248,6 +245,9 @@ namespace OpenSim.Data.MySQL private void UpdateAccessTime(AssetBase asset) { + // Writing to the database every time Get() is called on an asset is killing us. Seriously. -jph + return; + lock (_dbConnection) { _dbConnection.CheckConnection(); @@ -262,7 +262,7 @@ namespace OpenSim.Data.MySQL using (cmd) { // create unix epoch time - int now = (int)((DateTime.Now.Ticks - TicksToEpoch) / 10000000); + int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow); cmd.Parameters.AddWithValue("?id", asset.ID); cmd.Parameters.AddWithValue("?access_time", now); cmd.ExecuteNonQuery(); diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 0cb56822ed..c44c4c7940 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -2402,11 +2402,11 @@ namespace OpenSim.Region.Framework.Scenes InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); item = InventoryService.GetItem(item); presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/); - IAvatarFactory ava = RequestModuleInterface(); - if (ava != null) + + if (m_AvatarFactory != null) { m_log.InfoFormat("[SCENE INVENTORY]: Saving avatar attachment. AgentID:{0} ItemID:{1} AttachmentPoint:{2}", remoteClient.AgentId, itemID, AttachmentPt); - ava.UpdateDatabase(remoteClient.AgentId, presence.Appearance); + m_AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); } } } diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 14e4534d97..d3d397dde2 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2481,7 +2481,7 @@ namespace OpenSim.Region.Framework.Scenes if (aCircuit == null || aCircuit.child == false) { sp.IsChildAgent = false; - sp.RezAttachments(); + Util.FireAndForget(delegate(object o) { sp.RezAttachments(); }); } } diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 15fb11f19b..2a06f9eb9a 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3841,6 +3841,9 @@ namespace OpenSim.Region.Framework.Scenes List attPoints = m_appearance.GetAttachedPoints(); foreach (int p in attPoints) { + if (m_isDeleted) + return; + UUID itemID = m_appearance.GetAttachedItem(p); UUID assetID = m_appearance.GetAttachedAsset(p); @@ -3866,9 +3869,7 @@ namespace OpenSim.Region.Framework.Scenes { m_log.ErrorFormat("[ATTACHMENT]: Unable to rez attachment: {0}", e.ToString()); } - } - } } } From 6d3d985511a8e70624c3a06a042890002f223978 Mon Sep 17 00:00:00 2001 From: "Teravus Ovares (Dan Olivares)" Date: Thu, 15 Oct 2009 02:01:29 -0400 Subject: [PATCH 3/4] * Request from lkalif to have the Sim send a coarselocationupdate for each avatar in the sim, including yourself. * Apparently the LLClientView should have been doing this previously.. Also fixed the 'You' on the index block.. so the client doesn't display an extra green dot. * Thanks lkalif for bringing it to our attention. --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 7 +++++-- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 7 ++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 8487adc7f5..4b27fa26bd 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -3289,11 +3289,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP new CoarseLocationUpdatePacket.IndexBlock(); loc.Location = new CoarseLocationUpdatePacket.LocationBlock[total]; loc.AgentData = new CoarseLocationUpdatePacket.AgentDataBlock[total]; - + int selfindex = -1; for (int i = 0; i < total; i++) { CoarseLocationUpdatePacket.LocationBlock lb = new CoarseLocationUpdatePacket.LocationBlock(); + lb.X = (byte)CoarseLocations[i].X; lb.Y = (byte)CoarseLocations[i].Y; @@ -3301,8 +3302,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP loc.Location[i] = lb; loc.AgentData[i] = new CoarseLocationUpdatePacket.AgentDataBlock(); loc.AgentData[i].AgentID = users[i]; + if (users[i] == AgentId) + selfindex = i; } - ib.You = -1; + ib.You = (short)selfindex; ib.Prey = -1; loc.Index = ib; loc.Header.Reliable = false; diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 2a06f9eb9a..646a4831ec 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2507,8 +2507,9 @@ namespace OpenSim.Region.Framework.Scenes List avatars = m_scene.GetAvatars(); for (int i = 0; i < avatars.Count; i++) { - if (avatars[i] != this) - { + // Requested by LibOMV. Send Course Location on self. + //if (avatars[i] != this) + //{ if (avatars[i].ParentID != 0) { // sitting avatar @@ -2530,7 +2531,7 @@ namespace OpenSim.Region.Framework.Scenes CoarseLocations.Add(avatars[i].m_pos); AvatarUUIDs.Add(avatars[i].UUID); } - } + //} } m_controllingClient.SendCoarseLocationUpdate(AvatarUUIDs, CoarseLocations); From 9ddf598e543c7a72241d3194c448fc484bcb3fe2 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Thu, 15 Oct 2009 18:54:05 +0100 Subject: [PATCH 4/4] minor: Change commented out authentication service realm setting to "users" to match defaults in code --- bin/OpenSim.Server.ini.example | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/OpenSim.Server.ini.example b/bin/OpenSim.Server.ini.example index 635ba1ebec..f3d222f446 100644 --- a/bin/OpenSim.Server.ini.example +++ b/bin/OpenSim.Server.ini.example @@ -58,7 +58,7 @@ LocalServiceModule = "OpenSim.Services.FreeswitchService.dll:FreeswitchService" AuthenticationServiceModule = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService" StorageProvider = "OpenSim.Data.MySQL.dll" ConnectionString = "Data Source=localhost;Database=grid;User ID=grid;Password=grid;" -; Realm = "auth" +; Realm = "users" ; * This is the new style user service. ; * "Realm" is the table that is used for user lookup. @@ -75,7 +75,7 @@ ConnectionString = "Data Source=localhost;Database=grid;User ID=grid;Password=gr ; * It defaults to "regions", which uses the legacy tables ; * [GridService] - LocalServiceModule = "OpenSim.Services.GridService.dll:GridService" - StorageProvider = "OpenSim.Data.MySQL.dll:MySqlRegionData" - ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=grid;" - Realm = "regions" +LocalServiceModule = "OpenSim.Services.GridService.dll:GridService" +StorageProvider = "OpenSim.Data.MySQL.dll:MySqlRegionData" +ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=grid;" +Realm = "regions"