-
-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathcontrol.lisp
53 lines (39 loc) · 1.84 KB
/
control.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
(in-package #:jupyter)
#|
# The Control channel #
|#
(defclass control-channel (channel)
()
(:documentation "Control channel class."))
#|
# Message sending functions
|#
(defun send-shutdown-reply (ch restart)
(message-send ch
(make-message (channel-session ch) "shutdown_reply"
`(:object-alist
("restart" ,restart)))))
(defun send-interrupt-reply (ch)
(message-send ch
(make-message (channel-session ch) "interrupt_reply"
:empty-object)))
(defun send-debug-reply (&optional body &aux (control (kernel-control *kernel*))
(content (message-content *message*)))
(message-send control
(make-message (channel-session control) "debug_reply"
(list :object-plist
"type" "response"
"request_seq" (gethash "seq" content)
"success" :true
"command" (gethash "command" content "command")
"body" (or body :empty-object)))))
(defun send-debug-reply-failure (message &aux (control (kernel-control *kernel*))
(content (message-content *message*)))
(message-send control
(make-message (channel-session control) "debug_reply"
(list :object-plist
"type" "response"
"request_seq" (gethash "seq" content)
"success" :false
"command" (gethash "command" content)
"message" message))))