fix: gcConnOnError()
* better removal of connections
This commit is contained in:
parent
1fa318c732
commit
d01239e2ed
@ -44,11 +44,14 @@ func welcomeAgents(ws *websocket.Conn, welcome wsWelcome, t string) {
|
|||||||
|
|
||||||
func gcConnOnError(ws *websocket.Conn) (err error) {
|
func gcConnOnError(ws *websocket.Conn) (err error) {
|
||||||
listeners.Range(func(index, value interface{}) bool {
|
listeners.Range(func(index, value interface{}) bool {
|
||||||
if value.(*connectionInfo).ConnectionPS == ws || value.(*connectionInfo).ConnectionRR == ws {
|
var ci = value.(*connectionInfo)
|
||||||
value.(*connectionInfo).ConnectionPS.Close()
|
if ci.ConnectionPS == ws {
|
||||||
value.(*connectionInfo).ConnectionRR.Close()
|
ci.ConnectionPS.Close()
|
||||||
listeners.Delete(index)
|
|
||||||
}
|
}
|
||||||
|
if ci.ConnectionRR == ws {
|
||||||
|
ci.ConnectionRR.Close()
|
||||||
|
}
|
||||||
|
listeners.Delete(index)
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user