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

fix: Remove unused context from RTC Dial #336

Merged
merged 2 commits into from
May 9, 2021
Merged
Changes from all 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
10 changes: 3 additions & 7 deletions wsnet/dial.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ func DialWebsocket(ctx context.Context, broker string, iceServers []webrtc.ICESe
// We should close the socket intentionally.
_ = conn.Close(websocket.StatusInternalError, "an error occurred")
}()
return Dial(ctx, nconn, iceServers)
return Dial(nconn, iceServers)
}

// Dial negotiates a connection to a listener.
func Dial(ctx context.Context, conn net.Conn, iceServers []webrtc.ICEServer) (*Dialer, error) {
func Dial(conn net.Conn, iceServers []webrtc.ICEServer) (*Dialer, error) {
if iceServers == nil {
iceServers = []webrtc.ICEServer{}
}
Expand Down Expand Up @@ -129,11 +129,7 @@ func (d *Dialer) negotiate() (err error) {
for {
var msg protoMessage
err = decoder.Decode(&msg)
if errors.Is(err, io.EOF) {
break
}
if websocket.CloseStatus(err) == websocket.StatusNormalClosure {
// The listener closed the socket because success!
if errors.Is(err, io.EOF) || errors.Is(err, io.ErrClosedPipe) {
break
}
if err != nil {
Expand Down