--- BitTorrent-5.3-GPL/BitTorrent/Connector.py.noise 2009-02-04 22:42:12.000000000 +0000 +++ BitTorrent-5.3-GPL/BitTorrent/Connector.py 2010-02-25 14:14:15.680426088 +0000 @@ -686,16 +686,25 @@ self.logger.exception("ut_pex support failed") self.uses_utorrent_pex = False elif msg_type == UTORRENT_MSG_PEX: - for i, addr in enumerate(IPTools.uncompact_sequence(d['added'])): - self.remote_pex_set.add(addr) - if len(d['added.f']) > i: - if (ord(d['added.f'][i]) & 2 and - self.parent.downloader.storage.get_amount_left() == 0): - # don't connect to seeds if we're done - continue - self.parent.start_connection(addr) - dropped_gen = IPTools.uncompact_sequence(d['dropped']) - self.remote_pex_set.difference_update(dropped_gen) + try: + for i, addr in enumerate(IPTools.uncompact_sequence(d['added'])): + self.remote_pex_set.add(addr) + try: + if len(d['added.f']) > i: + if (ord(d['added.f'][i]) & 2 and + self.parent.downloader.storage.get_amount_left() == 0): + # don't connect to seeds if we're done + continue + except KeyError: + pass + self.parent.start_connection(addr) + try: + dropped_gen = IPTools.uncompact_sequence(d['dropped']) + self.remote_pex_set.difference_update(dropped_gen) + except KeyError: + pass + except KeyError: + pass def _got_azureus_msg(self, msg_type, d): port = d.get('tcp_port')