diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLXAssetData.cs | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/OpenSim/Data/MySQL/MySQLXAssetData.cs b/OpenSim/Data/MySQL/MySQLXAssetData.cs index 0aff618..4cb89fa 100644 --- a/OpenSim/Data/MySQL/MySQLXAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLXAssetData.cs | |||
@@ -31,6 +31,7 @@ using System.Data; | |||
31 | using System.IO; | 31 | using System.IO; |
32 | using System.IO.Compression; | 32 | using System.IO.Compression; |
33 | using System.Reflection; | 33 | using System.Reflection; |
34 | using System.Security.Cryptography; | ||
34 | using System.Text; | 35 | using System.Text; |
35 | using log4net; | 36 | using log4net; |
36 | using MySql.Data.MySqlClient; | 37 | using MySql.Data.MySqlClient; |
@@ -44,15 +45,20 @@ namespace OpenSim.Data.MySQL | |||
44 | { | 45 | { |
45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
46 | 47 | ||
47 | private bool m_enableCompression = false; | ||
48 | private string m_connectionString; | ||
49 | private object m_dbLock = new object(); | ||
50 | |||
51 | protected virtual Assembly Assembly | 48 | protected virtual Assembly Assembly |
52 | { | 49 | { |
53 | get { return GetType().Assembly; } | 50 | get { return GetType().Assembly; } |
54 | } | 51 | } |
55 | 52 | ||
53 | private bool m_enableCompression = false; | ||
54 | private string m_connectionString; | ||
55 | private object m_dbLock = new object(); | ||
56 | |||
57 | /// <summary> | ||
58 | /// We can reuse this for all hashing since all methods are single-threaded through m_dbBLock | ||
59 | /// </summary> | ||
60 | private HashAlgorithm hasher = new SHA256CryptoServiceProvider(); | ||
61 | |||
56 | #region IPlugin Members | 62 | #region IPlugin Members |
57 | 63 | ||
58 | public override string Version { get { return "1.0.0.0"; } } | 64 | public override string Version { get { return "1.0.0.0"; } } |
@@ -213,7 +219,7 @@ namespace OpenSim.Data.MySQL | |||
213 | } | 219 | } |
214 | } | 220 | } |
215 | 221 | ||
216 | string hash = Util.SHA1Hash(asset.Data); | 222 | byte[] hash = hasher.ComputeHash(asset.Data); |
217 | 223 | ||
218 | // m_log.DebugFormat( | 224 | // m_log.DebugFormat( |
219 | // "[XASSET DB]: Compressed data size for {0} {1}, hash {2} is {3}", | 225 | // "[XASSET DB]: Compressed data size for {0} {1}, hash {2} is {3}", |
@@ -328,7 +334,7 @@ namespace OpenSim.Data.MySQL | |||
328 | /// <param name="transaction"></param> | 334 | /// <param name="transaction"></param> |
329 | /// <param name="hash"></param> | 335 | /// <param name="hash"></param> |
330 | /// <returns></returns> | 336 | /// <returns></returns> |
331 | private bool ExistsData(MySqlConnection dbcon, MySqlTransaction transaction, string hash) | 337 | private bool ExistsData(MySqlConnection dbcon, MySqlTransaction transaction, byte[] hash) |
332 | { | 338 | { |
333 | // m_log.DebugFormat("[ASSETS DB]: Checking for asset {0}", uuid); | 339 | // m_log.DebugFormat("[ASSETS DB]: Checking for asset {0}", uuid); |
334 | 340 | ||
@@ -438,7 +444,9 @@ namespace OpenSim.Data.MySQL | |||
438 | metadata.Flags = (AssetFlags)Convert.ToInt32(dbReader["asset_flags"]); | 444 | metadata.Flags = (AssetFlags)Convert.ToInt32(dbReader["asset_flags"]); |
439 | metadata.FullID = DBGuid.FromDB(dbReader["id"]); | 445 | metadata.FullID = DBGuid.FromDB(dbReader["id"]); |
440 | metadata.CreatorID = dbReader["creator_id"].ToString(); | 446 | metadata.CreatorID = dbReader["creator_id"].ToString(); |
441 | metadata.SHA1 = Encoding.Default.GetBytes((string)dbReader["hash"]); | 447 | |
448 | // We'll ignore this for now - it appears unused! | ||
449 | // metadata.SHA1 = dbReader["hash"]); | ||
442 | 450 | ||
443 | retList.Add(metadata); | 451 | retList.Add(metadata); |
444 | } | 452 | } |