Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Aug 30, 2024. It is now read-only.
/coder-v1-cliPublic archive

Ensure rtc conn is closed on error#438

Merged
deansheather merged 1 commit intomainfromclose-rtc-conn-err
Sep 10, 2021
Merged
Changes fromall commits
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
13 changes: 11 additions & 2 deletionswsnet/dial.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,6 +14,7 @@ import (
"github.com/pion/datachannel"
"github.com/pion/webrtc/v3"
"golang.org/x/net/proxy"
"golang.org/x/xerrors"
"nhooyr.io/websocket"

"cdr.dev/slog"
Expand DownExpand Up@@ -112,6 +113,11 @@ func Dial(ctx context.Context, conn net.Conn, options *DialOptions) (*Dialer, er
iceServers: rtc.GetConfiguration().ICEServers,
rtc: rtc.ConnectionState(),
}

closeErr := rtc.Close()
if closeErr != nil {
log.Warn(context.Background(), "close rtc connection on dial failure", slog.Error(closeErr))
}
}
}()

Expand DownExpand Up@@ -170,9 +176,12 @@ func Dial(ctx context.Context, conn net.Conn, options *DialOptions) (*Dialer, er
connClosers: []io.Closer{ctrl},
}

// This is on a separate line so the defer above catches it.
err = dialer.negotiate(ctx)
return dialer, err
if err != nil {
return nil, xerrors.Errorf("negotiate rtc connection: %w", err)
}

return dialer, nil
}

// Dialer enables arbitrary dialing to any network and address
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp