[bknr-cvs] hans changed trunk/thirdparty/hunchentoot/connection-manager.lisp

BKNR Commits bknr at bknr.net
Wed Jul 9 05:54:03 UTC 2008


Revision: 3417
Author: hans
URL: http://bknr.net/trac/changeset/3417

Remove WORKERS slot from ONE-SLOT-PER-CONNECTION-MANAGER.  Workers were
never removed from the list and it was used only for shutdown in LispWorks.
As worker processes synchronously check for server shutdown anyway, losing
the WORKERS slot was the best option to remove the leak.

U   trunk/thirdparty/hunchentoot/connection-manager.lisp

Modified: trunk/thirdparty/hunchentoot/connection-manager.lisp
===================================================================
--- trunk/thirdparty/hunchentoot/connection-manager.lisp	2008-07-09 05:52:08 UTC (rev 3416)
+++ trunk/thirdparty/hunchentoot/connection-manager.lisp	2008-07-09 05:54:03 UTC (rev 3417)
@@ -89,18 +89,11 @@
   (process-connection (server manager) socket))
 
 (defclass one-thread-per-connection-manager (connection-manager)
-  ((workers :initform nil
-            :accessor connection-manager-workers
-            :documentation "A list of currently active worker
-threads."))
+  ()
   (:documentation "Connection manager that starts one thread for
 listening to incoming requests and one thread for each incoming
 connection."))
 
-(defmethod print-object ((manager one-thread-per-connection-manager) stream)
-  (print-unreadable-object (manager stream :type t)
-    (format stream "~A worker~:P" (length (connection-manager-workers manager)))))
-
 (defmethod execute-listener ((manager one-thread-per-connection-manager))
   #+:lispworks
   (listen-for-connections (server manager))
@@ -119,30 +112,16 @@
              (zerop (mod *worker-counter* *cleanup-interval*)))
     (when *cleanup-function*
       (funcall *cleanup-function*)))
-  ;; start a worker thread for this connection and remember it
-  (push (mp:process-run-function (format nil "Hunchentoot worker \(client: ~{~A:~A~})"
-                                         (multiple-value-list
-                                          (get-peer-address-and-port handle)))
-                                 nil #'process-connection
-                                 (server manager) handle)
-        (connection-manager-workers manager)))
+  (mp:process-run-function (format nil "Hunchentoot worker \(client: ~{~A:~A~})"
+                                   (multiple-value-list
+                                    (get-peer-address-and-port handle)))
+                           nil #'process-connection
+                           (server manager) handle))
 
 #-:lispworks
 (defmethod handle-incoming-connection ((manager one-thread-per-connection-manager) socket)
-  (push (bt:make-thread (lambda ()
-                          (process-connection (server manager) socket))
-                        :name (format nil "Hunchentoot worker \(client: ~A:~A)"
-                                      (usocket:vector-quad-to-dotted-quad (usocket:get-peer-address socket))
-                                      (usocket:get-peer-port socket)))
-        (connection-manager-workers manager)))
-
-#+:lispworks
-(defmethod shutdown ((manager one-thread-per-connection-manager))
-  ;; kill all worker threads
-  (dolist (worker (connection-manager-workers manager))
-    (ignore-errors
-      (when (mp:process-alive-p worker)
-        (mp:process-kill worker)))
-    (mp:process-allow-scheduling))
-  ;; finally, kill main listener
-  (call-next-method))
+  (bt:make-thread (lambda ()
+                    (process-connection (server manager) socket))
+                  :name (format nil "Hunchentoot worker \(client: ~A:~A)"
+                                (usocket:vector-quad-to-dotted-quad (usocket:get-peer-address socket))
+                                (usocket:get-peer-port socket))))




More information about the Bknr-cvs mailing list