ipn/ipnlocal: rename LogoutSync to Logout

Updates #cleanup

Signed-off-by: Maisem Ali <maisem@tailscale.com>
pull/9194/head
Maisem Ali 1 year ago committed by Maisem Ali
parent f52273767f
commit 96277b63ff

@ -329,7 +329,7 @@ func (i *jsIPN) logout() {
go func() {
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
i.lb.LogoutSync(ctx)
i.lb.Logout(ctx)
}()
}

@ -566,7 +566,7 @@ func (b *LocalBackend) Shutdown() {
ctx, cancel := context.WithTimeout(b.ctx, 5*time.Second)
defer cancel()
t0 := time.Now()
err := b.LogoutSync(ctx) // best effort
err := b.Logout(ctx) // best effort
td := time.Since(t0).Round(time.Millisecond)
if err != nil {
b.logf("failed to log out ephemeral node on shutdown after %v: %v", td, err)
@ -3907,7 +3907,9 @@ func (b *LocalBackend) ShouldHandleViaIP(ip netip.Addr) bool {
return false
}
func (b *LocalBackend) LogoutSync(ctx context.Context) error {
// Logout logs out the current profile, if any, and waits for the logout to
// complete.
func (b *LocalBackend) Logout(ctx context.Context) error {
b.mu.Lock()
if !b.hasNodeKeyLocked() {
// Already logged out.

@ -580,7 +580,7 @@ func TestStateMachine(t *testing.T) {
store.awaitWrite()
t.Logf("\n\nLogout")
notifies.expect(5)
b.LogoutSync(context.Background())
b.Logout(context.Background())
{
nn := notifies.drain(5)
previousCC.assertCalls("pause", "Logout", "unpause", "Shutdown")
@ -610,7 +610,7 @@ func TestStateMachine(t *testing.T) {
// A second logout should be a no-op as we are in the NeedsLogin state.
t.Logf("\n\nLogout2")
notifies.expect(0)
b.LogoutSync(context.Background())
b.Logout(context.Background())
{
notifies.drain(0)
cc.assertCalls()
@ -623,7 +623,7 @@ func TestStateMachine(t *testing.T) {
// AuthCantContinue state.
t.Logf("\n\nLogout3")
notifies.expect(3)
b.LogoutSync(context.Background())
b.Logout(context.Background())
{
notifies.drain(0)
cc.assertCalls()

@ -1056,7 +1056,7 @@ func (h *Handler) serveLogout(w http.ResponseWriter, r *http.Request) {
http.Error(w, "want POST", 400)
return
}
err := h.b.LogoutSync(r.Context())
err := h.b.Logout(r.Context())
if err == nil {
w.WriteHeader(http.StatusNoContent)
return

Loading…
Cancel
Save