Skip to content

Commit 7f91b8a

Browse files
authored
Workaround for missing isopen check in FDWatcher (#161)
(possible multithread race with this still needs to be fixed)
1 parent 62b497e commit 7f91b8a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Curl/Multi.jl

+3-2
Original file line numberDiff line numberDiff line change
@@ -150,16 +150,17 @@ function socket_callback(
150150
preserve_handle(watcher)
151151
watcher_p = pointer_from_objref(watcher)
152152
@check curl_multi_assign(multi.handle, sock, watcher_p)
153-
task = @async while true
153+
task = @async while watcher.readable || watcher.writable # isopen(watcher)
154154
events = try wait(watcher)
155155
catch err
156-
err isa EOFError && break
156+
err isa EOFError && return
157157
rethrow()
158158
end
159159
flags = CURL_CSELECT_IN * isreadable(events) +
160160
CURL_CSELECT_OUT * iswritable(events) +
161161
CURL_CSELECT_ERR * events.disconnect
162162
lock(multi.lock) do
163+
watcher.readable || watcher.writable || return # !isopen
163164
@check curl_multi_socket_action(multi.handle, sock, flags)
164165
check_multi_info(multi)
165166
end

0 commit comments

Comments
 (0)