r318 - in /debtorrent/trunk: DebTorrent/BT1/AptListener.py test.py

camrdale-guest at users.alioth.debian.org camrdale-guest at users.alioth.debian.org
Tue Nov 6 21:21:26 UTC 2007


Author: camrdale-guest
Date: Tue Nov  6 21:21:25 2007
New Revision: 318

URL: http://svn.debian.org/wsvn/debtorrent/?sc=1&rev=318
Log:
Send a signle Pieces-Downloaded status update only when a non-final piece is download.

Modified:
    debtorrent/trunk/DebTorrent/BT1/AptListener.py
    debtorrent/trunk/test.py

Modified: debtorrent/trunk/DebTorrent/BT1/AptListener.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/BT1/AptListener.py?rev=318&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/BT1/AptListener.py (original)
+++ debtorrent/trunk/DebTorrent/BT1/AptListener.py Tue Nov  6 21:21:25 2007
@@ -193,11 +193,12 @@
                     continue
                     
                 # Remove the downloaded pieces from the list of needed ones
+                piece_removed = False
                 for piece in list(v[3]):
                     if v[0].storagewrapper.do_I_have(piece):
                         logger.debug('queued request for file '+file+' got piece '+str(piece))
                         v[3].remove(piece)
-                        self.send_update(c, file, v[0], v[1], v[2], v[3])
+                        piece_removed = True
                         
                 # If no more pieces are needed, return the answer and remove the request
                 if not v[3]:
@@ -205,6 +206,9 @@
                     closed_conns.append((file, c))
                     v[0].storagewrapper.set_file_readonly(v[1])
                     self.answer_package(c, file, v[0], v[1], v[2])
+                # Otherwise send an update message
+                elif piece_removed:
+                    self.send_update(c, file, v[0], v[1], v[2], v[3])
 
         # Remove closed/finished connections from the queue
         for (file, c) in closed_conns:

Modified: debtorrent/trunk/test.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/test.py?rev=318&op=diff
==============================================================================
--- debtorrent/trunk/test.py (original)
+++ debtorrent/trunk/test.py Tue Nov  6 21:21:25 2007
@@ -660,7 +660,7 @@
             else:
                 print '********************** apt-get finished with status ' + str(r_value) + ' in ' +  str(elapsed) + ' sec. **************************'
         
-            sleep(10)
+            sleep(15)
             
     except:
         print '************************** Exception occurred **************************'




More information about the Debtorrent-commits mailing list