r243 - in /debtorrent/branches/http1.1: ./ DebTorrent/ DebTorrent/BT1/ debian/

camrdale-guest at users.alioth.debian.org camrdale-guest at users.alioth.debian.org
Tue Aug 14 23:06:24 UTC 2007


Author: camrdale-guest
Date: Tue Aug 14 23:06:24 2007
New Revision: 243

URL: http://svn.debian.org/wsvn/debtorrent/?sc=1&rev=243
Log:
Merged revisions 200-206,208-242 via svnmerge from 
svn+ssh://camrdale-guest@svn.debian.org/svn/debtorrent/debtorrent/trunk

........
  r206 | camrdale-guest | 2007-08-08 22:00:12 -0700 (Wed, 08 Aug 2007) | 1 line
  
  Clean up the old svnmerge properties left over.
........
  r208 | camrdale-guest | 2007-08-08 22:08:03 -0700 (Wed, 08 Aug 2007) | 3 lines
  
  Initialized merge tracking via "svnmerge" with revisions "1-204" from 
  svn+ssh://camrdale-guest@svn.debian.org/svn/debtorrent/debtorrent/branches/unique
........
  r214 | camrdale-guest | 2007-08-09 20:48:45 -0700 (Thu, 09 Aug 2007) | 1 line
  
  Fix a bug that caused an error when downloading the same file from different torrents.
........
  r215 | camrdale-guest | 2007-08-09 20:58:03 -0700 (Thu, 09 Aug 2007) | 1 line
  
  Automatically expire disconnected seeds.
........
  r218 | camrdale-guest | 2007-08-11 11:44:41 -0700 (Sat, 11 Aug 2007) | 1 line
  
  AptListener sets files readonly when it finds a complete one.
........
  r220 | camrdale-guest | 2007-08-11 14:07:36 -0700 (Sat, 11 Aug 2007) | 1 line
  
  Fix a bug that caused cached HTTP 404 responses to not be passed on to Apt.
........
  r221 | camrdale-guest | 2007-08-11 14:16:27 -0700 (Sat, 11 Aug 2007) | 1 line
  
  Update changelog and version for new release.
........
  r228 | camrdale-guest | 2007-08-13 09:52:20 -0700 (Mon, 13 Aug 2007) | 1 line
  
  Fix a bug that caused restarts to fail when downloaded files have been modified.
........
  r238 | camrdale-guest | 2007-08-14 12:18:16 -0700 (Tue, 14 Aug 2007) | 1 line
  
  Fix a bug in deleting old cached data.
........

Modified:
    debtorrent/branches/http1.1/   (props changed)
    debtorrent/branches/http1.1/DebTorrent/BT1/AptListener.py
    debtorrent/branches/http1.1/DebTorrent/BT1/Downloader.py
    debtorrent/branches/http1.1/DebTorrent/BT1/FileSelector.py
    debtorrent/branches/http1.1/DebTorrent/BT1/Storage.py
    debtorrent/branches/http1.1/DebTorrent/ConfigDir.py
    debtorrent/branches/http1.1/DebTorrent/HTTPCache.py
    debtorrent/branches/http1.1/DebTorrent/__init__.py
    debtorrent/branches/http1.1/DebTorrent/launchmanycore.py
    debtorrent/branches/http1.1/debian/changelog
    debtorrent/branches/http1.1/debtorrent-client.py

Propchange: debtorrent/branches/http1.1/
            ('svnmerge-blocked' removed)

Propchange: debtorrent/branches/http1.1/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Aug 14 23:06:24 2007
@@ -1,1 +1,1 @@
-/debtorrent/trunk:1-199
+/debtorrent/trunk:1-242

Modified: debtorrent/branches/http1.1/DebTorrent/BT1/AptListener.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/branches/http1.1/DebTorrent/BT1/AptListener.py?rev=243&op=diff
==============================================================================
--- debtorrent/branches/http1.1/DebTorrent/BT1/AptListener.py (original)
+++ debtorrent/branches/http1.1/DebTorrent/BT1/AptListener.py Tue Aug 14 23:06:24 2007
@@ -204,6 +204,7 @@
                 if not v[3]:
                     logger.info('queued request for file '+file+' is complete')
                     closed_conns.append((file, c))
+                    v[0].storagewrapper.set_file_readonly(v[1])
                     self.answer_package(c, file, v[0], v[1], v[2])
 
         # Remove closed/finished connections from the queue

Modified: debtorrent/branches/http1.1/DebTorrent/BT1/Downloader.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/branches/http1.1/DebTorrent/BT1/Downloader.py?rev=243&op=diff
==============================================================================
--- debtorrent/branches/http1.1/DebTorrent/BT1/Downloader.py (original)
+++ debtorrent/branches/http1.1/DebTorrent/BT1/Downloader.py Tue Aug 14 23:06:24 2007
@@ -827,18 +827,10 @@
 #        if not self.disconnectedseeds.has_key(id):
 #            self.picker.seed_seen_recently()
         self.disconnectedseeds[id]=clock()
