From 839336f47925bcfc9806cc31931eb9df1b577fbf Mon Sep 17 00:00:00 2001 From: "Steven G. Johnson" Date: Fri, 30 Dec 2016 17:01:04 -0500 Subject: [PATCH] use invokelatest in libuv getaddrinfo callback --- base/socket.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/base/socket.jl b/base/socket.jl index bea4c64454387d..0909f230f4981d 100644 --- a/base/socket.jl +++ b/base/socket.jl @@ -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)