Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit 9806f29

Browse files
authored
fix: Properly handle data channel timeout (#328)
1 parent 9adbf4f commit 9806f29

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

xwebrtc/dialer.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,11 @@ func (wc *WorkspaceDialer) peerConnection(ctx context.Context, workspaceID strin
116116
}
117117
go func() {
118118
err = waitForDataChannelOpen(ctx, control)
119+
_ = control.Close()
119120
if err != nil {
120-
wc.log.Fatal(ctx, "waiting for data channel open", slog.Error(err))
121+
_ = conn.Close(websocket.StatusAbnormalClosure, "data channel timed out")
122+
return
121123
}
122-
_ = control.Close()
123124
_ = conn.Close(websocket.StatusNormalClosure, "rtc connected")
124125
}()
125126

0 commit comments

Comments
 (0)