fixed checking errno in dht.py

This commit is contained in:
Bora M. Alper 2017-06-13 15:16:48 +03:00
parent 11f573a01d
commit dea0778511

View File

@ -80,7 +80,7 @@ class SybilNode(asyncio.DatagramProtocol):
self._transport.sendto(data, addr)
def error_received(self, exc: Exception) -> None:
if isinstance(exc, PermissionError) or (isinstance(exc, OSError) and errno.ENOBUFS):
if isinstance(exc, PermissionError) or (isinstance(exc, OSError) and exc.errno == errno.ENOBUFS):
# This exception (EPERM errno: 1) is kernel's way of saying that "you are far too fast, chill".
# It is also likely that we have received a ICMP source quench packet (meaning, that we really need to
# slow down.