X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=impl-cmucl.lisp;h=c98a05ea24ef31fba1ef77d374b8785be6a2dcbf;hb=fb31277c5dace4cc9cf731c42e5034ace9dc31f2;hp=fc45602e6c3ada52e77e56caabf577d6b6193f80;hpb=118ee93d69e2b09d12eb317f6db3fbda113be82f;p=cl-modlisp.git diff --git a/impl-cmucl.lisp b/impl-cmucl.lisp index fc45602..c98a05e 100644 --- a/impl-cmucl.lisp +++ b/impl-cmucl.lisp @@ -4,19 +4,21 @@ (defun make-socket-server (name function port &key wait (format :text)) - (mp:make-process - (lambda () (make-apache-listener port function)) - :name name)) + (let ((listener (ext:create-inet-listener port))) + (values + (mp:make-process + (lambda () (start-socket-server listener function)) + :name name) + listener))) -(defun make-apache-listener (port function) - (let ((socket (ext:create-inet-listener port))) - (unwind-protect - (loop - (mp:process-wait-until-fd-usable socket :input) - (multiple-value-bind (new-fd remote-host) - (ext:accept-tcp-connection socket) - (let ((stream (sys:make-fd-stream new-fd :input t :output t))) - (mp:make-process - (lambda () (apache-command-issuer stream function)) - :name (next-worker-name))))) - (unix:unix-close socket)))) +(defun start-socket-server (listener function) + (unwind-protect + (loop + (mp:process-wait-until-fd-usable listener :input) + (multiple-value-bind (new-fd remote-host) + (ext:accept-tcp-connection listener) + (let ((stream (sys:make-fd-stream new-fd :input t :output t))) + (mp:make-process + (lambda () (apache-command-issuer stream function)) + :name (next-worker-name))))) + (unix:unix-close listener)))