-
-#    def expire_disconnected_seeds(self):
-
-    def num_disconnected_seeds(self):
-        """Expire old disconnected seeds and calculate the recent number.
-        
-        @rtype: C{int}
-        @return: the number of recently seen disconnected seeds
-        
-        """
-        
-        # first expire old ones
+        self.expire_disconnected_seeds()
+
+    def expire_disconnected_seeds(self):
+        """Expire old disconnected seeds."""
         expired = []
         for id,t in self.disconnectedseeds.items():
             if clock() - t > EXPIRE_TIME:     #Expire old seeds after so long
@@ -846,9 +838,18 @@
         for id in expired:
 #            self.picker.seed_disappeared()
             del self.disconnectedseeds[id]
+
+    def num_disconnected_seeds(self):
+        """Calculate the number or recently seen seeds.
+        
+        @rtype: C{int}
+        @return: the number of recently seen disconnected seeds
+        
+        """
+        
+        # first expire old ones
+        self.expire_disconnected_seeds()
         return len(self.disconnectedseeds)
-        # if this isn't called by a stats-gathering function
-        # it should be scheduled to run every minute or two.
 
     def _check_kicks_ok(self):
         """Check whether peers can be kicked for bad data.

Modified: debtorrent/branches/http1.1/DebTorrent/BT1/FileSelector.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/branches/http1.1/DebTorrent/BT1/FileSelector.py?rev=243&op=diff
==============================================================================
--- debtorrent/branches/http1.1/DebTorrent/BT1/FileSelector.py (original)
+++ debtorrent/branches/http1.1/DebTorrent/BT1/FileSelector.py Tue Aug 14 23:06:24 2007
@@ -187,8 +187,6 @@
             if not self.init_priority(d['priority']):
                 return
         pieces = self.storage.unpickle(d)
-        if not pieces:  # don't bother, nothing restoreable
-            return
         new_piece_priority = self._get_piece_priority_list(self.new_priority)
         self.storagewrapper.reblock([i == -1 for i in new_piece_priority])
         self.new_partials = self.storagewrapper.unpickle(d, pieces)

Modified: debtorrent/branches/http1.1/DebTorrent/BT1/Storage.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/branches/http1.1/DebTorrent/BT1/Storage.py?rev=243&op=diff
==============================================================================
--- debtorrent/branches/http1.1/DebTorrent/BT1/Storage.py (original)
+++ debtorrent/branches/http1.1/DebTorrent/BT1/Storage.py Tue Aug 14 23:06:24 2007
@@ -233,7 +233,7 @@
                         h.flush()
                         h.close()
                     self.mtimes[file] = getmtime(file)
-                self.tops[file] = l
+                    self.tops[file] = l
                 self.sizes[file] = length
                 so_far += l
 
@@ -410,7 +410,7 @@
                 assert newmtime <= oldmtime+1
                 assert newmtime >= oldmtime-1
             except:
-                logger.warning(file+' modified: '
+                logger.exception(file+' modified: '
                             +strftime('(%x %X)',localtime(self.mtimes[file]))
                             +strftime(' != (%x %X) ?',localtime(getmtime(file))))
                 raise IOError('modified during download')

Modified: debtorrent/branches/http1.1/DebTorrent/ConfigDir.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/branches/http1.1/DebTorrent/ConfigDir.py?rev=243&op=diff
==============================================================================
--- debtorrent/branches/http1.1/DebTorrent/ConfigDir.py (original)
+++ debtorrent/branches/http1.1/DebTorrent/ConfigDir.py Tue Aug 14 23:06:24 2007
@@ -674,7 +674,7 @@
             names.setdefault(f,[]).append(p)
 
         for k,v in times.items():
-            if max(v) < exptime and not k in still_active:
+            if max(v) < exptime and not k in still_active and k in names:
                 for f in names[k]:
                     try:
                         os.remove(f)

Modified: debtorrent/branches/http1.1/DebTorrent/HTTPCache.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/branches/http1.1/DebTorrent/HTTPCache.py?rev=243&op=diff
==============================================================================
--- debtorrent/branches/http1.1/DebTorrent/HTTPCache.py (original)
+++ debtorrent/branches/http1.1/DebTorrent/HTTPCache.py Tue Aug 14 23:06:24 2007
@@ -190,9 +190,10 @@
         logger.info('download completed for: http://'+'/'.join(path))
         self.downloads.remove(d)
 
-        if r[0] in (200, 206):
-            file = self.get_filename(path)
-            
+        file = self.get_filename(path)
+        headers = {'Server': VERSION}
+
+        if r[0] == 200:
             # Create the directory for the new file
             new_dir = split(file)[0]
             if new_dir != '' and not exists(new_dir):
@@ -212,8 +213,10 @@
                 pass
 
         # Use the headers we want
-        mtime_string = strftime(time_format + ' GMT', gmtime(getmtime(file)))
-        headers = {'Server': VERSION, 'last-modified': mtime_string}
+        if exists(file):
+            mtime_string = strftime(time_format + ' GMT', gmtime(getmtime(file)))
+            headers['last-modified'] = mtime_string
+        
         for k, v in r[2].items():
             if k in ('last-modified', 'content-type'):
                 headers[k] = v

Modified: debtorrent/branches/http1.1/DebTorrent/__init__.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/branches/http1.1/DebTorrent/__init__.py?rev=243&op=diff
==============================================================================
--- debtorrent/branches/http1.1/DebTorrent/__init__.py (original)
+++ debtorrent/branches/http1.1/DebTorrent/__init__.py Tue Aug 14 23:06:24 2007
@@ -22,7 +22,7 @@
 """
 
 product_name = 'DebTorrent'
