Skip to content

Commit 22e6b0e

Browse files
committed
Handle control channel properly
This should have already been done since we are supposedly supporting Jupyter protocol 5.3 which already specifies the control channel stuff. * jupyter-base.el (jupyter-channel-from-request-type): Send a shutdown_request on the control channel. * jupyter-client.el (jupyter--client-handlers): Add control channel handler.
1 parent 007bacf commit 22e6b0e

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

jupyter-base.el

+1-1
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ call the handler methods of those types."
494494
"Return the name of the channel that a request with TYPE is sent on."
495495
(pcase type
496496
((or "input_reply" "input_request") "stdin")
497-
("interrupt_request" "control")
497+
((or "interrupt_request" "shutdown_request") "control")
498498
(_ "shell")))
499499

500500
(declare-function jupyter-message-time "jupyter-messages")

jupyter-client.el

+17-15
Original file line numberDiff line numberDiff line change
@@ -591,24 +591,26 @@ waiting."
591591
(defconst jupyter--client-handlers
592592
(cl-labels
593593
((handler-alist
594-
(&rest msg-types)
595-
(cl-loop
596-
for mt in msg-types
597-
collect (cons mt (intern
598-
(format "jupyter-handle-%s"
599-
(replace-regexp-in-string
600-
"_" "-" mt)))))))
594+
(&rest msg-types)
595+
(cl-loop
596+
for mt in msg-types
597+
collect (cons mt (intern
598+
(format "jupyter-handle-%s"
599+
(replace-regexp-in-string
600+
"_" "-" mt)))))))
601601
`(("iopub" . ,(handler-alist
602-
"shutdown_reply" "stream" "comm_open" "comm_msg"
603-
"comm_close" "execute_input" "execute_result"
604-
"error" "status" "clear_output" "display_data"
605-
"update_display_data"))
602+
"shutdown_reply" "stream" "comm_open" "comm_msg"
603+
"comm_close" "execute_input" "execute_result"
604+
"error" "status" "clear_output" "display_data"
605+
"update_display_data"))
606606
("shell" . ,(handler-alist
607-
"execute_reply" "shutdown_reply" "inspect_reply"
608-
"complete_reply" "history_reply" "is_complete_reply"
609-
"comm_info_reply" "kernel_info_reply"))
607+
"execute_reply" "shutdown_reply" "interrupt_reply" "inspect_reply"
608+
"complete_reply" "history_reply" "is_complete_reply"
609+
"comm_info_reply" "kernel_info_reply"))
610+
("control" . ,(handler-alist
611+
"shutdown_reply" "interrupt_reply"))
610612
("stdin" . ,(handler-alist
611-
"input_reply" "input_request")))))
613+
"input_reply" "input_request")))))
612614

613615
(defun jupyter--run-handler-maybe (client channel msg req)
614616
(when (and (jupyter--request-allows-handler-p req msg)

0 commit comments

Comments
 (0)