[bknr-cvs] edi changed trunk/thirdparty/hunchentoot/

BKNR Commits bknr at bknr.net
Wed Feb 18 00:21:31 UTC 2009


Revision: 4276
Author: edi
URL: http://bknr.net/trac/changeset/4276

More changes

U   trunk/thirdparty/hunchentoot/acceptor.lisp
U   trunk/thirdparty/hunchentoot/packages.lisp
U   trunk/thirdparty/hunchentoot/request.lisp
U   trunk/thirdparty/hunchentoot/taskmaster.lisp

Modified: trunk/thirdparty/hunchentoot/acceptor.lisp
===================================================================
--- trunk/thirdparty/hunchentoot/acceptor.lisp	2009-02-18 00:21:06 UTC (rev 4275)
+++ trunk/thirdparty/hunchentoot/acceptor.lisp	2009-02-18 00:21:31 UTC (rev 4276)
@@ -197,7 +197,9 @@
 (defgeneric accept-connections (acceptor)
   (:documentation "In a loop, accepts a connection and hands it over
 to the acceptor's taskmaster for processing using
-HANDLE-INCOMING-CONNECTION."))
+HANDLE-INCOMING-CONNECTION.  On LispWorks, this function returns
+immediately, on other Lisps it retusn only once the acceptor has been
+stopped."))
 
 (defgeneric initialize-connection-stream (acceptor stream)
  (:documentation "Can be used to modify the stream which is used to
@@ -246,7 +248,8 @@
   (setf (acceptor-shutdown-p acceptor) t)
   (shutdown (acceptor-taskmaster acceptor))
   #-:lispworks
-  (usocket:socket-close (acceptor-listen-socket acceptor)))
+  (usocket:socket-close (acceptor-listen-socket acceptor))
+  acceptor)
 
 (defmethod initialize-connection-stream ((acceptor acceptor) stream)
  (declare (ignore acceptor))
@@ -397,7 +400,8 @@
                                    usocket:*wildcard-host*)
                                (acceptor-port acceptor)
                                :reuseaddress t
-                               :element-type '(unsigned-byte 8))))
+                               :element-type '(unsigned-byte 8)))
+  (values))
 
 #-:lispworks
 (defmethod accept-connections ((acceptor acceptor))
@@ -444,11 +448,13 @@
     (when startup-condition
       (error startup-condition))
     (mp:process-stop listener-process)
-    (setf (acceptor-process acceptor) listener-process)))
+    (setf (acceptor-process acceptor) listener-process)
+    (values)))
 
 #+:lispworks
 (defmethod accept-connections ((acceptor acceptor))
-  (mp:process-unstop (acceptor-process acceptor)))
+  (mp:process-unstop (acceptor-process acceptor))
+  nil)
 
 (defun list-handler-selector (request)
   "The default handler selector which selects a request handler based

Modified: trunk/thirdparty/hunchentoot/packages.lisp
===================================================================
--- trunk/thirdparty/hunchentoot/packages.lisp	2009-02-18 00:21:06 UTC (rev 4275)
+++ trunk/thirdparty/hunchentoot/packages.lisp	2009-02-18 00:21:31 UTC (rev 4276)
@@ -120,6 +120,7 @@
            "ACCEPTOR"
            "ACCEPTOR-ACCESS-LOGGER"
            "ACCEPTOR-ADDRESS"
+           "ACCEPT-CONNECTIONS"
            "ACCEPTOR-HANDLER-SELECTOR"
            "ACCEPTOR-INPUT-CHUNKING-P"
            "ACCEPTOR-MESSAGE-LOGGER"
@@ -193,6 +194,7 @@
            "POST-PARAMETERS"
            "POST-PARAMETERS*"
            "PROCESS-CONNECTION"
+           "QUERY-STRING"
            "QUERY-STRING*"
            "RAW-POST-DATA"
            "REAL-REMOTE-ADDR"

Modified: trunk/thirdparty/hunchentoot/request.lisp
===================================================================
--- trunk/thirdparty/hunchentoot/request.lisp	2009-02-18 00:21:06 UTC (rev 4275)
+++ trunk/thirdparty/hunchentoot/request.lisp	2009-02-18 00:21:31 UTC (rev 4276)
@@ -89,7 +89,7 @@
 POST request, populated only if not a multipart/form-data request."))
   (:documentation "Objects of this class hold all the information
 about an incoming request.  They are created automatically by
-Hunchentoot and can be accessed by the corresponding handler.
+acceptors and can be accessed by the corresponding handler.
 
 You should not mess with the slots of these objects directly, but you
 can subclass REQUEST in order to implement your own behaviour.  See

Modified: trunk/thirdparty/hunchentoot/taskmaster.lisp
===================================================================
--- trunk/thirdparty/hunchentoot/taskmaster.lisp	2009-02-18 00:21:06 UTC (rev 4275)
+++ trunk/thirdparty/hunchentoot/taskmaster.lisp	2009-02-18 00:21:31 UTC (rev 4276)
@@ -34,7 +34,9 @@
              :documentation "A backpointer to the acceptor instance
 this taskmaster works for."))
   (:documentation "An instance of this class is responsible for
-distributing the work of handling requests when its acceptor "))
+distributing the work of handling requests for its acceptor.  This is
+an \"abstract\" class in the sense that usually only instances of
+subclasses of TASKMASTER will be used."))
 
 (defgeneric execute-acceptor (taskmaster)
   (:documentation "This is a callback called by the acceptor once it
@@ -44,24 +46,19 @@
 taskmaster instance the method might be called from a new thread."))
 
 (defgeneric handle-incoming-connection (taskmaster socket)
-  (:documentation
-   "This function is called by Hunchentoot to start processing of
-requests on a new incoming connection.  SOCKET is the usocket instance
-that represents the new connection \(or a socket handle on LispWorks).
-The taskmaster starts processing requests on the incoming
-connection by calling the START-REQUEST-PROCESSING function of the
-acceptor instance, taken from the ACCEPTOR slot in the taskmaster
-instance.  The SOCKET argument is passed to START-REQUEST-PROCESSING
-as argument.
+  (:documentation "This function is called by the acceptor to start
+processing of requests on a new incoming connection.  SOCKET is the
+usocket instance that represents the new connection \(or a socket
+handle on LispWorks).  The taskmaster starts processing requests on
+the incoming connection by calling the PROCESS-CONNECTION method of
+the acceptor instance.  The SOCKET argument is passed to
+PROCESS-CONNECTION as an argument."))
 
-In a multi-threaded environment, the taskmaster runs this function
-in a separate thread.  In a single-threaded environment, this function
-is called directly."))
-
 (defgeneric shutdown (taskmaster)
   (:documentation "Shuts down the taskmaster, i.e. frees all resources
 that were set up by it.  For example, a multi-threaded taskmaster
-might terminate all threads that are currently associated with it."))
+might terminate all threads that are currently associated with it.
+This function is called by the acceptor's STOP method."))
 
 (defclass single-threaded-taskmaster (taskmaster)
   ()
@@ -88,12 +85,16 @@
 connections and hands them off to new processes for request
 handling."))
   (:documentation "A taskmaster that starts one thread for listening
-to incoming requests and one thread for each incoming connection."))
+to incoming requests and one thread for each incoming connection.
 
+This is the default taskmaster implementation for multi-threaded Lisp
+implementations."))
+
 ;; usocket implementation
 
 #-:lispworks
-(defmethod shutdown ((taskmaster taskmaster)))
+(defmethod shutdown ((taskmaster taskmaster))
+  taskmaster)
 
 #-:lispworks
 (defmethod shutdown ((taskmaster one-thread-per-connection-taskmaster))
@@ -101,7 +102,8 @@
   (loop
    (unless (bt:thread-alive-p (acceptor-process taskmaster))
      (return))
-   (sleep 1)))
+   (sleep 1))
+  taskmaster)
 
 #-:lispworks
 (defmethod execute-acceptor ((taskmaster one-thread-per-connection-taskmaster))
@@ -136,7 +138,8 @@
   (when-let (process (acceptor-process (taskmaster-acceptor taskmaster)))
     ;; kill the main acceptor process, see LW documentation for
     ;; COMM:START-UP-SERVER
-    (mp:process-kill process)))
+    (mp:process-kill process))
+  taskmaster)
 
 #+:lispworks
 (defmethod execute-acceptor ((taskmaster one-thread-per-connection-taskmaster))





More information about the Bknr-cvs mailing list