Skip to content

又是一个比较严重的bug, 房间socket反复断开,可能会把bucket里面的新的chn删除,导致无法收到消息 #72

@zuoganggit

Description

@zuoganggit

server.go里面readPump 方法如下代码:
s.Bucket(ch.userId).DeleteChannel(ch)

会执行到bucket里面的如下代码:
if ch, ok = b.chs[ch.userId]; ok {
room = b.chs[ch.userId].Room
//delete from bucket
delete(b.chs, ch.userId)
}

当旧的连接关闭的时间比新的连接慢(bucket.go put方法里面是直接覆盖chn,如下代码: b.chs[userId] = ch),delete(b.chs, ch.userId)就会把新的chn误删,应该要在s.Bucket(ch.userId).DeleteChannel(ch)前加判断逻辑,s.Bucket(ch.userId)里面是否已经有新的chn

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions