Skip to content

Commit 1ba444e

Browse files
committed
Send shutdown_reply on the control socket for protocol 5.4
This is the only change in 5.4, in previous versions it was sent on the shell socket.
1 parent 48e7a20 commit 1ba444e

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/handlers.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,9 @@ function shutdown_request(socket, kernel, msg)
217217
# stop heartbeat thread by closing the context
218218
close(kernel.heartbeat_context[])
219219

220-
send_ipython(kernel.requests[], kernel,
220+
# In protocol 5.4 the shutdown reply moved to the control socket
221+
shutdown_socket = VersionNumber(msg) >= v"5.4" ? kernel.control[] : kernel.requests[]
222+
send_ipython(shutdown_socket, kernel,
221223
msg_reply(msg, "shutdown_reply", msg.content))
222224
sleep(0.1) # short delay (like in ipykernel), to hopefully ensure shutdown_reply is sent
223225
kernel.shutdown()

src/msg.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ msg_header(m::Msg, msg_type::String) = Dict("msg_id" => uuid4(),
1414
"msg_type" => msg_type,
1515
"version" => "5.4")
1616

17+
Base.VersionNumber(m::Msg) = VersionNumber(m.header["version"])
18+
1719
# PUB/broadcast messages use the msg_type as the ident, except for
1820
# stream messages which use the stream name (e.g. "stdout").
1921
# [According to minrk, "this isn't well defined, or even really part

0 commit comments

Comments
 (0)