3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-12-26 04:32:36 +01:00

tweak to avoid a potential data race

This commit is contained in:
Shivaram Lingamneni 2019-12-17 19:57:23 -05:00
parent b468baa959
commit 4b37b5dd3e

View File

@ -327,11 +327,11 @@ func (client *Client) lookupHostname(session *Session, overwrite bool) {
}
session.rawHostname = hostname
cloakedHostname := config.Server.Cloaks.ComputeCloak(ip)
client.stateMutex.Lock()
defer client.stateMutex.Unlock()
// update the hostname if this is a new connection or a resume, but not if it's a reattach
if overwrite || client.rawHostname == "" {
cloakedHostname := config.Server.Cloaks.ComputeCloak(ip)
client.stateMutex.Lock()
defer client.stateMutex.Unlock()
client.rawHostname = hostname
client.cloakedHostname = cloakedHostname
client.updateNickMaskNoMutex()