diff options
| -rw-r--r-- | main.go | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -201,10 +201,6 @@ func wsEndpoint(w http.ResponseWriter, r *http.Request) { return } - ctx, cancel := context.WithCancel(r.Context()) - - ctx = c.CloseRead(ctx) - uuidCookie, err := r.Cookie("UUID") if err != nil { llog.Error("websocket connection has no set UUID cookie") @@ -219,6 +215,9 @@ func wsEndpoint(w http.ResponseWriter, r *http.Request) { return } + ctx, cancel := context.WithCancel(r.Context()) + ctx = c.CloseRead(ctx) + defer func() { llog.Info("cancel context of connection %v", id) cancel() |
