Skip to content

Commit 3430f61

Browse files
committed
tweaks
1 parent 3081ec8 commit 3430f61

1 file changed

Lines changed: 5 additions & 9 deletions

File tree

zeroconf/_handlers.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,10 @@ def _add_address_answers(
199199
def _answer_question(
200200
self, question: DNSQuestion, answer_set: _AnswerWithAdditionalsType, known_answers: DNSRRSet
201201
) -> None:
202+
if question.type == _TYPE_PTR and question.name.lower() == _SERVICE_TYPE_ENUMERATION_NAME:
203+
self._add_service_type_enumeration_query_answers(answer_set, known_answers)
204+
return
205+
202206
type_ = question.type
203207

204208
if type_ in (_TYPE_PTR, _TYPE_ANY):
@@ -221,14 +225,6 @@ def _answer_question(
221225
if not known_answers.suppresses(dns_text):
222226
answer_set[dns_text] = set()
223227

224-
def _answer_any_question(
225-
self, question: DNSQuestion, answer_set: _AnswerWithAdditionalsType, known_answers: DNSRRSet
226-
) -> None:
227-
if question.type == _TYPE_PTR and question.name.lower() == _SERVICE_TYPE_ENUMERATION_NAME:
228-
self._add_service_type_enumeration_query_answers(answer_set, known_answers)
229-
230-
return self._answer_question(question, answer_set, known_answers)
231-
232228
def response( # pylint: disable=unused-argument
233229
self, msgs: List[DNSIncoming], addr: Optional[str], port: int
234230
) -> Tuple[Optional[DNSOutgoing], Optional[DNSOutgoing]]:
@@ -239,7 +235,7 @@ def response( # pylint: disable=unused-argument
239235

240236
for question in itertools.chain(*[msg.questions for msg in msgs]):
241237
answer_set: _AnswerWithAdditionalsType = {}
242-
self._answer_any_question(question, answer_set, known_answers)
238+
self._answer_question(question, answer_set, known_answers)
243239
if not ucast_source and question.unicast:
244240
query_res.add_qu_question_response(answer_set)
245241
else:

0 commit comments

Comments
 (0)