Fix SendMessage mutex infinity lock

This commit is contained in:
nxshock 2019-08-08 20:04:53 +05:00
parent 4fc26f127e
commit eed68b37fe

View File

@ -190,8 +190,8 @@ func (user *User) LeaveRoom(room internal.Room) models.ApiError {
func (user *User) SendMessage(room internal.Room, text string) models.ApiError {
memRoom := room.(*Room)
memRoom.mutex.Lock()
defer memRoom.mutex.Unlock()
memRoom.mutex.RLock()
defer memRoom.mutex.RUnlock()
userInRoom := false
for _, roomMember := range memRoom.joined {