Conversation
|
Could you please explain why a non-blocking API is better than using the existing API in a separate goroutine? (Also, I could be mistaken, but I think that the new API is asynchronous rather than nonblocking.) |
|
API symmetry is one reason, the DTLS API makes a clear distinction between setting up the connection and not returning until the connection is up ( |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #862 +/- ##
==========================================
+ Coverage 88.53% 88.60% +0.06%
==========================================
Files 44 44
Lines 5540 5564 +24
==========================================
+ Hits 4905 4930 +25
+ Misses 440 438 -2
- Partials 195 196 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
af458bc to
7411e97
Compare
|
No objection, even though I tend to prefer using multiple goroutines to asynchronous APIs, which I find error-prone. I've looked at the first commit, and it looks good to me. Minor nits:
Have you already submitted the code where you use the new API? May I have a look? I don't understand why the second commit is being submitted as part of the same PR, but in any case I'm not competent to review it. |
e27a9c3 to
187b3ea
Compare
|
Thanks. The first commit looks good to me. |
Done, thank you!
https://github.com/fippo/pion-webrtc/blob/snap-sped/icetransport.go#L93
githubs continued lack of support for stacked PRs / branches... should vanish once the other PR is merged |
Thanks. While you wait for this commit to land, you could do something like the following, which would decouple the two commits and avoid the issues with stacked branches: type connErr struct {
conn *Conn
err error
}
func (a *Agent) StartDial(remoteUfrag, remotePwd string) (chan connErr) {
ch := make(chan connErr)
go func() {
conn, err := a.Dial(context.Background(), remoteUfrag, remotePwd)
ch <- connErr{conn, err}
}()
return ch
}
func (a *Agent) AwaitConnect(ch chan connErr) (*Conn, error) {
ce <- ch
return ce.conn, ce.err
} |
187b3ea to
5d24c01
Compare
adding `StartDial`, `StartAccept` and `AwaitConnect` methods which allow more control than `Start` and `Accept` This will allow the peer connection API to start DTLS before the ICE connection is established, see pion/webrtc#3335
fbf0060 to
3b7ab38
Compare
|
(rebased so should be easier to review now) |
|
@fippo @jech @JoTurk I would like to do a new major version and break APIs to match
Less confusing for existing Go devs. |
|
Bad idea? |
|
@Sean-Der I agree but I don't think ICE is ready for a new major version yet, i would like us to clean more things first, especially around TCP handling. and srflx gathering, prflx too, and i would like to wait for the final API for multiple path write, and batching (I don't like adding batching as a high level API it should be integrated in pion/transport and ice as low level). Maybe a new API (just a different name) and mark the current |
this would mostly work (apart from read and write) integration as is? I can add comments capturing that plan which SGTM |
This adds a nonblocking API for ICE that will allow the PeerConnection's
startTransportsto start ICE, not wait for ICE to connect and start DTLS so the DTLS handshake can be piggybacked into the STUN messages earlier.