@@ -124,9 +124,25 @@ def _add_answers_additionals(out: DNSOutgoing, answers: _AnswerWithAdditionalsTy
124124class _QueryResponse :
125125 """A pair for unicast and multicast DNSOutgoing responses."""
126126
127+ __slots__ = (
128+ "_is_probe" ,
129+ "_msg" ,
130+ "_now" ,
131+ "_cache" ,
132+ "_additionals" ,
133+ "_ucast" ,
134+ "_mcast_now" ,
135+ "_mcast_aggregate" ,
136+ "_mcast_aggregate_last_second" ,
137+ )
138+
127139 def __init__ (self , cache : DNSCache , msgs : List [DNSIncoming ]) -> None :
128140 """Build a query response."""
129- self ._is_probe = any (msg .is_probe for msg in msgs )
141+ self ._is_probe = False
142+ for msg in msgs :
143+ if msg .is_probe :
144+ self ._is_probe = True
145+ break
130146 self ._msg = msgs [0 ]
131147 self ._now = self ._msg .now
132148 self ._cache = cache
@@ -212,6 +228,8 @@ def _has_mcast_record_in_last_second(self, record: DNSRecord) -> bool:
212228class QueryHandler :
213229 """Query the ServiceRegistry."""
214230
231+ __slots__ = ("registry" , "cache" , "question_history" )
232+
215233 def __init__ (self , registry : ServiceRegistry , cache : DNSCache , question_history : QuestionHistory ) -> None :
216234 """Init the query handler."""
217235 self .registry = registry
@@ -345,6 +363,8 @@ def async_response( # pylint: disable=unused-argument
345363class RecordManager :
346364 """Process records into the cache and notify listeners."""
347365
366+ __slots__ = ("zc" , "cache" , "listeners" )
367+
348368 def __init__ (self , zeroconf : 'Zeroconf' ) -> None :
349369 """Init the record manager."""
350370 self .zc = zeroconf
@@ -516,6 +536,8 @@ def async_remove_listener(self, listener: RecordUpdateListener) -> None:
516536class MulticastOutgoingQueue :
517537 """An outgoing queue used to aggregate multicast responses."""
518538
539+ __slots__ = ("zc" , "queue" , "additional_delay" , "aggregation_delay" )
540+
519541 def __init__ (self , zeroconf : 'Zeroconf' , additional_delay : int , max_aggregation_delay : int ) -> None :
520542 self .zc = zeroconf
521543 self .queue : deque = deque ()
0 commit comments