aboutsummaryrefslogtreecommitdiff
path: root/clients.go
diff options
context:
space:
mode:
Diffstat (limited to 'clients.go')
-rw-r--r--clients.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/clients.go b/clients.go
index a181f99..53fd134 100644
--- a/clients.go
+++ b/clients.go
@@ -45,6 +45,18 @@ func (client Client) ServerSource() string {
return client.UID
}
+func (client *Client) Teardown() {
+ if client.conn != nil {
+ (*client.conn).Close()
+ }
+ if !uidToClient.CompareAndDelete(client.UID, client) {
+ slog.Error("uid inconsistent", "uid", client.UID, "client", client)
+ }
+ if !nickToClient.CompareAndDelete(client.Nick, client) {
+ slog.Error("nick inconsistent", "nick", client.Nick, "client", client)
+ }
+}
+
type ClientState uint8
const (