Skip to content

Commit 374a6ee

Browse files
committed
Fixed panic when sending keep alives to a disconnected node
1 parent 93a9284 commit 374a6ee

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

api.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,12 +279,14 @@ func (h *Headscale) keepAlive(cancel chan []byte, pollData chan []byte, mKey wgc
279279
return
280280

281281
default:
282+
h.pollMu.Lock()
282283
data, err := h.getMapKeepAliveResponse(mKey, req, m)
283284
if err != nil {
284285
log.Printf("Error generating the keep alive msg: %s", err)
285286
return
286287
}
287288
pollData <- *data
289+
h.pollMu.Unlock()
288290
time.Sleep(60 * time.Second)
289291
}
290292
}

0 commit comments

Comments
 (0)