aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJohn Hurliman2009-10-14 19:23:44 -0700
committerJohn Hurliman2009-10-14 19:23:44 -0700
commit4790f8576c868ac92b5f2c9e96e1f8629af09d4d (patch)
tree4ab16c12752676c1c5e863c6cbdc45652ad93949 /OpenSim
parentMerge branch 'htb-throttle' of ssh://opensimulator.org/var/git/opensim into h... (diff)
downloadopensim-SC_OLD-4790f8576c868ac92b5f2c9e96e1f8629af09d4d.zip
opensim-SC_OLD-4790f8576c868ac92b5f2c9e96e1f8629af09d4d.tar.gz
opensim-SC_OLD-4790f8576c868ac92b5f2c9e96e1f8629af09d4d.tar.bz2
opensim-SC_OLD-4790f8576c868ac92b5f2c9e96e1f8629af09d4d.tar.xz
* 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
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Data/MySQL/MySQLAssetData.cs10
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs5
4 files changed, 12 insertions, 11 deletions
diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs
index 259e186..fc05d1d 100644
--- a/OpenSim/Data/MySQL/MySQLAssetData.cs
+++ b/OpenSim/Data/MySQL/MySQLAssetData.cs
@@ -44,7 +44,6 @@ namespace OpenSim.Data.MySQL
44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45 45
46 private MySQLManager _dbConnection; 46 private MySQLManager _dbConnection;
47 private long TicksToEpoch;
48 47
49 #region IPlugin Members 48 #region IPlugin Members
50 49
@@ -61,8 +60,6 @@ namespace OpenSim.Data.MySQL
61 /// <param name="connect">connect string</param> 60 /// <param name="connect">connect string</param>
62 override public void Initialise(string connect) 61 override public void Initialise(string connect)
63 { 62 {
64 TicksToEpoch = new DateTime(1970,1,1).Ticks;
65
66 // TODO: This will let you pass in the connect string in 63 // TODO: This will let you pass in the connect string in
67 // the config, though someone will need to write that. 64 // the config, though someone will need to write that.
68 if (connect == String.Empty) 65 if (connect == String.Empty)
@@ -223,7 +220,7 @@ namespace OpenSim.Data.MySQL
223 using (cmd) 220 using (cmd)
224 { 221 {
225 // create unix epoch time 222 // create unix epoch time
226 int now = (int)((DateTime.Now.Ticks - TicksToEpoch) / 10000000); 223 int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow);
227 cmd.Parameters.AddWithValue("?id", asset.ID); 224 cmd.Parameters.AddWithValue("?id", asset.ID);
228 cmd.Parameters.AddWithValue("?name", assetName); 225 cmd.Parameters.AddWithValue("?name", assetName);
229 cmd.Parameters.AddWithValue("?description", assetDescription); 226 cmd.Parameters.AddWithValue("?description", assetDescription);
@@ -248,6 +245,9 @@ namespace OpenSim.Data.MySQL
248 245
249 private void UpdateAccessTime(AssetBase asset) 246 private void UpdateAccessTime(AssetBase asset)
250 { 247 {
248 // Writing to the database every time Get() is called on an asset is killing us. Seriously. -jph
249 return;
250
251 lock (_dbConnection) 251 lock (_dbConnection)
252 { 252 {
253 _dbConnection.CheckConnection(); 253 _dbConnection.CheckConnection();
@@ -262,7 +262,7 @@ namespace OpenSim.Data.MySQL
262 using (cmd) 262 using (cmd)
263 { 263 {
264 // create unix epoch time 264 // create unix epoch time
265 int now = (int)((DateTime.Now.Ticks - TicksToEpoch) / 10000000); 265 int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow);
266 cmd.Parameters.AddWithValue("?id", asset.ID); 266 cmd.Parameters.AddWithValue("?id", asset.ID);
267 cmd.Parameters.AddWithValue("?access_time", now); 267 cmd.Parameters.AddWithValue("?access_time", now);
268 cmd.ExecuteNonQuery(); 268 cmd.ExecuteNonQuery();
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 0cb5682..c44c4c7 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
2402 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); 2402 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
2403 item = InventoryService.GetItem(item); 2403 item = InventoryService.GetItem(item);
2404 presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/); 2404 presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/);
2405 IAvatarFactory ava = RequestModuleInterface<IAvatarFactory>(); 2405
2406 if (ava != null) 2406 if (m_AvatarFactory != null)
2407 { 2407 {
2408 m_log.InfoFormat("[SCENE INVENTORY]: Saving avatar attachment. AgentID:{0} ItemID:{1} AttachmentPoint:{2}", remoteClient.AgentId, itemID, AttachmentPt); 2408 m_log.InfoFormat("[SCENE INVENTORY]: Saving avatar attachment. AgentID:{0} ItemID:{1} AttachmentPoint:{2}", remoteClient.AgentId, itemID, AttachmentPt);
2409 ava.UpdateDatabase(remoteClient.AgentId, presence.Appearance); 2409 m_AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance);
2410 } 2410 }
2411 } 2411 }
2412 } 2412 }
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 14e4534..d3d397d 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2481,7 +2481,7 @@ namespace OpenSim.Region.Framework.Scenes
2481 if (aCircuit == null || aCircuit.child == false) 2481 if (aCircuit == null || aCircuit.child == false)
2482 { 2482 {
2483 sp.IsChildAgent = false; 2483 sp.IsChildAgent = false;
2484 sp.RezAttachments(); 2484 Util.FireAndForget(delegate(object o) { sp.RezAttachments(); });
2485 } 2485 }
2486 } 2486 }
2487 2487
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 15fb11f..2a06f9e 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -3841,6 +3841,9 @@ namespace OpenSim.Region.Framework.Scenes
3841 List<int> attPoints = m_appearance.GetAttachedPoints(); 3841 List<int> attPoints = m_appearance.GetAttachedPoints();
3842 foreach (int p in attPoints) 3842 foreach (int p in attPoints)
3843 { 3843 {
3844 if (m_isDeleted)
3845 return;
3846
3844 UUID itemID = m_appearance.GetAttachedItem(p); 3847 UUID itemID = m_appearance.GetAttachedItem(p);
3845 UUID assetID = m_appearance.GetAttachedAsset(p); 3848 UUID assetID = m_appearance.GetAttachedAsset(p);
3846 3849
@@ -3866,9 +3869,7 @@ namespace OpenSim.Region.Framework.Scenes
3866 { 3869 {
3867 m_log.ErrorFormat("[ATTACHMENT]: Unable to rez attachment: {0}", e.ToString()); 3870 m_log.ErrorFormat("[ATTACHMENT]: Unable to rez attachment: {0}", e.ToString());
3868 } 3871 }
3869
3870 } 3872 }
3871
3872 } 3873 }
3873 } 3874 }
3874} 3875}