r141 - in /debtorrent/trunk/DebTorrent: BT1/AptListener.py download_bt1.py

camrdale-guest at users.alioth.debian.org camrdale-guest at users.alioth.debian.org
Tue Jul 10 19:34:35 UTC 2007


Author: camrdale-guest
Date: Tue Jul 10 19:34:34 2007
New Revision: 141

URL: http://svn.debian.org/wsvn/debtorrent/?sc=1&rev=141
Log:
Remove some unused stuff from the AptListener, in particular the allowed torrent directory and list.

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

Modified: debtorrent/trunk/DebTorrent/BT1/AptListener.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/BT1/AptListener.py?rev=141&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/BT1/AptListener.py (original)
+++ debtorrent/trunk/DebTorrent/BT1/AptListener.py Tue Jul 10 19:34:34 2007
@@ -95,26 +95,6 @@
             for y in cinfo.values():      # ... each torrent has an integer value
                 if type(y) not in (IntType,LongType):
                     raise ValueError      # ... for the number of reported completions for that torrent
-        elif cname == 'allowed':
-            if (type(cinfo) != DictType): # a list of info_hashes and included data
-                raise ValueError
-            if x.has_key('allowed_dir_files'):
-                adlist = [z[1] for z in x['allowed_dir_files'].values()]
-                for y in cinfo.keys():        # and each should have a corresponding key here
-                    if not y in adlist:
-                        raise ValueError
-        elif cname == 'allowed_dir_files':
-            if (type(cinfo) != DictType): # a list of files, their attributes and info hashes
-                raise ValueError
-            dirkeys = {}
-            for y in cinfo.values():      # each entry should have a corresponding info_hash
-                if not y[1]:
-                    continue
-                if not x['allowed'].has_key(y[1]):
-                    raise ValueError
-                if dirkeys.has_key(y[1]): # and each should have a unique info_hash
-                    raise ValueError
-                dirkeys[y[1]] = 1
             
 
 alas = 'your file may exist elsewhere in the universe\nbut alas, not here\n'
@@ -167,8 +147,6 @@
     @ivar trackerid: unknown
     @type save_dfile_interval: C{int}
     @ivar save_dfile_interval: seconds between saving the state file
-    @type show_names: C{boolean}
-    @ivar show_names: whether to display names from allowed dir
     @type prevtime: unknown
     @ivar prevtime: unknown
     @type logfile: unknown
@@ -177,14 +155,6 @@
     @ivar log: unknown
     @type allow_get: unknown
     @ivar allow_get: unknown
-    @type allowed: unknown
-    @ivar allowed: unknown
-    @type allowed_list_mtime: unknown
-    @ivar allowed_list_mtime: unknown
-    @type allowed_dir_files: unknown
-    @ivar allowed_dir_files: unknown
-    @type allowed_dir_blocked: unknown
-    @ivar allowed_dir_blocked: unknown
     @type uq_broken: unknown
     @ivar uq_broken: unknown
     @type Filter: unknown
@@ -258,7 +228,6 @@
         seed(self.trackerid)
                 
         self.save_dfile_interval = config['save_dfile_interval']
-        self.show_names = config['show_names']
         #rawserver.add_task(self.save_state, self.save_dfile_interval)
         self.prevtime = clock()
         self.logfile = None
@@ -286,27 +255,6 @@
                 
         self.allow_get = config['allow_get']
         
-        if config['allowed_list']:
-            if config['allowed_dir']:
-                print '**warning** allowed_dir and allowed_list options cannot be used together'
-                print '**warning** disregarding allowed_dir'
-                config['allowed_dir'] = ''
-            self.allowed = self.state.setdefault('allowed_list',{})
-            self.allowed_list_mtime = 0
-            self.parse_allowed()
-            self.remove_from_state('allowed','allowed_dir_files')
-
-        elif config['allowed_dir']:
-            self.allowed = self.state.setdefault('allowed',{})
-            self.allowed_dir_files = self.state.setdefault('allowed_dir_files',{})
-            self.allowed_dir_blocked = {}
-            self.parse_allowed()
-            self.remove_from_state('allowed_list')
-
-        else:
-            self.allowed = None
-            self.remove_from_state('allowed','allowed_dir_files', 'allowed_list')
-                
         self.uq_broken = unquote('+') != ' '
         self.Filter = Filter(rawserver.add_task)
         self.Cache = HTTPCache(rawserver)
