Merge master
This commit is contained in:
commit
e631c6f7e0
44 changed files with 2714 additions and 842 deletions
10
poll.go
10
poll.go
|
@ -20,6 +20,10 @@ const (
|
|||
updateCheckInterval = 10 * time.Second
|
||||
)
|
||||
|
||||
type contextKey string
|
||||
|
||||
const machineNameContextKey = contextKey("machineName")
|
||||
|
||||
// PollNetMapHandler takes care of /machine/:id/map
|
||||
//
|
||||
// This is the busiest endpoint, as it keeps the HTTP long poll that updates
|
||||
|
@ -261,7 +265,7 @@ func (h *Headscale) PollNetMapStream(
|
|||
return
|
||||
}
|
||||
|
||||
ctx := context.WithValue(ctx.Request.Context(), "machineName", machine.Hostname)
|
||||
ctx := context.WithValue(ctx.Request.Context(), machineNameContextKey, machine.Hostname)
|
||||
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
defer cancel()
|
||||
|
@ -565,12 +569,12 @@ func (h *Headscale) scheduledPollWorker(
|
|||
|
||||
defer closeChanWithLog(
|
||||
updateChan,
|
||||
fmt.Sprint(ctx.Value("machineName")),
|
||||
fmt.Sprint(ctx.Value(machineNameContextKey)),
|
||||
"updateChan",
|
||||
)
|
||||
defer closeChanWithLog(
|
||||
keepAliveChan,
|
||||
fmt.Sprint(ctx.Value("machineName")),
|
||||
fmt.Sprint(ctx.Value(machineNameContextKey)),
|
||||
"updateChan",
|
||||
)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue