From 2d4179ba5aba4f967ca25854ebea54543737bb13 Mon Sep 17 00:00:00 2001 From: Liam Burnand Date: Wed, 27 Dec 2023 05:27:05 +0000 Subject: [PATCH] Adding returns when an error occurred --- server/views/websocket.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/views/websocket.go b/server/views/websocket.go index 0862294..51a7a05 100644 --- a/server/views/websocket.go +++ b/server/views/websocket.go @@ -99,6 +99,7 @@ func (v *Views) Websocket(c echo.Context) error { v.cache.Delete(responseTransporter.Server.String()) v.cache.Delete(responseTransporter.Server.String() + internalChannelNameAppend) loop = false + return nil } _, msg, err = ws.ReadMessage() @@ -109,6 +110,7 @@ func (v *Views) Websocket(c echo.Context) error { v.cache.Delete(responseTransporter.Server.String()) v.cache.Delete(responseTransporter.Server.String() + internalChannelNameAppend) loop = false + return nil } internalChannel <- msg log.Printf("Message received from \"%s\": %s", responseTransporter.Server, msg) @@ -121,6 +123,7 @@ func (v *Views) Websocket(c echo.Context) error { v.cache.Delete(responseTransporter.Server.String()) v.cache.Delete(responseTransporter.Server.String() + internalChannelNameAppend) loop = false + return nil } var msgType int msgType, msg, err = ws.ReadMessage() @@ -131,6 +134,7 @@ func (v *Views) Websocket(c echo.Context) error { v.cache.Delete(responseTransporter.Server.String()) v.cache.Delete(responseTransporter.Server.String() + internalChannelNameAppend) loop = false + return nil } } }