fix: re-added gcConnOnError, addcheck on send

This commit is contained in:
Paul 2023-04-10 17:09:57 +02:00
parent b99badcb87
commit 5da8a5c952

View File

@ -52,11 +52,11 @@ func HandleWSRR(c echo.Context, cfg *config.Config) error {
case "bootstrap": case "bootstrap":
log.Printf("bootstrap: %s\n", apievent.Hostname) log.Printf("bootstrap: %s\n", apievent.Hostname)
for index, value := range LISTENERS { for index, value := range LISTENERS {
if index != apievent.Hostname { if index != apievent.Hostname && value.ConnectionPS != nil {
err = websocket.Message.Send(value.ConnectionPS, msg) err = websocket.Message.Send(value.ConnectionPS, msg)
if err != nil { if err != nil {
log.Println(err) log.Println(err)
//gcConnOnError(ws) gcConnOnError(ws)
} }
} }
} }
@ -71,19 +71,23 @@ func HandleWSRR(c echo.Context, cfg *config.Config) error {
} }
for _, value := range LISTENERS { for _, value := range LISTENERS {
err = websocket.Message.Send(value.ConnectionPS, msg) if value.ConnectionPS != nil {
if err != nil { err = websocket.Message.Send(value.ConnectionPS, msg)
log.Println(err) if err != nil {
//gcConnOnError(ws) log.Println(err)
gcConnOnError(ws)
}
} }
} }
log.Printf("ws: Inserted event") log.Printf("ws: Inserted event")
case "init": case "init":
for _, value := range LISTENERS { for _, value := range LISTENERS {
err = websocket.Message.Send(value.ConnectionPS, msg) if value.ConnectionPS != nil {
if err != nil { err = websocket.Message.Send(value.ConnectionPS, msg)
log.Println(err) if err != nil {
//gcConnOnError(ws) log.Println(err)
gcConnOnError(ws)
}
} }
} }
default: default: