Paste number 313413: mainloop

Paste number 313413: mainloop
Pasted by: phf
When:2 years, 11 months ago
Share:Tweet this! | http://paste.lisp.org/+6PTX
Channel:None
Paste contents:
Raw Source | XML | Display As
(loop
   (let* ((td (- (get-universal-time) (or *last-pong* 0))))
     (setq *connection-state*
           (ecase *connection-state*
             (:connected (cond ((>= td 30) :needs-ping)
                               (t :connected)))
             (:needs-ping (ignore-errors (irc:ping *connection* (prin1-to-string ts)))
                          :waiting-ping)
             (:waiting-ping (cond ((< td 30) :connected)
                                  ((> td 60) :disconnect)
                                  (t :waiting-ping)))
             (:disconnect (ignore-errors (irc-disconnect *connection*))
                          (mp:destroy-process *connection-event-process*)
                          :disconnected))))
   (sleep 1))

This paste has no annotations.

Colorize as:
Show Line Numbers

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.