diff --git a/btdht/dht.pyx b/btdht/dht.pyx index 5e16a93..9c641a0 100644 --- a/btdht/dht.pyx +++ b/btdht/dht.pyx @@ -976,7 +976,10 @@ cdef class DHT_BASE: # 1: premission denied # 10013: same as 1 but on windows if e.errno not in [11, 1, 10035, 10013]: - self.debug(0, "send:%r : (%r, %r)" % (e, data, addr)) + try: + self.debug(0, "recv:%r : (%r, %r)" % (e, data, addr)) + except UnboundLocalError: + self.debug(0, "recv:%r" % (e,)) raise except MissingT: pass diff --git a/btdht/utils.pyx b/btdht/utils.pyx index 7339f4f..cf99690 100644 --- a/btdht/utils.pyx +++ b/btdht/utils.pyx @@ -843,13 +843,13 @@ class Scheduler(object): iterator = function() self._names[iterator] = name self._iterators[name] = iterator - typ = iterator.next() + typ = next(iterator) if typ == 0: if user == True: raise ValueError("Only queue based threads can be put in the user loop") self._time_based[iterator] = 0 elif typ == 1: - queue = iterator.next() + queue = next(iterator) if user == True: self._user_queue[iterator] = queue self._user_queue_sockets.append(queue.sock) @@ -1062,7 +1062,7 @@ class Scheduler(object): try: for iterator, t in six.iteritems(self._time_based): if now >= t: - to_set.append((iterator, iterator.next())) + to_set.append((iterator, next(iterator))) for iterator, t in to_set: self._time_based[iterator] = t except RuntimeError: @@ -1073,7 +1073,7 @@ class Scheduler(object): for sock in sockets: try: iterator = self._queue_base_socket_map[sock] - iterator.next() + next(iterator) except KeyError: pass except StopIteration as error: @@ -1107,7 +1107,7 @@ class Scheduler(object): for sock in sockets: try: iterator = self._queue_base_socket_map[sock] - iterator.next() + next(iterator) except KeyError: pass except StopIteration as error: diff --git a/setup.py b/setup.py index b882bdd..730d658 100755 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ except ImportError: has_cython = False -VERSION = "0.3.1" +VERSION = "0.3.2" if __name__ == "__main__": c_extensions = [