-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensure channel.users is an accurate representation of the NAMES response after updating by removing stale users #118
base: master
Are you sure you want to change the base?
Conversation
…l.users when finished. Ensures no users are left in the list that weren't in the NAMES response
Signed-off-by: f0x github@cthu.lu |
Hmm while trying to |
Alternative approach master...f0x52:clear-names-internal |
That would be a bug in node-irc too. Servers reliably inform clients of every other user who leaves, with a |
Right, it's been difficult to fully debug why this happens, as it does so over time, on production bridges.. I think it might instead be caused by the Client getting reused across connections, so it's missing PART/QUITS while it's offline, and continues to use that older users list |
If that's the case, then this PR is the right fix. Let's see if it fixes (or reduces) the issue once it's merge |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks sensible to me.
https://github.com/matrix-org/node-irc/blob/master/src/irc.ts#L660
When parsing responses to the
NAMES
command, (changes to) users are only everset
on thechannel.users
Map. This causes thechannel.users
list to perpetually keep growing as new users join, but never remove entries from users that have since left.onPart()
does remove entries, which works most of the time, but it seems these can be missed, most likely due to netsplits.This fix keeps a separate Map (
tmpUsers
) where usernames + modes are stored as they come in throughonReplyName()
. InonReplyNameEnd()
the old userlist is cleared, the new entries are copied over (so only the users in the NAMES response remain), and the tmpUsers Map is cleared so it can be used for the nextNAMES
block.Found this while debugging why the Matrix side of many bridged rooms has many more IRC users than the IRC side.