Skip to content

Commit 8923a40

Browse files
committed
allow initiating peer to close stream gracefully
I have a usecase where I would like to remove a worker without killing it. Currently, trying to disconnect from the head node will cause the message handler loop to throw a fatal exception, so this adds a check that the connection is still open when trying to read new messages.
1 parent 8799660 commit 8923a40

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/process_messages.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ function message_handler_loop(r_stream::IO, w_stream::IO, incoming::Bool)
167167

168168
readbytes!(r_stream, boundary, length(MSG_BOUNDARY))
169169

170-
while true
170+
while !(incoming && eof(r_stream))
171171
reset_state(serializer)
172172
header = deserialize_hdr_raw(r_stream)
173173
# println("header: ", header)

0 commit comments

Comments
 (0)