From 265c0a43ce502a694050221382bb1a9fe57a02fc Mon Sep 17 00:00:00 2001 From: mappu Date: Sat, 27 Aug 2016 15:31:00 +1200 Subject: [PATCH] fix an issue not applying updated user profiles --- HubConnection.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/HubConnection.go b/HubConnection.go index e6c82f8..2943861 100644 --- a/HubConnection.go +++ b/HubConnection.go @@ -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}) } }