Improved log messages, and case That Should Never Happen

This commit is contained in:
Juan Font Alonso 2021-05-26 21:39:57 +02:00
parent 064e448d22
commit 4be39f9b83

8
api.go
View file

@ -227,10 +227,14 @@ func (h *Headscale) PollNetMapHandler(c *gin.Context) {
c.Data(200, "application/json; charset=utf-8", *data) c.Data(200, "application/json; charset=utf-8", *data)
return return
} }
if req.OmitPeers { if req.OmitPeers && !req.Stream {
log.Printf("[%s] Client is starting up. Ready to receive the peers", m.Name) log.Printf("[%s] Client sent endpoint update and is ok with a response without peer list", m.Name)
c.Data(200, "application/json; charset=utf-8", *data) c.Data(200, "application/json; charset=utf-8", *data)
return return
} else if req.OmitPeers && req.Stream {
log.Printf("[%s] Warning, ignoring request, don't know how to handle it", m.Name)
c.String(http.StatusBadRequest, "")
return
} }
log.Printf("[%s] Client is ready to access the tailnet", m.Name) log.Printf("[%s] Client is ready to access the tailnet", m.Name)