Files
mostlymatter/server
Agniva De Sarker ca94577cd5 MM-56260: connIndex: safely remove conns while iterating (#25785)
PR https://github.com/mattermost/mattermost/pull/22560
introduced a regression in the case where we had
multiple connections for a single user.

Because if connIndex.Remove was called during the iteration
from connIndex.ForUser, then the slice would be modified
during iteration and if a connection got removed,
then a good connection would move from the last index
to the current index. But since we would be actively
iterating, the last index would be read as nil and we would
never be able to reach the good connection.

We fix this by returning a copy of the original slice
if there are more than one elements in the slice.

https://mattermost.atlassian.net/browse/MM-56260
```release-note
Fix a bug where if there were multiple websocket
connections from a single user, then in case one connection
got removed during a broadcast, there was a possibility
that the other good connection might not get the event.
```
2024-01-04 13:36:22 -06:00
..
2023-03-22 17:22:27 -04:00
2023-12-11 15:27:34 -05:00
2023-03-22 17:22:27 -04:00
2023-03-22 17:22:27 -04:00
2023-06-15 15:27:52 -03:00
2023-03-22 17:22:27 -04:00
2023-03-22 17:22:27 -04:00
2023-03-22 17:22:27 -04:00
2023-03-22 17:22:27 -04:00
2023-12-20 19:44:50 +05:30
2023-12-20 19:44:50 +05:30