From 3af64765fd5808e72ddd2b29888c3defe9bf5026 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Fri, 11 Sep 2020 15:10:29 -0700 Subject: [PATCH] ipn: fix Windows crash from improperly strict assertion --- ipn/local.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ipn/local.go b/ipn/local.go index 6e4b6981c..1d61ffa25 100644 --- a/ipn/local.go +++ b/ipn/local.go @@ -1251,11 +1251,21 @@ func (b *LocalBackend) requestEngineStatusAndWait() { // rebooting will fix it. func (b *LocalBackend) Logout() { b.mu.Lock() - b.assertClientLocked() c := b.c b.netMap = nil b.mu.Unlock() + if c == nil { + // Double Logout can happen via repeated IPN + // connections to ipnserver making it repeatedly + // transition from 1->0 total connections, which on + // Windows by default ("client mode") causes a Logout + // on the transition to zero. + // Previously this crashed when we asserted that c was non-nil + // here. + return + } + c.Logout() b.mu.Lock()