[Debtorrent-commits] r27 - in /debtorrent/trunk: DebTorrent/BT1/Rerequester.py DebTorrent/BT1/track.py TODO

camrdale-guest at users.alioth.debian.org camrdale-guest at users.alioth.debian.org
Sun Apr 29 17:43:47 UTC 2007


Author: camrdale-guest
Date: Sun Apr 29 17:43:46 2007
New Revision: 27

URL: http://svn.debian.org/wsvn/debtorrent/?sc=1&rev=27
Log:
Revert changes to fix ip/DNS problem

Modified:
    debtorrent/trunk/DebTorrent/BT1/Rerequester.py
    debtorrent/trunk/DebTorrent/BT1/track.py
    debtorrent/trunk/TODO

Modified: debtorrent/trunk/DebTorrent/BT1/Rerequester.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/BT1/Rerequester.py?rev=27&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/BT1/Rerequester.py (original)
+++ debtorrent/trunk/DebTorrent/BT1/Rerequester.py Sun Apr 29 17:43:46 2007
@@ -163,13 +163,12 @@
             self.announce(event)
 
     def announce(self, event = 3, callback = lambda: None, specialurl = None):
-        # TODO: think about re-enabling compact peer lists once testing is complete
         if specialurl is not None:
             s = self.url+'&uploaded=0&downloaded=0&left=1'   # don't add to statistics
             if self.howmany() >= self.maxpeers:
                 s += '&numwant=0'
             else:
-                s += '&no_peer_id=1'
+                s += '&no_peer_id=1&compact=1'
             self.last_failed = True         # force true, so will display an error
             self.special = specialurl
             self.rerequest(s, callback)
@@ -186,7 +185,7 @@
         if self.howmany() >= self.maxpeers:
             s += '&numwant=0'
         else:
-            s += '&no_peer_id=1'
+            s += '&no_peer_id=1&compact=1'
         if event != 3:
             s += '&event=' + ['started', 'completed', 'stopped'][event]
         if event == 2:
@@ -216,12 +215,11 @@
             def fail (self = self, callback = callback):
                 self._fail(callback)
             if self.ip:
-                s += '&ip=' + self.ip
-#                try:
-#                    s += '&ip=' + gethostbyname(self.ip)
-#                except:
-#                    self.errorcodes['troublecode'] = 'unable to resolve: '+self.ip
-#                    self.externalsched(fail)
+                try:
+                    s += '&ip=' + gethostbyname(self.ip)
+                except:
+                    self.errorcodes['troublecode'] = 'unable to resolve: '+self.ip
+                    self.externalsched(fail)
             self.errorcodes = {}
             if self.special is None:
                 for t in range(len(self.trackerlist)):

Modified: debtorrent/trunk/DebTorrent/BT1/track.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/BT1/track.py?rev=27&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/BT1/track.py (original)
+++ debtorrent/trunk/DebTorrent/BT1/track.py Sun Apr 29 17:43:46 2007
@@ -95,7 +95,7 @@
     ('keep_dead', 0, 'keep dead torrents after they expire (so they still show up on your /scrape and web page)'),
     ('scrape_allowed', 'full', 'scrape access allowed (can be none, specific or full)'),
     ('dedicated_seed_id', '', 'allows tracker to monitor dedicated seed(s) and flag torrents as seeded'),
-    ('compact_reqd', 0, "only allow peers that accept a compact response"),
+    ('compact_reqd', 1, "only allow peers that accept a compact response"),
   ]
 
 def statefiletemplate(x):
@@ -639,7 +639,7 @@
             auth = peer.get('key',-1) == mykey or peer.get('ip') == ip
 
         gip = params('ip')
-        if islocal or not self.only_local_override_ip:
+        if is_valid_ip(gip) and (islocal or not self.only_local_override_ip):
             ip1 = gip
         else:
             ip1 = ip
@@ -777,7 +777,7 @@
         l_get_size = int(float(rsize)*(len_l)/(len_l+len_s))
         if DEBUG:
             print 'return type '+str(return_type)
-        cache = self.cached.setdefault(infohash,[None,None,None,None,None])[return_type]
+        cache = self.cached.setdefault(infohash,[None,None,None])[return_type]
         if cache and ( not cache[1]
                        or (is_seed and len(cache[1]) < rsize)
                        or len(cache[1]) < l_get_size

Modified: debtorrent/trunk/TODO
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/TODO?rev=27&op=diff
==============================================================================
--- debtorrent/trunk/TODO (original)
+++ debtorrent/trunk/TODO Sun Apr 29 17:43:46 2007
@@ -15,6 +15,16 @@
 enabled does not pre=allocate the entire archive.
 
 
+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.
+
+
 Comments
 
 Comments are needed, both for new code, and the original. Variable naming 




More information about the Debtorrent-commits mailing list