'Low-level IRC protocol / server connection management.'
# built-ins
from abc import ABC, abstractmethod
-from socket import EAI_AGAIN, socket, gaierror as socket_gaierror
+from socket import EAI_AGAIN, EBADF, socket, gaierror as socket_gaierror
from ssl import create_default_context as create_ssl_context
from datetime import datetime
from typing import Callable, Iterator, NamedTuple, Optional, Self
continue
except ConnectionResetError as e:
raise IrcConnException(retry=True) from e
+ except socket_gaierror as e:
+ raise IrcConnException(retry=e.errno == EAI_AGAIN) from e
except OSError as e:
- if e.errno == 9:
+ if e.errno == EBADF:
raise IrcConnException(retry=True) from e
raise e
if not bytes_new: