ipn/{ipnlocal,ipnserver}: add some comments

Change-Id: Ieb5917edaf572342b755caa458693512c7aece81
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
pull/6469/head
Brad Fitzpatrick 2 years ago committed by Brad Fitzpatrick
parent 732c3d2ed0
commit 5ea7c7d603

@ -2012,6 +2012,17 @@ func (b *LocalBackend) State() ipn.State {
return b.state
}
// InServerMode reports whether the Tailscale backend is explicitly running in
// "server mode" where it continues to run despite whatever the platform's
// default is. In practice, this is only used on Windows, where the default
// tailscaled behavior is to shut down whenever the GUI disconnects.
//
// On non-Windows platforms, this usually returns false (because people don't
// set unattended mode on other platforms) and also isn't checked on other
// platforms.
//
// TODO(bradfitz): rename to InWindowsUnattendedMode or something? Or make this
// return true on Linux etc and always be called? It's kinda messy now.
func (b *LocalBackend) InServerMode() bool {
b.mu.Lock()
defer b.mu.Unlock()

@ -100,6 +100,8 @@ type Server struct {
bsMu sync.Mutex // lock order: bsMu, then mu
bs *ipn.BackendServer
// mu guards the fields that follow.
// lock order: mu, then LocalBackend.mu
mu sync.Mutex
lastUserID string // tracks last userid; on change, Reset state for paranoia
allClients map[net.Conn]*ipnauth.ConnIdentity // HTTP or IPN

Loading…
Cancel
Save