[Debtorrent-commits] r20 - 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
Sat Apr 28 06:42:37 UTC 2007
Author: camrdale-guest
Date: Sat Apr 28 06:42:36 2007
New Revision: 20
URL: http://svn.debian.org/wsvn/debtorrent/?sc=1&rev=20
Log:
Fixed --ip config to work with DNS names
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=20&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/BT1/Rerequester.py (original)
+++ debtorrent/trunk/DebTorrent/BT1/Rerequester.py Sat Apr 28 06:42:36 2007
@@ -26,6 +26,8 @@
True = 1
False = 0
+DEBUG = True
+
mapbase64 = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.-'
keys = {}
basekeydata = str(getpid()) + repr(time()) + 'tracker'
@@ -161,13 +163,13 @@
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&compact=1'
+ s += '&no_peer_id=1'
self.last_failed = True # force true, so will display an error
self.special = specialurl
self.rerequest(s, callback)
@@ -184,7 +186,7 @@
if self.howmany() >= self.maxpeers:
s += '&numwant=0'
else:
- s += '&no_peer_id=1&compact=1'
+ s += '&no_peer_id=1'
if event != 3:
s += '&event=' + ['started', 'completed', 'stopped'][event]
if event == 2:
@@ -214,11 +216,12 @@
def fail (self = self, callback = callback):
self._fail(callback)
if self.ip:
- try:
- s += '&ip=' + gethostbyname(self.ip)
- except:
- self.errorcodes['troublecode'] = 'unable to resolve: '+self.ip
- self.externalsched(fail)
+ s += '&ip=' + self.ip
+# 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)):
@@ -371,16 +374,22 @@
cflags = [None for i in xrange(lenpeers)]
else:
cflags = [ord(x) for x in cflags]
+ if DEBUG:
+ print 'got peer list of type '+str(type(p))
if type(p) == type(''):
for x in xrange(0, len(p), 6):
ip = '.'.join([str(ord(i)) for i in p[x:x+4]])
port = (ord(p[x+4]) << 8) | ord(p[x+5])
peers.append(((ip, port), 0, cflags[int(x/6)]))
+ if DEBUG:
+ print "got ip "+ip+" port "+str(port)
else:
for i in xrange(len(p)):
x = p[i]
peers.append(((x['ip'].strip(), x['port']),
x.get('peer id',0), cflags[i]))
+ if DEBUG:
+ print "got ip "+x['ip'].strip()+" port "+str(x['port'])
ps = len(peers) + self.howmany()
if ps < self.maxpeers:
if self.doneflag.isSet():
Modified: debtorrent/trunk/DebTorrent/BT1/track.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/BT1/track.py?rev=20&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/BT1/track.py (original)
+++ debtorrent/trunk/DebTorrent/BT1/track.py Sat Apr 28 06:42:36 2007
@@ -38,6 +38,8 @@
True = 1
False = 0
bool = lambda x: not not x
+
+DEBUG = True
defaults = [
('port', 80, "Port to listen on."),
@@ -93,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', 1, "only allow peers that accept a compact response"),
+ ('compact_reqd', 0, "only allow peers that accept a compact response"),
]
def statefiletemplate(x):
@@ -637,7 +639,7 @@
auth = peer.get('key',-1) == mykey or peer.get('ip') == ip
gip = params('ip')
- if is_valid_ip(gip) and (islocal or not self.only_local_override_ip):
+ if islocal or not self.only_local_override_ip:
ip1 = gip
else:
ip1 = ip
@@ -773,7 +775,9 @@
data['peers'] = []
return data
l_get_size = int(float(rsize)*(len_l)/(len_l+len_s))
- cache = self.cached.setdefault(infohash,[None,None,None])[return_type]
+ if DEBUG:
+ print 'return type '+str(return_type)
+ cache = self.cached.setdefault(infohash,[None,None,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=20&op=diff
==============================================================================
--- debtorrent/trunk/TODO (original)
+++ debtorrent/trunk/TODO Sat Apr 28 06:42:36 2007
@@ -1,14 +1,4 @@
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
More information about the Debtorrent-commits
mailing list