Try to set TCP_QUICKACK where support for that option is available (#932)

Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
nkinnan 2024-08-29 14:43:17 -07:00 committed by GitHub
parent fce8922aa3
commit ec08c49cf1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -374,6 +374,13 @@ class APIConnection:
self._socket = sock
sock.setblocking(False)
sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
try:
sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_QUICKACK, 1)
except AttributeError:
_LOGGER.debug(
"%s: TCP_QUICKACK not supported",
self.log_name,
)
self._increase_recv_buffer_size()
self.connected_address = sock.getpeername()[0]