aboutsummaryrefslogtreecommitdiff
path: root/cmd_nick.go
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2024-12-08 12:40:41 +0800
committerRunxi Yu <me@runxiyu.org>2024-12-08 12:40:41 +0800
commita81162e4a5f830339cfb143eeb951a57868c52b3 (patch)
tree4c3781785259e9c43cfb0a6b0a1a12eb707934ec /cmd_nick.go
parentErgo stuff is ISC, not MIT (diff)
downloadmeseircd-a81162e4a5f830339cfb143eeb951a57868c52b3.tar.gz
meseircd-a81162e4a5f830339cfb143eeb951a57868c52b3.tar.zst
meseircd-a81162e4a5f830339cfb143eeb951a57868c52b3.zip
NICK: Also delete old nick association when not fully registered
Diffstat (limited to 'cmd_nick.go')
-rw-r--r--cmd_nick.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/cmd_nick.go b/cmd_nick.go
index 0d844b8..9ac3cd8 100644
--- a/cmd_nick.go
+++ b/cmd_nick.go
@@ -22,11 +22,11 @@ func handleClientNick(msg RMsg, client *Client) error {
}
}
} else {
+ if !nickToClient.CompareAndDelete(client.Nick, client) {
+ slog.Error("nick inconsistent", "nick", client.Nick, "client", client)
+ return fmt.Errorf("%w: %v", ErrInconsistentClient, client)
+ }
if client.State == ClientStateRegistered {
- if !nickToClient.CompareAndDelete(client.Nick, client) {
- slog.Error("nick inconsistent", "nick", client.Nick, "client", client)
- return fmt.Errorf("%w: %v", ErrInconsistent, client)
- }
err := client.Send(MakeMsg(client, "NICK", msg.Params[0]))
if err != nil {
return err