Skip to content

Commit

Permalink
Tcp monitor per
Browse files Browse the repository at this point in the history
  • Loading branch information
samoconnor committed Apr 17, 2018
1 parent 597c0c7 commit 7dd1d92
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/ConnectionPool.jl
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,7 @@ function getconnection(::Type{Transaction{T}},
busy = findall(T, host, port, pipeline_limit)
if length(busy) < connection_limit
io = getconnection(T, host, port; kw...)
@schedule tcp_monitor(io)
c = Connection(host, port,
pipeline_limit, idle_timeout,
io)
Expand Down Expand Up @@ -488,6 +489,16 @@ struct ConnectTimeout <: Exception
port
end

function tcp_monitor(io)
tcp = tcpsocket(io)
while isopen(io)
Base.start_reading(tcp)
wait(tcp.readnotify)
yield()
end
close(tcp)
end

function getconnection(::Type{TCPSocket},
host::AbstractString,
port::AbstractString;
Expand Down

0 comments on commit 7dd1d92

Please sign in to comment.