ipn/ipnlocal: set the push device token correctly

It would end up resetting whatever hostinfo we had constructed
and leave the backend statemachine in a broken state.
This fixes that by storing the PushDeviceToken on the LocalBackend
and populating it on Hostinfo before passing it to controlclient.

Updates tailscale/corp#8940
Updates tailscale/corp#15367

Signed-off-by: Maisem Ali <maisem@tailscale.com>
This commit is contained in:
Maisem Ali
2023-10-23 10:22:34 -07:00
committed by Maisem Ali
parent 0e89245c0f
commit 17b2072b72
4 changed files with 21 additions and 34 deletions

View File

@@ -1553,8 +1553,7 @@ func (h *Handler) serveSetPushDeviceToken(w http.ResponseWriter, r *http.Request
http.Error(w, "invalid JSON body", http.StatusBadRequest)
return
}
hostinfo.SetPushDeviceToken(params.PushDeviceToken)
h.b.ResendHostinfoIfNeeded()
h.b.SetPushDeviceToken(params.PushDeviceToken)
w.WriteHeader(http.StatusOK)
}