Skip to content

Commit

Permalink
use invokelatest in libuv getaddrinfo callback
Browse files Browse the repository at this point in the history
  • Loading branch information
stevengj committed Dec 31, 2016
1 parent fd4b371 commit 839336f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions base/socket.jl
Original file line number Diff line number Diff line change
Expand Up @@ -584,18 +584,18 @@ function uv_getaddrinfocb(req::Ptr{Void}, status::Cint, addrinfo::Ptr{Void})
cb = unsafe_pointer_to_objref(data)::Function
pop!(callback_dict,cb) # using pop forces an error if cb not in callback_dict
if status != 0 || addrinfo == C_NULL
cb(UVError("uv_getaddrinfocb received an unexpected status code", status))
invokelatest(cb, UVError("uv_getaddrinfocb received an unexpected status code", status))
else
freeaddrinfo = addrinfo
while addrinfo != C_NULL
sockaddr = ccall(:jl_sockaddr_from_addrinfo, Ptr{Void}, (Ptr{Void},), addrinfo)
if ccall(:jl_sockaddr_is_ip4, Int32, (Ptr{Void},), sockaddr) == 1
cb(IPv4(ntoh(ccall(:jl_sockaddr_host4, UInt32, (Ptr{Void},), sockaddr))))
invokelatest(cb, IPv4(ntoh(ccall(:jl_sockaddr_host4, UInt32, (Ptr{Void},), sockaddr))))
break
#elseif ccall(:jl_sockaddr_is_ip6, Int32, (Ptr{Void},), sockaddr) == 1
# host = Array{UInt128}(1)
# scope_id = ccall(:jl_sockaddr_host6, UInt32, (Ptr{Void}, Ptr{UInt128}), sockaddr, host)
# cb(IPv6(ntoh(host[1])))
# invokelatest(cb, IPv6(ntoh(host[1])))
# break
end
addrinfo = ccall(:jl_next_from_addrinfo, Ptr{Void}, (Ptr{Void},), addrinfo)
Expand Down

0 comments on commit 839336f

Please sign in to comment.