@@ -124,9 +124,25 @@ def _add_answers_additionals(out: DNSOutgoing, answers: _AnswerWithAdditionalsTy
124
124
class _QueryResponse :
125
125
"""A pair for unicast and multicast DNSOutgoing responses."""
126
126
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
+
127
139
def __init__ (self , cache : DNSCache , msgs : List [DNSIncoming ]) -> None :
128
140
"""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
130
146
self ._msg = msgs [0 ]
131
147
self ._now = self ._msg .now
132
148
self ._cache = cache
@@ -212,6 +228,8 @@ def _has_mcast_record_in_last_second(self, record: DNSRecord) -> bool:
212
228
class QueryHandler :
213
229
"""Query the ServiceRegistry."""
214
230
231
+ __slots__ = ("registry" , "cache" , "question_history" )
232
+
215
233
def __init__ (self , registry : ServiceRegistry , cache : DNSCache , question_history : QuestionHistory ) -> None :
216
234
"""Init the query handler."""
217
235
self .registry = registry
@@ -345,6 +363,8 @@ def async_response( # pylint: disable=unused-argument
345
363
class RecordManager :
346
364
"""Process records into the cache and notify listeners."""
347
365
366
+ __slots__ = ("zc" , "cache" , "listeners" )
367
+
348
368
def __init__ (self , zeroconf : 'Zeroconf' ) -> None :
349
369
"""Init the record manager."""
350
370
self .zc = zeroconf
@@ -516,6 +536,8 @@ def async_remove_listener(self, listener: RecordUpdateListener) -> None:
516
536
class MulticastOutgoingQueue :
517
537
"""An outgoing queue used to aggregate multicast responses."""
518
538
539
+ __slots__ = ("zc" , "queue" , "additional_delay" , "aggregation_delay" )
540
+
519
541
def __init__ (self , zeroconf : 'Zeroconf' , additional_delay : int , max_aggregation_delay : int ) -> None :
520
542
self .zc = zeroconf
521
543
self .queue : deque = deque ()
0 commit comments