Modified hash to use long block counters
authorPanagiotis Kanavos <pkanavos@gmail.com>
Tue, 19 Jun 2012 11:25:16 +0000 (14:25 +0300)
committerPanagiotis Kanavos <pkanavos@gmail.com>
Tue, 19 Jun 2012 11:25:16 +0000 (14:25 +0300)
trunk/Pithos.Core/Agents/Uploader.cs
trunk/Pithos.Network/TreeHash.cs

index 6954ea8..ada13c8 100644 (file)
@@ -323,6 +323,7 @@ namespace Pithos.Core.Agents
                         //Find the proper block\r
                         var blockIndex = treeHash.HashDictionary[missingHash];\r
                         long offset = blockIndex*accountInfo.BlockSize;\r
+                        Debut.Assert(offset>=0,String.Format("Negative Offset! BlockIndex {0} BlockSize {1}",blockIndex,accountInfo.BlockSize));\r
 \r
                         var read = fileInfo.Read(buffer, offset, accountInfo.BlockSize);\r
 \r
index ecd26e1..b350a58 100644 (file)
@@ -147,16 +147,16 @@ namespace Pithos.Network
                 ?? (_stringHashes = Hashes.Select(hash => hash.ToHashString()).ToArray());
         }
 
-        ConcurrentDictionary<string, int> _blocks;
+        ConcurrentDictionary<string, long> _blocks;
         //Retruns the hashes as a dictionary to the block location. Used to locate blocks
-        public IDictionary<string,int> HashDictionary
+        public IDictionary<string,long> HashDictionary
         {
             get
             {
-                Func<ConcurrentDictionary<string, int>> blocksInit = () =>
+                Func<ConcurrentDictionary<string, long>> blocksInit = () =>
                 {
                     var blocks =
-                        new ConcurrentDictionary<string, int>();
+                        new ConcurrentDictionary<string, long>();
                     if (Hashes == null)
                         return blocks;