mirror of
https://github.com/tailscale/tailscale.git
synced 2025-01-08 09:07:44 +00:00
ipn/ipnlocal: logout ephemeral nodes on shutdown
Signed-off-by: Maisem Ali <maisem@tailscale.com>
This commit is contained in:
parent
393a229de9
commit
4d0461f721
@ -404,7 +404,6 @@ func run() error {
|
|||||||
// want to keep running.
|
// want to keep running.
|
||||||
signal.Ignore(syscall.SIGPIPE)
|
signal.Ignore(syscall.SIGPIPE)
|
||||||
go func() {
|
go func() {
|
||||||
defer dialer.Close()
|
|
||||||
select {
|
select {
|
||||||
case s := <-interrupt:
|
case s := <-interrupt:
|
||||||
logf("tailscaled got signal %v; shutting down", s)
|
logf("tailscaled got signal %v; shutting down", s)
|
||||||
@ -437,6 +436,7 @@ func run() error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("safesocket.Listen: %v", err)
|
return fmt.Errorf("safesocket.Listen: %v", err)
|
||||||
}
|
}
|
||||||
|
defer dialer.Close()
|
||||||
|
|
||||||
err = srv.Run(ctx, ln)
|
err = srv.Run(ctx, ln)
|
||||||
// Cancelation is not an error: it is the only way to stop ipnserver.
|
// Cancelation is not an error: it is the only way to stop ipnserver.
|
||||||
|
@ -342,7 +342,19 @@ func (b *LocalBackend) onHealthChange(sys health.Subsystem, err error) {
|
|||||||
// can no longer be used after Shutdown returns.
|
// can no longer be used after Shutdown returns.
|
||||||
func (b *LocalBackend) Shutdown() {
|
func (b *LocalBackend) Shutdown() {
|
||||||
b.mu.Lock()
|
b.mu.Lock()
|
||||||
|
if b.shutdownCalled {
|
||||||
|
b.mu.Unlock()
|
||||||
|
return
|
||||||
|
}
|
||||||
b.shutdownCalled = true
|
b.shutdownCalled = true
|
||||||
|
|
||||||
|
if b.loginFlags&controlclient.LoginEphemeral != 0 {
|
||||||
|
b.mu.Unlock()
|
||||||
|
ctx, cancel := context.WithTimeout(b.ctx, 5*time.Second)
|
||||||
|
defer cancel()
|
||||||
|
b.LogoutSync(ctx) // best effort
|
||||||
|
b.mu.Lock()
|
||||||
|
}
|
||||||
cc := b.cc
|
cc := b.cc
|
||||||
if b.sshServer != nil {
|
if b.sshServer != nil {
|
||||||
b.sshServer.Shutdown()
|
b.sshServer.Shutdown()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user