Remove lock from keepAlive

This commit is contained in:
Kristoffer Dalby 2021-08-06 20:08:51 +01:00
parent 4243885246
commit 15b8c8f4c5
No known key found for this signature in database
GPG key ID: 09F62DC067465735

4
api.go
View file

@ -455,7 +455,6 @@ func (h *Headscale) keepAlive(cancel chan []byte, pollData chan []byte, mKey wgk
return
default:
h.pollMu.Lock()
data, err := h.getMapKeepAliveResponse(mKey, req, m)
if err != nil {
log.Error().
@ -464,12 +463,13 @@ func (h *Headscale) keepAlive(cancel chan []byte, pollData chan []byte, mKey wgk
Msg("Error generating the keep alive msg")
return
}
log.Debug().
Str("func", "keepAlive").
Str("machine", m.Name).
Msg("Sending keepalive")
pollData <- *data
h.pollMu.Unlock()
time.Sleep(60 * time.Second)
}
}