mirror of
https://github.com/vale981/emacs-jupyter
synced 2025-03-05 07:41:37 -05:00
Use jupyter-channel-alive-p
instead of testing socket directly
* jupyter-channels (jupyter-hb-pause, jupyter-channel--reset-socket): Do it. (jupyter-start-channel): Always reset the socket.
This commit is contained in:
parent
bd5d4d3eea
commit
19868e3ec9
1 changed files with 4 additions and 5 deletions
|
@ -167,7 +167,7 @@ use `jupyter-hb-unpause'."))
|
|||
(cl-defmethod jupyter-hb-unpause ((channel jupyter-hb-channel))
|
||||
"Un-pause checking for heatbeat events on CHANNEL."
|
||||
(when (oref channel paused)
|
||||
(if (not (zmq-socket-p (oref channel socket)))
|
||||
(if (not (jupyter-channel-alive-p channel))
|
||||
(jupyter-start-channel channel)
|
||||
(oset channel paused nil)
|
||||
(jupyter-hb--send-ping channel))))
|
||||
|
@ -194,9 +194,8 @@ If CHANNEL already has a socket in its socket slot, close it and
|
|||
open and connect a new one, re-using the IDENTITY of the socket.
|
||||
In this case the IDENTITY argument is ignored."
|
||||
(cl-assert (object-of-class-p channel 'jupyter-channel))
|
||||
;; TODO: More places to use `with-slots'
|
||||
(with-slots (socket endpoint) channel
|
||||
(when (zmq-socket-p socket)
|
||||
(when (jupyter-channel-alive-p channel)
|
||||
(setq identity (zmq-socket-get socket zmq-IDENTITY))
|
||||
(zmq-close socket))
|
||||
(oset channel socket (jupyter-connect-channel :hb endpoint identity))))
|
||||
|
@ -231,8 +230,8 @@ heartbeat channel is handled specially in that it is implemented
|
|||
with a timer in the current Emacs session. Starting a heartbeat
|
||||
channel, starts the timer."
|
||||
(unless (jupyter-channel-alive-p channel)
|
||||
(jupyter-channel--reset-socket channel identity))
|
||||
(jupyter-hb-unpause channel))
|
||||
(jupyter-channel--reset-socket channel identity)
|
||||
(jupyter-hb-unpause channel)))
|
||||
|
||||
(provide 'jupyter-channels)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue