From 526a726073eeba53b922913dbb72d7cf16650c9e Mon Sep 17 00:00:00 2001 From: Diego Date: Mon, 1 May 2017 19:22:39 +0200 Subject: [PATCH] Changes for Windows compatibility --- magneticod/magneticod/bittorrent.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/magneticod/magneticod/bittorrent.py b/magneticod/magneticod/bittorrent.py index 5a5b4bef6..b93a2ad56 100644 --- a/magneticod/magneticod/bittorrent.py +++ b/magneticod/magneticod/bittorrent.py @@ -37,7 +37,8 @@ def __init__(self, info_hash: InfoHash, peer_addr: PeerAddress, max_metadata_siz self.__socket.setsockopt(socket.IPPROTO_TCP, socket.TCP_QUICKACK, True) res = self.__socket.connect_ex(peer_addr) - if res != errno.EINPROGRESS: + # We either connected or connection is in progress: + if not res in (0, errno.EINPROGRESS, errno.EAGAIN, errno.WSAEWOULDBLOCK): raise ConnectionError() self.__peer_addr = peer_addr