mirror of
https://github.com/tailscale/tailscale.git
synced 2025-01-08 09:07:44 +00:00
ipn/ipnlocal: rename LogoutSync to Logout
Updates #cleanup Signed-off-by: Maisem Ali <maisem@tailscale.com>
This commit is contained in:
parent
f52273767f
commit
96277b63ff
@ -329,7 +329,7 @@ func (i *jsIPN) logout() {
|
|||||||
go func() {
|
go func() {
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||||
defer cancel()
|
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)
|
ctx, cancel := context.WithTimeout(b.ctx, 5*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
t0 := time.Now()
|
t0 := time.Now()
|
||||||
err := b.LogoutSync(ctx) // best effort
|
err := b.Logout(ctx) // best effort
|
||||||
td := time.Since(t0).Round(time.Millisecond)
|
td := time.Since(t0).Round(time.Millisecond)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
b.logf("failed to log out ephemeral node on shutdown after %v: %v", td, err)
|
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
|
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()
|
b.mu.Lock()
|
||||||
if !b.hasNodeKeyLocked() {
|
if !b.hasNodeKeyLocked() {
|
||||||
// Already logged out.
|
// Already logged out.
|
||||||
|
@ -580,7 +580,7 @@ func TestStateMachine(t *testing.T) {
|
|||||||
store.awaitWrite()
|
store.awaitWrite()
|
||||||
t.Logf("\n\nLogout")
|
t.Logf("\n\nLogout")
|
||||||
notifies.expect(5)
|
notifies.expect(5)
|
||||||
b.LogoutSync(context.Background())
|
b.Logout(context.Background())
|
||||||
{
|
{
|
||||||
nn := notifies.drain(5)
|
nn := notifies.drain(5)
|
||||||
previousCC.assertCalls("pause", "Logout", "unpause", "Shutdown")
|
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.
|
// A second logout should be a no-op as we are in the NeedsLogin state.
|
||||||
t.Logf("\n\nLogout2")
|
t.Logf("\n\nLogout2")
|
||||||
notifies.expect(0)
|
notifies.expect(0)
|
||||||
b.LogoutSync(context.Background())
|
b.Logout(context.Background())
|
||||||
{
|
{
|
||||||
notifies.drain(0)
|
notifies.drain(0)
|
||||||
cc.assertCalls()
|
cc.assertCalls()
|
||||||
@ -623,7 +623,7 @@ func TestStateMachine(t *testing.T) {
|
|||||||
// AuthCantContinue state.
|
// AuthCantContinue state.
|
||||||
t.Logf("\n\nLogout3")
|
t.Logf("\n\nLogout3")
|
||||||
notifies.expect(3)
|
notifies.expect(3)
|
||||||
b.LogoutSync(context.Background())
|
b.Logout(context.Background())
|
||||||
{
|
{
|
||||||
notifies.drain(0)
|
notifies.drain(0)
|
||||||
cc.assertCalls()
|
cc.assertCalls()
|
||||||
|
@ -1056,7 +1056,7 @@ func (h *Handler) serveLogout(w http.ResponseWriter, r *http.Request) {
|
|||||||
http.Error(w, "want POST", 400)
|
http.Error(w, "want POST", 400)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
err := h.b.LogoutSync(r.Context())
|
err := h.b.Logout(r.Context())
|
||||||
if err == nil {
|
if err == nil {
|
||||||
w.WriteHeader(http.StatusNoContent)
|
w.WriteHeader(http.StatusNoContent)
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user