Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2a248b1

Browse files
fix(vpn/tunnel): cancel updater ticks on tunnel stop (#16598)
Closescoder/coder-desktop-macos#51.
1 parent06b2186 commit2a248b1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

‎vpn/tunnel.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ func NewTunnel(
7171
iferr!=nil {
7272
returnnil,err
7373
}
74+
uCtx,uCancel:=context.WithCancel(ctx)
7475
t:=&Tunnel{
7576
//nolint:govet // safe to copy the locks here because we haven't started the speaker
7677
speaker:*(s),
@@ -80,7 +81,8 @@ func NewTunnel(
8081
requestLoopDone:make(chanstruct{}),
8182
client:client,
8283
updater:updater{
83-
ctx:ctx,
84+
ctx:uCtx,
85+
cancel:uCancel,
8486
netLoopDone:make(chanstruct{}),
8587
uSendCh:s.sendCh,
8688
agents:map[uuid.UUID]tailnet.Agent{},
@@ -317,6 +319,7 @@ func sinkEntryToPb(e slog.SinkEntry) *Log {
317319
// updates to the manager.
318320
typeupdaterstruct {
319321
ctx context.Context
322+
cancel context.CancelFunc
320323
netLoopDonechanstruct{}
321324

322325
mu sync.Mutex
@@ -480,6 +483,7 @@ func (u *updater) stop() error {
480483
}
481484
err:=u.conn.Close()
482485
u.conn=nil
486+
u.cancel()
483487
returnerr
484488
}
485489

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp