move *clog-running* to clog:connection

This commit is contained in:
David Botton 2024-07-05 16:54:56 -04:00
parent 8647c998ca
commit 05c4759434
3 changed files with 9 additions and 10 deletions

View file

@ -169,7 +169,7 @@
(when *verbose-output*
(format t "Connection close request ~A.~%"
connection))
(when *reconnect-delay*
(when (and *clog-running* *reconnect-delay*)
(when *verbose-output*
(format t "Connection close request ~A delayed ~A for reconnects.~%"
connection *reconnect-delay*))

View file

@ -41,6 +41,7 @@ script."
(*reconnect-delay* variable)
(*static-root* variable)
(*clog-port* variable)
(*clog-running* variable)
(initialize function)
(random-port function)
@ -95,7 +96,7 @@ script."
(defparameter *static-root* nil "Contains the static-root setting after initialization.")
(defparameter *clog-port* 8080 "Port this instance of clog was started on")
(defvar *plugin-paths* (make-hash-table* :test #'equalp) "Path regex -> static-root")
(defvar *clog-running* nil "CLOG initialized and running.")
(defvar *on-connect-handler* nil "New connection event handler.")
@ -212,6 +213,7 @@ the default answer. (Private)"
(defun shutdown-clog ()
"Shutdown CLOG."
(setf *clog-running* nil)
(shutdown-connection)
(clrhash *connection-data*)
(clrhash *connections*)

View file

@ -14,8 +14,6 @@
(defvar *url-to-on-new-window* (make-hash-table* :test 'equalp)
"URL to on-new-window handlers (private)")
(defvar *clog-running* nil "If clog running.")
(defvar *clog-debug* nil
"Set a debug hook that is called for every event with (event data)
that must be (funcall event data).")
@ -119,8 +117,8 @@ number is chosen."
(setf *extended-routing* extended-routing)
(when on-new-window-handler
(set-on-new-window on-new-window-handler :path "/" :boot-file boot-file))
(unless *clog-running*
(setf *clog-running* t)
(unless clog-connection:*clog-running*
(setf clog-connection:*clog-running* t)
(when (or (eql port 0) (eq port nil))
(setf port (clog-connection:random-port)))
(apply #'clog-connection:initialize
@ -148,7 +146,7 @@ BOOT-FILE will be used. If BOOT-FILE is nil path is removed."
;;;;;;;;;;;;;;;;;;
(defun is-running-p ()
*clog-running*)
clog-connection:*clog-running*)
;;;;;;;;;;;;;;
;; shutdown ;;
@ -156,10 +154,9 @@ BOOT-FILE will be used. If BOOT-FILE is nil path is removed."
(defun shutdown ()
"Shutdown CLOG."
(when *clog-running*
(when clog-connection:*clog-running*
(clrhash *url-to-on-new-window*)
(clog-connection:shutdown-clog)
(setf *clog-running* nil)))
(clog-connection:shutdown-clog)))
;;;;;;;;;;;;;;;;
;; debug-mode ;;