diff --git a/core/core.lisp b/core/core.lisp index 807b072..0159ba0 100644 --- a/core/core.lisp +++ b/core/core.lisp @@ -84,7 +84,7 @@ (defgeneric do-listen (ctx) (:method ((ctx service)) (do ((r (do-step ctx) (do-step ctx))) - ((not r))))) + ((eql r '(:quit)))))) (defgeneric do-step (ctx) (:method ((ctx service)) @@ -120,7 +120,6 @@ (progn (setup-services cfg) (do-listen *root*)) - ;(lpq:pop-queue *quit-queue*)) (shutdown))) (defun add-action (ctx pat hdlr) @@ -138,22 +137,17 @@ (dolist (a (config:actions cfg)) (add-action child (car a) (cadr a))) (setf (gethash (config:name cfg) services) child) - (do-start child) - )))) - + (do-start child))))) (defgeneric handle-message (ctx msg) (:method ((ctx base-context) msg) - (cond - ((do-actions ctx msg) t) - (t (util:lgw "no action selected" msg))))) + (do-actions ctx msg))) (defun do-actions (ctx msg &optional (acts #'actions)) (let ((hdlrs (select msg (funcall acts ctx)))) - (when hdlrs - (dolist (hdlr hdlrs) - (funcall hdlr ctx msg)) - t))) + (if hdlrs + (mapcar #'(lambda (hdlr) (funcall hdlr ctx msg)) hdlrs) + (util:lgw "no action selected" msg)))) ;;;; some simple predefined actions