fix: gcConnOnError()

* better removal of connections
This commit is contained in:
Paul 2024-12-08 11:11:36 +01:00
parent 1fa318c732
commit d01239e2ed

View File

@ -44,11 +44,14 @@ func welcomeAgents(ws *websocket.Conn, welcome wsWelcome, t string) {
func gcConnOnError(ws *websocket.Conn) (err error) {
listeners.Range(func(index, value interface{}) bool {
if value.(*connectionInfo).ConnectionPS == ws || value.(*connectionInfo).ConnectionRR == ws {
value.(*connectionInfo).ConnectionPS.Close()
value.(*connectionInfo).ConnectionRR.Close()
listeners.Delete(index)
var ci = value.(*connectionInfo)
if ci.ConnectionPS == ws {
ci.ConnectionPS.Close()
}
if ci.ConnectionRR == ws {
ci.ConnectionRR.Close()
}
listeners.Delete(index)
return true
})
return err