Skip to content

Conversation

@clukawski
Copy link
Contributor

Implements #1065. Added implementation notes to the issue.

@slingamn slingamn linked an issue Jul 6, 2020 that may be closed by this pull request
Copy link
Member

@slingamn slingamn left a 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?

https://github.com/oragono/oragono/blob/7d596add87fb0a48a69b63b0156d20e34d975cfe/irc/client_lookup_set.go#L228

irc/client.go Outdated
if client.realname == "" {
client.realname = realname
if client.alwaysOn {
client.markDirty(IncludeRealname)
Copy link
Member

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)

Copy link
Member

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 {
Copy link
Member

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 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

client.AlwaysOn()

@slingamn
Copy link
Member

slingamn commented Jul 6, 2020

Excellent. I'll sleep on this.

@clukawski
Copy link
Contributor Author

Will do some testing on new changes.

Copy link
Member

@slingamn slingamn left a 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 == "" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems redundant

@clukawski clukawski force-pushed the persist-realname-alwayson branch from 8dfd5cb to 6f8711d Compare July 12, 2020 18:47
@slingamn slingamn merged commit 6f8711d into ergochat:master Jul 12, 2020
@slingamn slingamn mentioned this pull request Jul 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

persist realname of always-on clients

2 participants