Merge pull request #2817 from fuzeman/feature/dev_rtorrent

[rtorrent] Fixed bug which caused large torrents to fail
This commit is contained in:
Ruud Burger
2014-02-06 14:04:46 +01:00
2 changed files with 4 additions and 4 deletions

View File

@@ -267,7 +267,7 @@ def _encode_dict(data):
def encode(data):
if isinstance(data, bool):
return False
elif isinstance(data, int):
elif isinstance(data, (int, long)):
return _encode_int(data)
elif isinstance(data, bytes):
return _encode_string(data)

View File

@@ -90,10 +90,10 @@ class TorrentParser():
def _calc_info_hash(self):
self.info_hash = None
if "info" in self._torrent_decoded.keys():
info_encoded = bencode.encode(self._torrent_decoded["info"])
info_encoded = bencode.encode(self._torrent_decoded["info"])
if info_encoded:
self.info_hash = hashlib.sha1(info_encoded).hexdigest().upper()
if info_encoded:
self.info_hash = hashlib.sha1(info_encoded).hexdigest().upper()
return(self.info_hash)