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

fix: Properly handle data channel timeout #328

Merged
merged 2 commits into from
Apr 30, 2021
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
6 changes: 4 additions & 2 deletions xwebrtc/dialer.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,12 @@ func (wc *WorkspaceDialer) peerConnection(ctx context.Context, workspaceID strin
}
go func() {
err = waitForDataChannelOpen(ctx, control)
_ = control.Close()
if err != nil {
wc.log.Fatal(ctx, "waiting for data channel open", slog.Error(err))

_ = conn.Close(websocket.StatusAbnormalClosure, "data channel timed out")
return
}
_ = control.Close()
_ = conn.Close(websocket.StatusNormalClosure, "rtc connected")
}()

Expand Down