-version_short = 'T-0.1.3'
+version_short = 'T-0.1.3.1'
 
 version = version_short+' ('+product_name+')'
 report_email = 'debtorrent-devel at lists.alioth.debian.org'

Modified: debtorrent/branches/http1.1/DebTorrent/launchmanycore.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/branches/http1.1/DebTorrent/launchmanycore.py?rev=243&op=diff
==============================================================================
--- debtorrent/branches/http1.1/DebTorrent/launchmanycore.py (original)
+++ debtorrent/branches/http1.1/DebTorrent/launchmanycore.py Tue Aug 14 23:06:24 2007
@@ -378,7 +378,11 @@
             seed(createPeerID())
 
             # Restore the previous state of the downloads
-            self.unpickle(self.configdir.getState())
+            still_running = self.unpickle(self.configdir.getState())
+            
+            # Expire any old cached files
+            self.configdir.deleteOldCacheData(config['expire_cache_data'],
+                                              still_running, True)
             
             self.handler.listen_forever()
 
@@ -772,14 +776,18 @@
         
         @type data: C{dictionary}
         @param data: the saved state of the previously running downloads downloads
+        @rtype: C{list} of C{string}
+        @return: the list of torrent hashes that are still running
         
         """
         
         if data is None:
-            return
-        
+            return []
+        
+        still_running = []
         d = data['torrent cache']
         for hash in d:
+            still_running.append(hash)
             paused = d[hash].pop('paused', False)
             metainfo = self.configdir.getTorrent(hash)
             if metainfo:
@@ -787,3 +795,5 @@
                 self.add(hash, d[hash], False)
                 if paused:
                     self.downloads[hash].d.Pause()
+        
+        return still_running

Modified: debtorrent/branches/http1.1/debian/changelog
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/branches/http1.1/debian/changelog?rev=243&op=diff
==============================================================================
--- debtorrent/branches/http1.1/debian/changelog (original)
+++ debtorrent/branches/http1.1/debian/changelog Tue Aug 14 23:06:24 2007
@@ -1,6 +1,13 @@
+debtorrent (0.1.3.1) unstable; urgency=low
+
+  * First debian package release (Closes: #428005)
+  * fixed: cached HTTP 404 responses get passed properly to APT
+  * fixed: downloading the same file from a previous torrent works now
+
+ -- Cameron Dale <camrdale at gmail.com>  Sat, 11 Aug 2007 14:13:00 -0700
+
 debtorrent (0.1.3) unstable; urgency=low
 
-  * First debian package release (Closes: #428005)
   * Cleanup all the configuration options
   * Add a global config file
   * Moved all logging to log files

Modified: debtorrent/branches/http1.1/debtorrent-client.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/branches/http1.1/debtorrent-client.py?rev=243&op=diff
==============================================================================
--- debtorrent/branches/http1.1/debtorrent-client.py (original)
+++ debtorrent/branches/http1.1/debtorrent-client.py Tue Aug 14 23:06:24 2007
@@ -72,7 +72,6 @@
         # Continue
         if config['save_options']:
             configdir.saveConfig(config)
-        configdir.deleteOldCacheData(config['expire_cache_data'])
     except ValueError, e:
         logger.error('error: ' + str(e))
         logger.error("Usage: debtorrent-client.py <global options>")
@@ -83,8 +82,13 @@
         logger.exception('error: ' + str(e))
         logging.shutdown()
         exit(2)
+    except:
+        logger.exception('unhandled exception')
 
-    LaunchMany(config, configdir)
+    try:
+        LaunchMany(config, configdir)
+    except:
+        logger.exception('unhandled exception')
 
     logger.info('Shutting down')
     logging.shutdown()




More information about the Debtorrent-commits mailing list