Update of /project/net-nittin-irc/cvsroot/net-nittin-irc In directory common-lisp.net:/tmp/cvs-serv24683
Modified Files: package.lisp protocol.lisp Log Message: remove read-message-loop-background, subsume add-asynchronous-message-handler Date: Tue Dec 16 18:27:25 2003 Author: krosenberg
Index: net-nittin-irc/package.lisp diff -u net-nittin-irc/package.lisp:1.14 net-nittin-irc/package.lisp:1.15 --- net-nittin-irc/package.lisp:1.14 Tue Dec 16 17:45:54 2003 +++ net-nittin-irc/package.lisp Tue Dec 16 18:27:25 2003 @@ -1,4 +1,4 @@ -;;;; $Id: package.lisp,v 1.14 2003/12/16 22:45:54 krosenberg Exp $ +;;;; $Id: package.lisp,v 1.15 2003/12/16 23:27:25 krosenberg Exp $ ;;;; $Source: /project/net-nittin-irc/cvsroot/net-nittin-irc/package.lisp,v $
;;;; See the LICENSE file for licensing information. @@ -12,8 +12,7 @@ (:nicknames :irc :cl-irc) (:export :read-message-loop :read-message - :read-message-loop-background - :add-asynchronous-message-handler + :start-background-message-handler :send-message :server-name :no-such-reply
Index: net-nittin-irc/protocol.lisp diff -u net-nittin-irc/protocol.lisp:1.27 net-nittin-irc/protocol.lisp:1.28 --- net-nittin-irc/protocol.lisp:1.27 Tue Dec 16 18:21:56 2003 +++ net-nittin-irc/protocol.lisp Tue Dec 16 18:27:25 2003 @@ -1,4 +1,4 @@ -;;;; $Id: protocol.lisp,v 1.27 2003/12/16 23:21:56 krosenberg Exp $ +;;;; $Id: protocol.lisp,v 1.28 2003/12/16 23:27:25 krosenberg Exp $ ;;;; $Source: /project/net-nittin-irc/cvsroot/net-nittin-irc/protocol.lisp,v $
;;;; See LICENSE for licensing information. @@ -107,16 +107,6 @@ (let ((stream (server-stream connection))) (and (streamp stream) (open-stream-p stream)))) - -(defmethod add-asynchronous-message-handler ((connection connection)) - #+sbcl - (sb-sys:add-fd-handler (sb-bsd-sockets:socket-file-descriptor - (server-socket connection)) - :input (lambda (fd) - (declare (ignore fd)) - (read-message connection))) - #-sbcl - (error "add-asynchronous-message-handler is not supported now on non-SBCL"))
(defmethod read-message ((connection connection)) (let ((read-more-p t)) @@ -130,18 +120,22 @@ message))) ; needed because of the "loop while" in read-message-loop (stream-error () (setf read-more-p nil)))))
-(defvar *background-count* 0) -(defmethod read-message-loop-background ((connection connection)) +(defvar *process-count* 0) +(defmethod start-background-message-handler ((connection connection)) "Read messages from the `connection', parse them and dispatch irc-message-event on them." (flet ((do-loop () (read-message-loop connection))) - (let ((name (format nil "irc-hander-~D" (incf *background-count*)))) + (let ((name (format nil "irc-hander-~D" (incf *process-count*)))) #+allegro (mp:process-run-function name #'do-loop) #+cmu (mp:make-process #'do-loop :name name) #+lispworks (mp:process-run-function name nil #'do-loop) #+sbcl-thread (sb-thread:make-thread #'do-loop) - #+(and sbcl (not sbcl-thread)) (add-asynchronous-message-handler - connection)))) + #+(and sbcl (not sbcl-thread)) + (sb-sys:add-fd-handler (sb-bsd-sockets:socket-file-descriptor + (server-socket connection)) + :input (lambda (fd) + (declare (ignore fd)) + (read-message connection))))))
(defmethod read-message-loop ((connection connection)) (loop while (read-message connection)))
net-nittin-irc-cvs@common-lisp.net