Skip to content

Commit

Permalink
Workaround for missing isopen check in FDWatcher (JuliaLang#161)
Browse files Browse the repository at this point in the history
(possible multithread race with this still needs to be fixed)

(cherry picked from commit 7f91b8a)
  • Loading branch information
vtjnash authored and ericphanson committed Jan 27, 2022
1 parent 5a962e8 commit 1dbb654
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Curl/Multi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -150,16 +150,17 @@ function socket_callback(
preserve_handle(watcher)
watcher_p = pointer_from_objref(watcher)
@check curl_multi_assign(multi.handle, sock, watcher_p)
task = @async while true
task = @async while watcher.readable || watcher.writable # isopen(watcher)
events = try wait(watcher)
catch err
err isa EOFError && break
err isa EOFError && return
rethrow()
end
flags = CURL_CSELECT_IN * isreadable(events) +
CURL_CSELECT_OUT * iswritable(events) +
CURL_CSELECT_ERR * events.disconnect
lock(multi.lock) do
watcher.readable || watcher.writable || return # !isopen
@check curl_multi_socket_action(multi.handle, sock, flags)
check_multi_info(multi)
end
Expand Down

0 comments on commit 1dbb654

Please sign in to comment.