Close zombie websocket connection

This commit is contained in:
Shaka Chen 2022-08-03 14:54:20 +08:00
parent b5c8e3a165
commit e0aeae7690

View file

@ -241,7 +241,13 @@ the default answer. (Private)"
(handler-case (handler-case
(let ((connection-id (gethash connection *connections*)) (let ((connection-id (gethash connection *connections*))
(ml (ppcre:split ":" message :limit 2))) (ml (ppcre:split ":" message :limit 2)))
(cond ((equal (first ml) "0") (cond ((null connection-id)
;; a zombie connection
(when *verbose-output*
(format t "A zombie connection ~A. CLOG doesn't remember its connection-id. Closing it.~%"
connection))
(websocket-driver:close-connection connection)) ; don't send the reason for better security
((equal (first ml) "0")
;; a ping ;; a ping
(when *verbose-output* (when *verbose-output*
(format t "Connection ~A Ping~%" connection-id))) (format t "Connection ~A Ping~%" connection-id)))