Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

明显的逻辑问题,难道没人发现吗? #391

Open
dkeepersun opened this issue Sep 22, 2022 · 6 comments
Open

明显的逻辑问题,难道没人发现吗? #391

dkeepersun opened this issue Sep 22, 2022 · 6 comments

Comments

@dkeepersun
Copy link

image

changeRoom的时候会把bucket里面的room给删掉。
那么如果有在同一个room,而且在同一个bucket中的其他客户端,那不是一起给删了收不到消息了吗?

@tonyjt
Copy link

tonyjt commented Oct 2, 2022

你看下oroom.Del(ch) 的返回值

image

@dkeepersun
Copy link
Author

不是同一个地方.

不是room.Del(ch)

而是 buclet.Del(room)

@tonyjt
Copy link

tonyjt commented Oct 9, 2022

oroom.Del(ch) 里如果Online==0 才会返回true(这个时候没有其他客户端了),然后才会bucket.DelRoom(oroom)

@dkeepersun
Copy link
Author

谢指教

@tutu-zhujing
Copy link

这还是有bug,room.Del和b.DelRoom不是一个原子操作,room.Del为true后的瞬间,bucket中这个room又有值了呢,这时候删除room就会误删

@yfwz100
Copy link

yfwz100 commented Aug 4, 2023

这还是有bug,room.Del和b.DelRoom不是一个原子操作,room.Del为true后的瞬间,bucket中这个room又有值了呢,这时候删除room就会误删

仅仅是这个问题的话,加锁已经保证原子了吧。除非其他地方写的时候没加锁。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants