diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2023-05-31 18:15:34 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2023-05-31 18:15:34 +0200 |
| commit | 031ad1f22dbb3b393850c9534ac082ab71ab1128 (patch) | |
| tree | 7968f7eade9d63c88a514886e06268207155fe59 /go.sum | |
| parent | 0a8e25ea698333c73c50fc84e3334e1079606a10 (diff) | |
| download | WRMS-031ad1f22dbb3b393850c9534ac082ab71ab1128.tar.gz WRMS-031ad1f22dbb3b393850c9534ac082ab71ab1128.zip | |
prevent deadlocks when connections are closed
Currently the unbounded Events channel is never closed and
Connection are not removed from WRMS therefore any call to Broadcast
deadlocks because the wsEndpoint consumer is no longer reading Events.
Prevent this deadlock with a combination of announcing the closing of
connections and sender counting for each connection.
Before a sender is trying to write to the Events channel it checks
if it is already closed. If it observes that the connection is open
it registers itself as sender send the Event and unregisters itself.
The wsEndpoint announces that the connection is closed and consumes
Events until no registered senders are left. Then it closed the Events
channel and terminates.
Diffstat (limited to 'go.sum')
0 files changed, 0 insertions, 0 deletions
