Skip to content

Commit 7429987

Browse files
committed
Fix closing when agent fails
1 parent 77997b4 commit 7429987

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

agent/agent.go

+3
Original file line numberDiff line numberDiff line change
@@ -450,17 +450,20 @@ func (a *agent) createTailnet(ctx context.Context, derpMap *tailcfg.DERPMap) (_
450450
rawLen := make([]byte, 2)
451451
_, err = conn.Read(rawLen)
452452
if err != nil {
453+
close(closed)
453454
continue
454455
}
455456
length := binary.LittleEndian.Uint16(rawLen)
456457
data := make([]byte, length)
457458
_, err = conn.Read(data)
458459
if err != nil {
460+
close(closed)
459461
continue
460462
}
461463
var msg codersdk.ReconnectingPTYInit
462464
err = json.Unmarshal(data, &msg)
463465
if err != nil {
466+
close(closed)
464467
continue
465468
}
466469
_ = a.trackConnGoroutine(func() {

0 commit comments

Comments
 (0)