File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change
1
+ Fixed DNS resolution on platforms that don't support ``socket.AI_ADDRCONFIG`` -- by :user:`maxbachmann`.
Original file line number Diff line number Diff line change 18
18
19
19
_NUMERIC_SOCKET_FLAGS = socket .AI_NUMERICHOST | socket .AI_NUMERICSERV
20
20
_NAME_SOCKET_FLAGS = socket .NI_NUMERICHOST | socket .NI_NUMERICSERV
21
+ _AI_ADDRCONFIG = socket .AI_ADDRCONFIG
22
+ if hasattr (socket , "AI_MASK" ):
23
+ _AI_ADDRCONFIG &= socket .AI_MASK
21
24
22
25
23
26
class ThreadedResolver (AbstractResolver ):
@@ -38,7 +41,7 @@ async def resolve(
38
41
port ,
39
42
type = socket .SOCK_STREAM ,
40
43
family = family ,
41
- flags = socket . AI_ADDRCONFIG ,
44
+ flags = _AI_ADDRCONFIG ,
42
45
)
43
46
44
47
hosts : List [ResolveResult ] = []
@@ -105,7 +108,7 @@ async def resolve(
105
108
port = port ,
106
109
type = socket .SOCK_STREAM ,
107
110
family = family ,
108
- flags = socket . AI_ADDRCONFIG ,
111
+ flags = _AI_ADDRCONFIG ,
109
112
)
110
113
except aiodns .error .DNSError as exc :
111
114
msg = exc .args [1 ] if len (exc .args ) >= 1 else "DNS lookup failed"
You can’t perform that action at this time.
0 commit comments