fix an issue not applying updated user profiles

This commit is contained in:
mappu 2016-08-27 15:31:00 +12:00
parent 417deff347
commit 265c0a43ce

View File

@ -74,11 +74,15 @@ func (this *HubConnection) userJoined_NameOnly(nick string) {
}
func (this *HubConnection) userJoined_Full(uinf *UserInfo) {
if !this.UserExists(uinf.Nick) {
this.userLock.Lock()
defer this.userLock.Unlock()
// n.b. also called when we get a replacement MyINFO for someone
this.userLock.Lock()
defer this.userLock.Unlock()
this.users[uinf.Nick] = *uinf
_, userExisted := this.users[uinf.Nick] // don't use UserExists as it would deadlock the mutex
this.users[uinf.Nick] = *uinf
if !userExisted {
this.processEvent(HubEvent{EventType: EVENT_USER_JOINED, Nick: uinf.Nick})
}
}