forked from Silverfish/proton-bridge
fix(GODT-2628): Attempt to fix closed channel panic on logout
It should not be possible to reach this state on purpose. But due to scheduling and synchronization variances, it is possible in theory that a UserDeathEvent can occur at the same time as the bridge is closing, causing a call to `User.Close()` to be executed 2 times. To avoid this in the future we just clear the map after all the channels have been closed.
This commit is contained in:
@ -413,7 +413,7 @@ func (bridge *Bridge) Close(ctx context.Context) {
|
||||
}
|
||||
|
||||
// Close all users.
|
||||
safe.RLock(func() {
|
||||
safe.Lock(func() {
|
||||
for _, user := range bridge.users {
|
||||
user.Close()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user