Skip to content

Commit

Permalink
feat: small speed up to process incoming packets (#1309)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco committed Nov 12, 2023
1 parent d793e13 commit 56ef908
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/zeroconf/_core.py
Expand Up @@ -573,7 +573,7 @@ def handle_assembled_query(
addr: str,
port: int,
transport: _WrappedTransport,
v6_flow_scope: Union[Tuple[()], Tuple[int, int]] = (),
v6_flow_scope: Union[Tuple[()], Tuple[int, int]],
) -> None:
"""Respond to a (re)assembled query.
Expand Down
10 changes: 10 additions & 0 deletions src/zeroconf/_listener.pxd
Expand Up @@ -37,6 +37,7 @@ cdef class AsyncListener:

cdef _cancel_any_timers_for_addr(self, object addr)

@cython.locals(incoming=DNSIncoming, deferred=list)
cpdef handle_query_or_defer(
self,
DNSIncoming msg,
Expand All @@ -45,3 +46,12 @@ cdef class AsyncListener:
object transport,
tuple v6_flow_scope
)

cpdef _respond_query(
self,
object msg,
object addr,
object port,
object transport,
tuple v6_flow_scope
)
2 changes: 1 addition & 1 deletion src/zeroconf/_listener.py
Expand Up @@ -220,7 +220,7 @@ def _respond_query(
addr: _str,
port: _int,
transport: _WrappedTransport,
v6_flow_scope: Union[Tuple[()], Tuple[int, int]] = (),
v6_flow_scope: Union[Tuple[()], Tuple[int, int]],
) -> None:
"""Respond to a query and reassemble any truncated deferred packets."""
self._cancel_any_timers_for_addr(addr)
Expand Down

0 comments on commit 56ef908

Please sign in to comment.