-
Notifications
You must be signed in to change notification settings - Fork 215
Persist realname for always-on clients #1180
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
Conversation
slingamn
left a comment
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.
This mostly looks good. Try testing a few different cases?
I forgot to tell you: can you clean up the existing code that sets realname on reattach?
irc/client.go
Outdated
| if client.realname == "" { | ||
| client.realname = realname | ||
| if client.alwaysOn { | ||
| client.markDirty(IncludeRealname) |
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.
This needs to happen outside the lock as well (you can use a defer for this)
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.
From discussion: there's actually no need to mark dirty here, since this is never called for registered clients.
irc/getters.go
Outdated
| client.stateMutex.Lock() | ||
| client.realname = realname | ||
| client.stateMutex.Unlock() | ||
| if client.alwaysOn { |
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.
I missed this earlier: this is technically a data race. (You can alwaysOn := client.alwaysOn up above while holding the lock.)
irc/accounts.go
Outdated
| am.server.RandomlyRename(currentClient) | ||
| } | ||
| } | ||
| if client.alwaysOn { |
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.
client.AlwaysOn()
|
Excellent. I'll sleep on this. |
|
Will do some testing on new changes. |
slingamn
left a comment
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 good. Would you mind squashing when you're done?
| realname, _ = tx.Get(key) | ||
| return nil | ||
| }) | ||
| if realname == "" { |
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.
This seems redundant
8dfd5cb to
6f8711d
Compare
Implements #1065. Added implementation notes to the issue.