From ehuelsmann at common-lisp.net Mon Mar 9 22:32:33 2009 From: ehuelsmann at common-lisp.net (Erik Huelsmann) Date: Mon, 09 Mar 2009 22:32:33 +0000 Subject: [cl-irc-cvs] r212 - trunk Message-ID: Author: ehuelsmann Date: Mon Mar 9 22:32:32 2009 New Revision: 212 Log: Install sensible recovery routines for NO-SUCH-REPLY in the default message loop handlers: use the continue restart. Modified: trunk/protocol.lisp Modified: trunk/protocol.lisp ============================================================================== --- trunk/protocol.lisp (original) +++ trunk/protocol.lisp Mon Mar 9 22:32:32 2009 @@ -311,7 +311,14 @@ (flet ((select-handler (fd) (declare (ignore fd)) (if (listen (network-stream connection)) - (read-message connection) + (handler-bind + ;; install sensible recovery: nobody can wrap the + ;; handler... + ((no-such-reply + #'(lambda (c) + (declare (ignore c)) + (invoke-restart 'continue)))) + (read-message connection)) ;; select() returns with no ;; available data if the stream ;; has been closed on the other @@ -324,7 +331,14 @@ :input #'select-handler)) #-(and sbcl (not sb-thread)) - (flet ((do-loop () (read-message-loop connection))) + (flet ((do-loop () + (loop + (handler-bind + ((no-such-reply + #'(lambda (c) + (declare (ignore c)) + (invoke-restart 'continue)))) + (read-message-loop connection))))) (let ((name (format nil "irc-hander-~D" (incf *process-count*)))) (start-process #'do-loop name))))