Skip to content

Commit

Permalink
Move creating a socket for a DoH query into the address's try..except
Browse files Browse the repository at this point in the history
block so if creating fails, e.g. due to no IPv6, we try other addressess
if we've got any.  [#1169]
  • Loading branch information
rthalley committed Dec 14, 2024
1 parent 049777d commit 19a5f04
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions dns/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ def connect_tcp(
)
else:
source = None
sock = _make_socket(af, socket.SOCK_STREAM, source)
attempt_expiration = _expiration_for_this_attempt(2.0, expiration)
try:
sock = _make_socket(af, socket.SOCK_STREAM, source)
attempt_expiration = _expiration_for_this_attempt(2.0, expiration)
_connect(
sock,
dns.inet.low_level_address_tuple((address, port), af),
Expand Down

0 comments on commit 19a5f04

Please sign in to comment.