From ca98142d711f8a9cb05aea0fee83bd5fc8ec1847 Mon Sep 17 00:00:00 2001 From: Ethan Dickson Date: Tue, 18 Feb 2025 14:42:21 +1100 Subject: [PATCH] fix(vpn/tunnel): cancel updater ticks on tunnel stop --- vpn/tunnel.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/vpn/tunnel.go b/vpn/tunnel.go index 002963ae02744..e40732ae10e38 100644 --- a/vpn/tunnel.go +++ b/vpn/tunnel.go @@ -71,6 +71,7 @@ func NewTunnel( if err != nil { return nil, err } + uCtx, uCancel := context.WithCancel(ctx) t := &Tunnel{ //nolint:govet // safe to copy the locks here because we haven't started the speaker speaker: *(s), @@ -80,7 +81,8 @@ func NewTunnel( requestLoopDone: make(chan struct{}), client: client, updater: updater{ - ctx: ctx, + ctx: uCtx, + cancel: uCancel, netLoopDone: make(chan struct{}), uSendCh: s.sendCh, agents: map[uuid.UUID]tailnet.Agent{}, @@ -317,6 +319,7 @@ func sinkEntryToPb(e slog.SinkEntry) *Log { // updates to the manager. type updater struct { ctx context.Context + cancel context.CancelFunc netLoopDone chan struct{} mu sync.Mutex @@ -480,6 +483,7 @@ func (u *updater) stop() error { } err := u.conn.Close() u.conn = nil + u.cancel() return err } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy