Lint fixes 6/n

This commit is contained in:
Juan Font Alonso 2022-06-26 12:25:26 +02:00
parent c810b24eb9
commit fa91ece5b4
1 changed files with 35 additions and 3 deletions

38
poll.go
View File

@ -335,7 +335,18 @@ func (h *Headscale) PollNetMapStream(
return
}
writer.(http.Flusher).Flush()
flusher, ok := writer.(http.Flusher)
if !ok {
log.Error().
Caller().
Str("handler", "PollNetMapStream").
Str("machine", machine.Hostname).
Str("channel", "pollData").
Msg("Cannot cast writer to http.Flusher")
} else {
flusher.Flush()
}
log.Trace().
Str("handler", "PollNetMapStream").
@ -403,7 +414,17 @@ func (h *Headscale) PollNetMapStream(
return
}
writer.(http.Flusher).Flush()
flusher, ok := writer.(http.Flusher)
if !ok {
log.Error().
Caller().
Str("handler", "PollNetMapStream").
Str("machine", machine.Hostname).
Str("channel", "keepAlive").
Msg("Cannot cast writer to http.Flusher")
} else {
flusher.Flush()
}
log.Trace().
Str("handler", "PollNetMapStream").
@ -492,7 +513,18 @@ func (h *Headscale) PollNetMapStream(
return
}
writer.(http.Flusher).Flush()
flusher, ok := writer.(http.Flusher)
if !ok {
log.Error().
Caller().
Str("handler", "PollNetMapStream").
Str("machine", machine.Hostname).
Str("channel", "update").
Msg("Cannot cast writer to http.Flusher")
} else {
flusher.Flush()
}
log.Trace().
Str("handler", "PollNetMapStream").