Small speed up to writing outgoing packets
There were two try blocks to convert exception types. Simplify by removing one of the try blocks and converting the exceptions in the connection class
This commit is contained in:
parent
488443c70a
commit
d1f6ec04a7
|
@ -5,7 +5,6 @@ from ..connection cimport APIConnection
|
|||
|
||||
|
||||
cdef bint TYPE_CHECKING
|
||||
cdef object WRITE_EXCEPTIONS
|
||||
|
||||
cdef class APIFrameHelper:
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@ SOCKET_ERRORS = (
|
|||
TimeoutError,
|
||||
)
|
||||
|
||||
WRITE_EXCEPTIONS = (RuntimeError, ConnectionResetError, OSError)
|
||||
|
||||
_int = int
|
||||
_bytes = bytes
|
||||
|
|
|
@ -19,7 +19,6 @@ from google.protobuf import message
|
|||
|
||||
import aioesphomeapi.host_resolver as hr
|
||||
|
||||
from ._frame_helper.base import WRITE_EXCEPTIONS
|
||||
from ._frame_helper.noise import APINoiseFrameHelper
|
||||
from ._frame_helper.plain_text import APIPlaintextFrameHelper
|
||||
from .api_pb2 import ( # type: ignore
|
||||
|
@ -97,6 +96,8 @@ CONNECT_REQUEST_TIMEOUT = 30.0
|
|||
# to reboot and connect to the network/WiFi.
|
||||
TCP_CONNECT_TIMEOUT = 60.0
|
||||
|
||||
WRITE_EXCEPTIONS = (RuntimeError, ConnectionResetError, OSError)
|
||||
|
||||
|
||||
_int = int
|
||||
_bytes = bytes
|
||||
|
|
Loading…
Reference in New Issue