r5233: *** empty log message ***
[cl-modlisp.git] / impl-cmucl.lisp
index fc45602e6c3ada52e77e56caabf577d6b6193f80..c98a05ea24ef31fba1ef77d374b8785be6a2dcbf 100644 (file)
@@ -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)))