key client sockets on the server-side socket name, not the peername

This commit is contained in:
Jamie Forth 2015-07-10 16:28:30 +01:00
parent 7d43627bcc
commit 3303d3b7de

View file

@ -117,13 +117,18 @@
;;;=====================================================================
(defun register-tcp-client (server transmitter)
(setf (gethash (make-peername-string (socket transmitter))
(clients server))
transmitter))
"Clients are keyed on the names-string of the server-side socket,
not the peer name because the peer may close the socket after which
the peer name is no longer available. FIXME: Maybe we want to store
the peername independently of the socket's connection status?"
(let ((client-name (make-name-string transmitter)))
(when (debug-mode server)
(format t "Client registered: ~A~%" client-name))
(setf (gethash client-name (clients server)) transmitter)))
(defun unregister-tcp-client (server transmitter)
(remhash (make-peername-string (socket transmitter))
(clients server)))
(remhash (make-name-string transmitter)
(clients server)))
(defun make-unregister-self-fun (server)
#'(lambda (client)