diff --git a/aioesphomeapi/_frame_helper/base.pxd b/aioesphomeapi/_frame_helper/base.pxd index e7465095..dce21f14 100644 --- a/aioesphomeapi/_frame_helper/base.pxd +++ b/aioesphomeapi/_frame_helper/base.pxd @@ -26,11 +26,11 @@ cdef class APIFrameHelper: cdef bytes _read(self, int length) @cython.locals(bytes_data=bytes) - cdef _add_to_buffer(self, object data) + cdef void _add_to_buffer(self, object data) @cython.locals(end_of_frame_pos="unsigned int") - cdef _remove_from_buffer(self) + cdef void _remove_from_buffer(self) cpdef write_packets(self, list packets, bint debug_enabled) - cdef _write_bytes(self, bytes data, bint debug_enabled) + cdef void _write_bytes(self, bytes data, bint debug_enabled) diff --git a/aioesphomeapi/_frame_helper/noise.pxd b/aioesphomeapi/_frame_helper/noise.pxd index 776da527..1604de71 100644 --- a/aioesphomeapi/_frame_helper/noise.pxd +++ b/aioesphomeapi/_frame_helper/noise.pxd @@ -36,22 +36,22 @@ cdef class APINoiseFrameHelper(APIFrameHelper): type_high="unsigned char", type_low="unsigned char" ) - cdef _handle_frame(self, bytes frame) + cdef void _handle_frame(self, bytes frame) @cython.locals( chosen_proto=char, server_name_i=int ) - cdef _handle_hello(self, bytes server_hello) + cdef void _handle_hello(self, bytes server_hello) - cdef _handle_handshake(self, bytes msg) + cdef void _handle_handshake(self, bytes msg) - cdef _handle_closed(self, bytes frame) + cdef void _handle_closed(self, bytes frame) @cython.locals(handshake_frame=bytearray, frame_len="unsigned int") - cdef _send_hello_handshake(self) + cdef void _send_hello_handshake(self) - cdef _setup_proto(self) + cdef void _setup_proto(self) @cython.locals(psk_bytes=bytes) cdef _decode_noise_psk(self) diff --git a/aioesphomeapi/_frame_helper/noise.py b/aioesphomeapi/_frame_helper/noise.py index 5b5ad263..efe59d58 100644 --- a/aioesphomeapi/_frame_helper/noise.py +++ b/aioesphomeapi/_frame_helper/noise.py @@ -135,7 +135,7 @@ def connection_made(self, transport: asyncio.BaseTransport) -> None: def data_received(self, data: bytes | bytearray | memoryview) -> None: self._add_to_buffer(data) - while self._buffer: + while self._buffer_len: self._pos = 0 if (header := self._read(3)) is None: return diff --git a/aioesphomeapi/_frame_helper/plain_text.pxd b/aioesphomeapi/_frame_helper/plain_text.pxd index 9a970970..f1c1e6ae 100644 --- a/aioesphomeapi/_frame_helper/plain_text.pxd +++ b/aioesphomeapi/_frame_helper/plain_text.pxd @@ -27,7 +27,7 @@ cdef class APIPlaintextFrameHelper(APIFrameHelper): ) cpdef data_received(self, object data) - cdef _error_on_incorrect_preamble(self, object preamble) + cdef void _error_on_incorrect_preamble(self, object preamble) @cython.locals( type_="unsigned int", diff --git a/aioesphomeapi/_frame_helper/plain_text.py b/aioesphomeapi/_frame_helper/plain_text.py index b0d9995e..3d873c21 100644 --- a/aioesphomeapi/_frame_helper/plain_text.py +++ b/aioesphomeapi/_frame_helper/plain_text.py @@ -80,7 +80,7 @@ def data_received( # pylint: disable=too-many-branches,too-many-return-statemen self, data: bytes | bytearray | memoryview ) -> None: self._add_to_buffer(data) - while self._buffer: + while self._buffer_len: # Read preamble, which should always 0x00 # Also try to get the length and msg type # to avoid multiple calls to _read diff --git a/aioesphomeapi/connection.pxd b/aioesphomeapi/connection.pxd index c1a1005b..5b29c56d 100644 --- a/aioesphomeapi/connection.pxd +++ b/aioesphomeapi/connection.pxd @@ -89,7 +89,7 @@ cdef class APIConnection: cdef send_messages(self, tuple messages) @cython.locals(handlers=set, handlers_copy=set) - cpdef process_packet(self, object msg_type_proto, object data) + cpdef void process_packet(self, object msg_type_proto, object data) cpdef _async_cancel_pong_timer(self)