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

Commit 42f626f

Browse files
committed
fix: Properly handle data channel timeout
1 parent 9adbf4f commit 42f626f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

xwebrtc/dialer.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,12 @@ 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+
122+
_ = conn.Close(websocket.StatusAbnormalClosure, "data channel timed out")
123+
return
121124
}
122-
_ = control.Close()
123125
_ = conn.Close(websocket.StatusNormalClosure, "rtc connected")
124126
}()
125127

0 commit comments

Comments
 (0)