ipn/ipnlocal: close foreground sessions on SetServeConfig

This PR ensures zombie foregrounds are shutdown if a new
ServeConfig is created that wipes the ongoing foreground ones.
For example, "tailscale serve|funnel reset|off" should close
all open sessions.

Updates #8489

Signed-off-by: Marwan Sulaiman <marwan@tailscale.com>
This commit is contained in:
Marwan Sulaiman
2023-09-18 10:30:58 -04:00
committed by Marwan Sulaiman
parent 530aaa52f1
commit 651620623b
5 changed files with 140 additions and 11 deletions

View File

@@ -752,9 +752,9 @@ func TestWatchNotificationsCallbacks(t *testing.T) {
}
// Send a notification. Range over notifyWatchers to get the channel
// because WatchNotifications doesn't expose the handle for it.
for _, c := range b.notifyWatchers {
for _, sess := range b.notifyWatchers {
select {
case c <- n:
case sess.ch <- n:
default:
t.Fatalf("could not send notification")
}