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

@@ -8,6 +8,7 @@ import (
"errors"
"flag"
"fmt"
"io"
"log"
"net"
"net/url"
@@ -289,7 +290,7 @@ func (e *serveEnv) runServeCombined(subcmd serveMode) execFunc {
for {
_, err = watcher.Next()
if err != nil {
if errors.Is(err, context.Canceled) {
if errors.Is(err, io.EOF) || errors.Is(err, context.Canceled) {
return nil
}
return err