From 3737c7a9750d3035f76128a9c32a32a4226c3939 Mon Sep 17 00:00:00 2001 From: Luke Bratch Date: Mon, 24 Jul 2023 20:41:42 +0100 Subject: Include 437 (ERR_UNAVAILRESOURCE) as part of "nick in use" resolution upon connecting. --- TODO | 2 ++ message.c | 10 ++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/TODO b/TODO index c65634f..6c90f83 100644 --- a/TODO +++ b/TODO @@ -43,3 +43,5 @@ BLABOUNCER/stdin functions to add: KICK not handled. Crash when requesting 30 hour replay. + +"too many clients, disconnecting and skipping loop iteration!" has been seen in the real world, e.g. Wed Jul 12 16:44:57 2023 diff --git a/message.c b/message.c index 7067776..3eb35bd 100644 --- a/message.c +++ b/message.c @@ -748,10 +748,12 @@ int processservermessage(SSL *server_ssl, char *str, struct client *clients, int return 1; } - // Server 432 (ERR_ERRONEUSNICKNAME) or 433 (ERR_NICKNAMEINUSE) received? See which nick we're on and try another. - // (But only if we're not already registered with the real IRC server.) - if ((strncmp(tokens[1], "432", strlen(tokens[1])) == 0 || strncmp(tokens[1], "433", strlen(tokens[1])) == 0) && !strlen(ircdstate->greeting004)) { - debugprint(DEBUG_SOME, "Server 432 (ERR_ERRONEUSNICKNAME) or 433 (ERR_NICKNAMEINUSE) found and it is: %s with length %zd! Trying another nick...\n", + // Server 432 (ERR_ERRONEUSNICKNAME), 433 (ERR_NICKNAMEINUSE), or 437 (ERR_UNAVAILRESOURCE) received? See which nick we're on and try another. + // (But only if we're not already registered with the real IRC server. In particular 437 (ERR_UNAVAILRESOURCE) may be about a channel rather + // our nick, but if we're not registered yet then it's probably about our nick.) + if ((strncmp(tokens[1], "432", strlen(tokens[1])) == 0 || strncmp(tokens[1], "433", strlen(tokens[1])) == 0 || strncmp(tokens[1], "437", strlen(tokens[1])) == 0) + && !strlen(ircdstate->greeting004)) { + debugprint(DEBUG_SOME, "Server 432 (ERR_ERRONEUSNICKNAME), 433 (ERR_NICKNAMEINUSE), or 437 (ERR_UNAVAILRESOURCE) found and it is: %s with length %zd! Trying another nick...\n", tokens[1], strlen(tokens[1])); // Find the nick (its index in the nicks array) currently selected -- cgit v1.2.3