Skip to content

Commit

Permalink
fix: skip null txt record
Browse files Browse the repository at this point in the history
Do not try to send a txt record when information for sending
it out is missing. Before this if there was a TXT record request
it did raise an Exception instead of just not returning
the information.
  • Loading branch information
Christoph Brand committed Oct 4, 2022
1 parent e7b1087 commit 40d09b7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/mdns_client/responder.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,12 @@ def _on_txt_question(self, question: DNSQuestion) -> None:
if service is None:
return

txt_record = self._txt_record_for(service)
if txt_record is None:
return

self._dprint("Responding to DNS TXT question for {}".format(query))
srv_answers = [self._txt_record_for(service)]
srv_answers = [txt_record]
self._send_response(srv_answers)

def _get_service_of(self, query: str) -> "Optional[str]":
Expand Down

0 comments on commit 40d09b7

Please sign in to comment.