Skip to content

Commit

Permalink
Fix 0.7 compat
Browse files Browse the repository at this point in the history
  • Loading branch information
quinnj committed Jun 5, 2018
1 parent 6cfcbce commit bb94204
Showing 1 changed file with 34 additions and 14 deletions.
48 changes: 34 additions & 14 deletions src/ssl.jl
Original file line number Diff line number Diff line change
Expand Up @@ -180,22 +180,42 @@ function handshake(ctx::SSLContext)
end
ctx.isopen = true

@async while isopen(ctx)
# Ensure that libuv is reading data from the socket in case the peer
# has sent a close_notify message on an otherwise idle connection.
# https://tools.ietf.org/html/rfc5246#section-7.2.1
Base.start_reading(ctx.bio)
try
wait(ctx.bio.readnotify)
catch e
if e isa Base.UVError
# Ignore read errors (UVError ECONNRESET)
# https://github.com/JuliaWeb/MbedTLS.jl/issues/148
else
rethrow(e)
@static if VERSION < v"0.7.0-alpha.0"
@schedule while isopen(ctx)
# Ensure that libuv is reading data from the socket in case the peer
# has sent a close_notify message on an otherwise idle connection.
# https://tools.ietf.org/html/rfc5246#section-7.2.1
Base.start_reading(ctx.bio)
try
wait(ctx.bio.readnotify)
catch e
if e isa Base.UVError
# Ignore read errors (UVError ECONNRESET)
# https://github.com/JuliaWeb/MbedTLS.jl/issues/148
else
rethrow(e)
end
end
yield()
end
else
@async while isopen(ctx)
# Ensure that libuv is reading data from the socket in case the peer
# has sent a close_notify message on an otherwise idle connection.
# https://tools.ietf.org/html/rfc5246#section-7.2.1
Base.start_reading(ctx.bio)
try
wait(ctx.bio.readnotify)
catch e
if e isa Base.UVError
# Ignore read errors (UVError ECONNRESET)
# https://github.com/JuliaWeb/MbedTLS.jl/issues/148
else
rethrow(e)
end
end
yield()
end
yield()
end

return
Expand Down

0 comments on commit bb94204

Please sign in to comment.