aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go7
1 files changed, 3 insertions, 4 deletions
diff --git a/main.go b/main.go
index 53dc440..8ff3a81 100644
--- a/main.go
+++ b/main.go
@@ -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()