Skip to content

chore: Update pion/ice fork to resolve goroutine leak #78

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Jan 28, 2022
Prev Previous commit
Next Next commit
Try locking only on remote
  • Loading branch information
kylecarbs committed Jan 27, 2022
commit 6f7e3af78d6ac84d16b14c32699a2870a8c20d5f
20 changes: 5 additions & 15 deletions peer/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,18 +287,14 @@ func (c *Conn) negotiate() {
c.opts.Logger.Debug(context.Background(), "setting remote description")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should put fields on these so they have more details

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't wanna leak the session description in logs, since it technically contains the exchange keys.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a risk? We already log this stuff on coder already. Only the two peers would be able to see the keys.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't really help IMO. Since we catch all errors, this would error if the session description was invalid.

err := c.rtc.SetRemoteDescription(remoteDescription)
if err != nil {
c.pendingCandidatesMutex.Unlock()
_ = c.CloseWithError(xerrors.Errorf("set remote description (closed %v): %w", c.isClosed(), err))
return
}

if c.offerrer {
// ICE candidates reset when an offer/answer is set for the first
// time. If candidates flush before this point, a connection could fail.
err = c.flushPendingCandidates()
if err != nil {
_ = c.CloseWithError(xerrors.Errorf("flush pending candidates: %w", err))
}
// ICE candidates reset when an offer/answer is set for the first
// time. If candidates flush before this point, a connection could fail.
err = c.flushPendingCandidates()
if err != nil {
_ = c.CloseWithError(xerrors.Errorf("flush pending candidates: %w", err))
}

if !c.offerrer {
Expand All @@ -321,12 +317,6 @@ func (c *Conn) negotiate() {
return
case c.localSessionDescriptionChannel <- answer:
}

// Wait until the local description is set to flush candidates.
err = c.flushPendingCandidates()
if err != nil {
_ = c.CloseWithError(xerrors.Errorf("flush pending candidates: %w", err))
}
}
}

Expand Down