r5232: *** empty log message ***
[cl-modlisp.git] / base.lisp
index 07cc986ed44c756670cf046d4b2c6ed05909afd6..15ff3e12a450b4b42d3b2cfd136ad3292735b25e 100644 (file)
--- a/base.lisp
+++ b/base.lisp
@@ -7,7 +7,7 @@
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Dec 2002
 ;;;;
-;;;; $Id: base.lisp,v 1.1 2003/07/04 19:52:32 kevin Exp $
+;;;; $Id: base.lisp,v 1.2 2003/07/04 22:41:06 kevin Exp $
 ;;;; *************************************************************************
 
 (in-package #:modlisp)
       (*listener-process* nil))
 
   (defun modlisp-start (&key (port +default-apache-port+)
-                            (function 'sample-process-apache-command))
+                            (function 'demo-apache-command-processor))
     (handler-case
-       (make-socket-server (next-server-name) function port :format :text
-                           :wait nil)
+       (make-socket-server (next-server-name) function port
+                           :format :text :wait nil)
       (error (e)
        (format t "Error ~A" e)
        (decf *listener-count*)
        nil)
-      (:no-error (proc socket)
+      (:no-error (process socket)
        (setq *listener-socket* socket)
-       (setq *listener-proc* proc)
-       proc)))
-
+       (setq *listener-process* process)
+       process)))
+  
   (defun modlisp-stop ()
-    (when *listener-proc*
-      (format t "~&; killing ~d~%" *listener-proc*)
-      #+sbcl (sb-unix:unix-kill *listener-proc* :sigalrm)
-      #+allegro (mp:process-kill *listener-proc*)
+    (when *listener-process*
+      (format t "~&; killing process ~d~%" *listener-process*)
+      #+sbcl (sb-thread:destory-thread *listener-process*)
+      #+allegro (mp:process-kill *listener-process*)
       #+allegro (mp:process-allow-schedule)
-      )
-    (setq *listener-proc* nil)
+      #+lispworks (mp:process-kill *listener-process*)
+      #+cmucl (mp:destroy process *listener-process*)
+      (setq *listener-process* nil))
     (when *listener-socket* 
       (ignore-errors (close *listener-socket*))
       (setq *listener-socket* nil)))
@@ -51,9 +52,7 @@
   (format nil "modlisp-worker-~d" (incf *worker-count*)))
 
 
-(defun apache-command-issuer (*apache-socket*
-                             &optional
-                             (processor-fun 'demo-apache-command-processor))
+(defun apache-command-issuer (*apache-socket* processor-fun)
   "generates commands from apache, issues commands to processor-fun"
   (let ((*close-apache-socket* t))
     (unwind-protect
 (defun debug-table (command)
   (with-output-to-string (s)
    (write-string "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">
-<HTML><HEAD></HEAD><BODY><TABLE bgcolor=\"#c0c0c0\">
-<TR bgcolor=\"yellow\"><TH COLSPAN=2>ACL 6.2 + mod_lisp 2.0 + apache + Linux</TH></TR>
-<TR bgcolor=\"yellow\"><TH>Key</TH><TH>Value</TH></TR>" s)
+<html><head></head>
+<body>
+<table><tbody>
+<tr><t colspan=\"2\">mod_lisp debug</th></tr>
+<tr><th>Key</th><th>Value</th></tr>" s)
    (format s "<TR bgcolor=\"#F0F0c0\"><TD>apache-nb-use-socket</TD><TD>~a</TD></TR>"  *apache-nb-use-socket*)
    (loop for (key . value) in command do
-        (format s "<TR bgcolor=\"#F0F0c0\"><TD>~a</TD><TD>~a</TD></TR>" key value))
-   (write-string "</TABLE></BODY></HTML>" s)))
+        (format s "<tr><td>~a</td><td>~a</td></tr>" key value))
+   (write-string "</tbody></table></body></html>" s)))
 
 (defun fixed-html ()
   "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">
-<HTML><HEAD></HEAD><BODY><H1>mod_lisp 2.0</H1><P>This is a constant
-  html string sent by mod_lisp</P></BODY></HTML>")
+<html><head></head><body><h1>mod_lisp</h1>
+<p>This is a constant html string sent by mod_lisp</p></body></html>")