Skip to content

Commit

Permalink
Fix #247
Browse files Browse the repository at this point in the history
  • Loading branch information
quinnj committed Jun 4, 2018
1 parent 4e64c07 commit 1ac16e7
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
32 changes: 24 additions & 8 deletions src/ConnectionPool.jl
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,11 @@ function IOExtras.closeread(t::Transaction)
notify(poolcondition)

if !isbusy(t.c)
@async monitor_idle_connection(t.c)
@static if VERSION < v"0.7.0-alpha.0"
@schedule monitor_idle_connection(t.c)
else
@async monitor_idle_connection(t.c)
end
end

@ensure !isreadable(t)
Expand Down Expand Up @@ -537,13 +541,25 @@ function getconnection(::Type{TCPSocket},
Base.connect!(tcp, Sockets.getaddrinfo(host), p)

timeout = Ref{Bool}(false)
@async begin
sleep(connect_timeout)
if tcp.status == Base.StatusConnecting
timeout[] = true
tcp.status = Base.StatusClosing
ccall(:jl_forceclose_uv, Nothing, (Ptr{Nothing},), tcp.handle)
#close(tcp)
@static if VERSION < v"0.7.0-alpha.0"
@schedule begin
sleep(connect_timeout)
if tcp.status == Base.StatusConnecting
timeout[] = true
tcp.status = Base.StatusClosing
ccall(:jl_forceclose_uv, Nothing, (Ptr{Nothing},), tcp.handle)
#close(tcp)
end
end
else
@async begin
sleep(connect_timeout)
if tcp.status == Base.StatusConnecting
timeout[] = true
tcp.status = Base.StatusClosing
ccall(:jl_forceclose_uv, Nothing, (Ptr{Nothing},), tcp.handle)
#close(tcp)
end
end
end
try
Expand Down
2 changes: 1 addition & 1 deletion src/compat.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

v06 = v"0.6.2"
v07 = v"0.7.0-DEV.4654"
v07 = v"0.7.0-alpha.0"

supported() = VERSION >= v07 ||
(VERSION >= v06 && VERSION < v"0.7.0-DEV")
Expand Down

0 comments on commit 1ac16e7

Please sign in to comment.