Skip to content

Commit c744776

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 b6b104f commit c744776

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
@@ -237,7 +237,9 @@ function shutdown_request(socket, kernel, msg)
237237
global _shutting_down[] = true
238238
@async Base.throwto(kernel.requests_task[], InterruptException())
239239

240-
send_ipython(kernel.requests[], kernel,
240+
# In protocol 5.4 the shutdown reply moved to the control socket
241+
shutdown_socket = VersionNumber(msg) >= v"5.4" ? kernel.control[] : kernel.requests[]
242+
send_ipython(shutdown_socket, kernel,
241243
msg_reply(msg, "shutdown_reply", msg.content))
242244
sleep(0.1) # short delay (like in ipykernel), to hopefully ensure shutdown_reply is sent
243245
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)