[Debtorrent-commits] r17 - in /debtorrent/trunk: ./ DebTorrent/ DebTorrent/BT1/ DebTorrent/BT1/FileSelector.py DebTorrent/BT1/StorageWrapper.py TODO

camrdale-guest at users.alioth.debian.org camrdale-guest at users.alioth.debian.org
Fri Apr 27 19:43:56 UTC 2007


Author: camrdale-guest
Date: Fri Apr 27 19:43:56 2007
New Revision: 17

URL: http://svn.debian.org/wsvn/debtorrent/?sc=1&rev=17
Log:
Fixed bug in which all pieces smaller than the last would be improperly hash checked

Added:
    debtorrent/trunk/TODO
Modified:
    debtorrent/trunk/   (props changed)
    debtorrent/trunk/DebTorrent/   (props changed)
    debtorrent/trunk/DebTorrent/BT1/   (props changed)
    debtorrent/trunk/DebTorrent/BT1/FileSelector.py
    debtorrent/trunk/DebTorrent/BT1/StorageWrapper.py

Propchange: debtorrent/trunk/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Fri Apr 27 19:43:56 2007
@@ -1,1 +1,2 @@
 tags
+*.pyc

Propchange: debtorrent/trunk/DebTorrent/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Apr 27 19:43:56 2007
@@ -1,0 +1,1 @@
+*.pyc

Propchange: debtorrent/trunk/DebTorrent/BT1/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Apr 27 19:43:56 2007
@@ -1,0 +1,1 @@
+*.pyc

Modified: debtorrent/trunk/DebTorrent/BT1/FileSelector.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/BT1/FileSelector.py?rev=17&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/BT1/FileSelector.py (original)
+++ debtorrent/trunk/DebTorrent/BT1/FileSelector.py Fri Apr 27 19:43:56 2007
@@ -10,7 +10,7 @@
     False = 0
 
 
-class FileSelector: # TODO change piece_length to piece_lengths array
+class FileSelector:
     def __init__(self, files, piece_lengths, bufferdir,
                  storage, storagewrapper, sched, failfunc):
         self.files = files

Modified: debtorrent/trunk/DebTorrent/BT1/StorageWrapper.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/BT1/StorageWrapper.py?rev=17&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/BT1/StorageWrapper.py (original)
+++ debtorrent/trunk/DebTorrent/BT1/StorageWrapper.py Fri Apr 27 19:43:56 2007
@@ -263,29 +263,30 @@
         if not self.check_hashes:
             self._markgot(i, i)
         else:
-            d1 = self.read_raw(i,0,self.lastlen)
+            d1 = self.read_raw(i,0,self._piecelen(i))
             if d1 is None:
                 return None
             sh = sha(d1[:])
             d1.release()
-            sp = sh.digest()
-            d2 = self.read_raw(i,self.lastlen,self._piecelen(i)-self.lastlen)
-            if d2 is None:
-                return None
-            sh.update(d2[:])
-            d2.release()
+#            sp = sh.digest()
+#            d2 = self.read_raw(i,self.lastlen,self._piecelen(i)-self.lastlen)
+#            if d2 is None:
+#                return None
+#            sh.update(d2[:])
+#            d2.release()
             s = sh.digest()
             if s == self.hashes[i]:
                 self._markgot(i, i)
-            elif ( self.check_targets.get(s)
-                   and self._piecelen(i) == self._piecelen(self.check_targets[s][-1]) ):
-                self._markgot(self.check_targets[s].pop(), i)
-                self.out_of_place += 1
-            elif ( not self.have[-1] and sp == self.hashes[-1]
-                   and (i == len(self.hashes) - 1
-                        or not self._waspre(len(self.hashes) - 1)) ):
-                self._markgot(len(self.hashes) - 1, i)
-                self.out_of_place += 1
+# TODO: Determine if this moving of pieces (for 'normal' allocation) is needed
+#            elif ( self.check_targets.get(s)
+#                   and self._piecelen(i) == self._piecelen(self.check_targets[s][-1]) ):
+#                self._markgot(self.check_targets[s].pop(), i)
+#                self.out_of_place += 1
+#            elif ( not self.have[-1] and sp == self.hashes[-1]
+#                   and (i == len(self.hashes) - 1
+#                        or not self._waspre(len(self.hashes) - 1)) ):
+#                self._markgot(len(self.hashes) - 1, i)
+#                self.out_of_place += 1
             else:
                 self.places[i] = i
         self.numchecked += 1
@@ -349,7 +350,7 @@
         if not self.holes:
             return False
         self.numholes = float(len(self.holes))
-        # TODO determine if this is a huge waste of memory (160MB)
+        # TODO: determine if this is a huge waste of memory (160MB)
         self.alloc_buf = chr(0xFF) * max(self.piece_sizes)
         if self.alloc_type == 'pre-allocate':
             self.bgalloc_enabled = True

Added: debtorrent/trunk/TODO
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/TODO?rev=17&op=file
==============================================================================
--- debtorrent/trunk/TODO (added)
+++ debtorrent/trunk/TODO Fri Apr 27 19:43:56 2007
@@ -1,0 +1,39 @@
+Below are some things that still need to be done, in order of priority.
+
+
+Make the --ip option work properly with DNS names
+
+Currently the ip option is not used properly to identify hosts by DNS name. It 
+is currently evaluated by the client before sending to the tracker so the 
+tracker only gets the IP address. The tracker also doesn't handle DNS well 
+though, as ip entries seem to be checked before they are put in the peers data, 
+and even if DNS are in the peers data this only results in the data not being 
+sent to the peers.
+
+
+Pre-allocating files is necessary
+
+In order for the download to work properly, the allocation method must be set to 
+pre-allocate (normal doesn't work, the others probably don't). This is due to 
+the pieces no longer being the same size, and so data cannot be moved around 
+between them like it was previously. This may not be an issue after a maximum 
+piece size is introduced, though pre-allocation may still be necessary to serve 
+downloaded files while other downloads continue. Pre-allocation will need to be 
+checked with priorities enabled, so that the entire archive does not need to be 
+pre-allocated to download a single package.
+
+
+Comments
+
+Comments are needed, both for new code, and the original. Variable naming 
+could aslo be dramatically improved. This might break merging in new upstreams 
+though (but this might already be broken).
+
+
+Statistics for the swarm are incorrect
+
+The statistics for file completion in the swarm are incorrect. This is due to 
+using the number of pieces each peer has as a measure of their completion. Since 
+some pieces are very small, and some very large, this is no longer accurate. 
+This may not need fixing though, as piece sizes will become more uniform in 
+later versions, and these statistics may not be needed.




More information about the Debtorrent-commits mailing list