From ec08c49cf18272c94a367c7caa4190b543401f25 Mon Sep 17 00:00:00 2001 From: nkinnan Date: Thu, 29 Aug 2024 14:43:17 -0700 Subject: [PATCH] Try to set TCP_QUICKACK where support for that option is available (#932) Co-authored-by: J. Nick Koston --- aioesphomeapi/connection.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/aioesphomeapi/connection.py b/aioesphomeapi/connection.py index 7cfd146..f931813 100644 --- a/aioesphomeapi/connection.py +++ b/aioesphomeapi/connection.py @@ -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]