Skip to content

fix: agent panics on closed network #5295

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Dec 5, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix
  • Loading branch information
mtojek committed Dec 5, 2022
commit 9169bcc9e92be9cad3c3236756f9b5c1ae52667a
3 changes: 0 additions & 3 deletions agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,13 +262,10 @@ func (a *agent) createTailnet(ctx context.Context, derpMap *tailcfg.DERPMap) (ne
return nil, xerrors.Errorf("create tailnet: %w", err)
}
defer func() {
// Apparently, it's possible to shut down network via agent.Close().
// The condition `network != nil` prevents panic in tests.
if err != nil {
network.Close()
}
}()
// a.network = network
a.closeMutex.Unlock()

sshListener, err := network.Listen("tcp", ":"+strconv.Itoa(codersdk.TailnetSSHPort))
Expand Down