@@ -813,41 +761,6 @@
         h.close()
 
 
-    def parse_allowed(self):
-        """Periodically parse the directory and list for allowed torrents."""
-        self.rawserver.add_task(self.parse_allowed, self.parse_dir_interval)
-
-        if self.config['allowed_dir']:
-            r = parsedir( self.config['allowed_dir'], self.allowed,
-                          self.allowed_dir_files, self.allowed_dir_blocked,
-                          [".dtorrent"] )
-            ( self.allowed, self.allowed_dir_files, self.allowed_dir_blocked,
-                added, garbage2 ) = r
-            
-            self.state['allowed'] = self.allowed
-            self.state['allowed_dir_files'] = self.allowed_dir_files
-
-            self.t2tlist.parse(self.allowed)
-            
-        else:
-            f = self.config['allowed_list']
-            if self.allowed_list_mtime == os.path.getmtime(f):
-                return
-            try:
-                r = parsetorrentlist(f, self.allowed)
-                (self.allowed, added, garbage2) = r
-                self.state['allowed_list'] = self.allowed
-            except (IOError, OSError):
-                print '**warning** unable to read allowed torrent list'
-                return
-            self.allowed_list_mtime = os.path.getmtime(f)
-
-        for infohash in added.keys():
-            self.downloads.setdefault(infohash, {})
-            self.completed.setdefault(infohash, 0)
-            self.seedcount.setdefault(infohash, 0)
-
-
     def read_ip_lists(self):
         """Periodically parse the allowed and banned IPs lists."""
         self.rawserver.add_task(self.read_ip_lists,self.parse_dir_interval)

Modified: debtorrent/trunk/DebTorrent/download_bt1.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/download_bt1.py?rev=141&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/download_bt1.py (original)
+++ debtorrent/trunk/DebTorrent/download_bt1.py Tue Jul 10 19:34:34 2007
@@ -186,29 +186,21 @@
     ('dedicated_seed_id', '',
         "code to send to tracker identifying as a dedicated seed"),
     ('dfile', '', 'file to store recent apt downloader info in'),
-    ('socket_timeout', 15, 'timeout for closing connections'),
     ('save_dfile_interval', 5 * 60, 'seconds between saving dfile'),
     ('min_time_between_log_flushes', 3.0,
         'minimum time it must have been since the last flush to do another one'),
-    ('min_time_between_cache_refreshes', 600.0,
-        'minimum time in seconds before a cache is considered stale and is flushed'),
-    ('allowed_dir', '', 'only allow downloads for .dtorrents in this dir'),
-    ('allowed_list', '', 'only allow downloads for hashes in this list (hex format, one per line)'),
     ('hupmonitor', 0, 'whether to reopen the log file upon receipt of HUP signal'),
-    ('http_timeout', 60, 
-        'number of seconds to wait before assuming that an http connection has timed out'),
-    ('apt_parse_dir_interval', 60, 'seconds between reloading of allowed_dir or allowed_file ' +
-             'and allowed_ips and banned_ips lists for apt'),
+    ('apt_parse_dir_interval', 60, 'seconds between reloading of ' +
+             'allowed_ips and banned_ips lists for apt'),
     ('show_infopage', 1, "whether to display an info page when the tracker's root dir is loaded"),
     ('infopage_redirect', '', 'a URL to redirect the info page to'),
-    ('show_names', 1, 'whether to display names from allowed dir'),
     ('favicon', '', 'file containing x-icon data to return when browser requests favicon.ico'),
     ('allowed_ips', '', 'only allow connections from IPs specified in the given file; '+
              'file contains subnet data in the format: aa.bb.cc.dd/len'),
     ('banned_ips', '', "don't allow connections from IPs specified in the given file; "+
              'file contains IP range data in the format: xxx:xxx:ip1-ip2'),
     ('logfile', '', 'file to write the tracker logs, use - for stdout (default)'),
-    ('allow_get', 0, 'use with allowed_dir; adds a /file?hash={hash} url that allows users to download the torrent file'),
+    ('allow_get', 0, 'adds a /file?hash={hash} url that allows users to download the torrent file'),
     ('default_tracker', 'http://dttracker.debian.net:6969/announce', 'the default tracker address to use for new torrents'),
     ('config_dir', '', 'the directory to use to get/store configuration and cache files, if not ' + 
              'specified then a .DebTorrent directory in the user\'s home directory will be used'),




More information about the Debtorrent-commits mailing list