From d404ba102de22d3314ce114fbe057f96c3b59412 Mon Sep 17 00:00:00 2001 From: Juan Font Alonso Date: Mon, 20 Jun 2022 21:47:02 +0200 Subject: [PATCH] Use request context to close when client disconnects --- poll.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/poll.go b/poll.go index 195a261c..e214952a 100644 --- a/poll.go +++ b/poll.go @@ -279,7 +279,7 @@ func (h *Headscale) PollNetMapStream( keepAliveChan chan []byte, updateChan chan struct{}, ) { - ctx := context.WithValue(context.Background(), machineNameContextKey, machine.Hostname) + ctx := context.WithValue(r.Context(), machineNameContextKey, machine.Hostname) ctx, cancel := context.WithCancel(ctx) defer cancel()