浏览代码

Make sure we've acquired the room lock before checking the mxid

Gary Kramlich 3 年之前
父节点
当前提交
3a1cb2fc78
共有 1 个文件被更改,包括 3 次插入3 次删除
  1. 3 3
      bridge/portal.go

+ 3 - 3
bridge/portal.go

@@ -172,14 +172,14 @@ func (p *Portal) MainIntent() *appservice.IntentAPI {
 }
 
 func (p *Portal) createMatrixRoom(user *User, channel *discordgo.Channel) error {
+	p.roomCreateLock.Lock()
+	defer p.roomCreateLock.Unlock()
+
 	// If we have a matrix id the room should exist so we have nothing to do.
 	if p.MXID != "" {
 		return nil
 	}
 
-	p.roomCreateLock.Lock()
-	defer p.roomCreateLock.Unlock()
-
 	p.Type = channel.Type
 	if p.Type == discordgo.ChannelTypeDM {
 		p.DMUser = channel.Recipients[0].ID