Fix magneticod on macOS.

macOS lacks the `TCP_QUICKACK` option. Since this is simply an
optimization, we can safely skip it on macOS.
This commit is contained in:
Robert Xiao 2017-04-09 20:03:23 -04:00
parent d848d02da0
commit a6ee9d509d

View File

@ -33,7 +33,8 @@ class DisposablePeer:
self.__socket.setblocking(False)
# To reduce the latency:
self.__socket.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, True)
self.__socket.setsockopt(socket.IPPROTO_TCP, socket.TCP_QUICKACK, True)
if hasattr(socket, 'TCP_QUICKACK'):
self.__socket.setsockopt(socket.IPPROTO_TCP, socket.TCP_QUICKACK, True)
res = self.__socket.connect_ex(peer_addr)
if res != errno.EINPROGRESS:
raise ConnectionError()