ipn: don't Logout when Windows GUI disconnects

Logout used to be a no-op, so the ipnserver previously synthensized a Logout
on disconnect. Now that Logout actually invalidates the node key that was
forcing all GUI closes to log people out.

Instead, add a method to LocalBackend to specifically mean "the
Windows GUI closed, please forget all the state".

Fixes tailscale/corp#1591 (ignoring the notification issues, tracked elsewhere)

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2021-04-20 11:56:36 -07:00
committed by Brad Fitzpatrick
parent 158328ba24
commit f99e63bb17
4 changed files with 28 additions and 19 deletions

View File

@ -476,9 +476,7 @@ func (s *server) addConn(c net.Conn, isHTTP bool) (ci connIdentity, err error) {
defer func() {
if doReset {
s.logf("identity changed; resetting server")
s.bsMu.Lock()
s.bs.Reset(context.TODO())
s.bsMu.Unlock()
s.b.ResetForClientDisconnect()
}
}()
@ -528,9 +526,7 @@ func (s *server) removeAndCloseConn(c net.Conn) {
s.logf("client disconnected; staying alive in server mode")
} else {
s.logf("client disconnected; stopping server")
s.bsMu.Lock()
s.bs.Reset(context.TODO())
s.bsMu.Unlock()
s.b.ResetForClientDisconnect()
}
}
c.Close()