diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2023-05-31 21:27:38 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2023-05-31 21:29:00 +0200 |
| commit | 0d0b416146dd146a5dcfbf61f09f8136aa5afdc2 (patch) | |
| tree | 3208eb54f4ec1bba5a8e189a939be4e89330c67f | |
| parent | 2a16dcba5a31a45a12853a15254719c357baae6d (diff) | |
| download | WRMS-0d0b416146dd146a5dcfbf61f09f8136aa5afdc2.tar.gz WRMS-0d0b416146dd146a5dcfbf61f09f8136aa5afdc2.zip | |
create websocket context after successfully identifying the connection
Fixes: d8bdce51c336f3693121202402ee38ff3f12c0e2
| -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() |
