-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -582,13 +582,27 @@ function getaddrinfo(cb::Function, host::ASCIIString) | |
end | ||
getaddrinfo(cb::Function, host::AbstractString) = getaddrinfo(cb,ascii(host)) | ||
|
||
|
||
type DNSError <: Exception | ||
uverror::UVError | ||
host::AbstractString | ||
end | ||
|
||
function show(io::IO, e::DNSError) | ||
print(io, "DNSError: ", e.host, ", ") | ||
show(io, e.uverror) | ||
end | ||
|
||
function getaddrinfo(host::ASCIIString) | ||
c = Condition() | ||
getaddrinfo(host) do IP | ||
notify(c,IP) | ||
end | ||
ip = wait(c) | ||
isa(ip,UVError) && throw(ip) | ||
if isa(ip,UVError) | ||
@assert ip.code in [UV_EAI_NONAME, UV_EAI_AGAIN] | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
samoconnor
Author
Owner
|
||
throw(DNSError(ip, host)) | ||
end | ||
return ip::IPAddr | ||
end | ||
getaddrinfo(host::AbstractString) = getaddrinfo(ascii(host)) | ||
|
should throw the actual
UVError
if the code isn't one of these