Commit Graph

39 Commits

Author SHA1 Message Date
Atsushi Watanabe
9fca58f510 Reduce blocking in datachannel handler
OnOpen handler is sometimes called with a huge delay in
TestDataChannel_Open and causes handler_should_be_called_once
failure.
This commit minimizes mutex lock scope around handler registration
and removes redundant mutex.

Also, add sleep before closing PeerConnections in
TestDataChannel_Open to ensure all messages are processed.
2019-12-15 02:13:29 -08:00
Sean DuBois
36a5685154 Fix race in checkDetachAfterOpen
checkDetachAfterOpen incorrectly accesses detachCalled
without holding the lock

Relates to #838
2019-12-10 16:55:18 -08:00
Patrick Lange
aa582df55e Add error when forgetting to Detach datachannel
Throw error after OnOpen if Detach has not been called but
DetachDataChannels is used.

Resolves #838
2019-12-10 01:18:16 -08:00
Hugo Arregui
e4d636da91 Check for dc.id in stats
Recent changes allow a dc to have a nil id before it's actually open,
but stats used to require the id.
2019-11-29 10:35:01 -08:00
Sean DuBois
bba6460597 Allow user to Close DataChannel before signaling
Match W3C WebRTC and allow a DataChannel to close even before
signaling happens. When SCTPTransport opens make sure
to check the readyState first.
2019-11-25 17:18:47 -08:00
Sean DuBois
1c32bc9a46 Properly set DataChannel readyState on Close
DataChannel readyState should be set to Closed on PeerConnection
shutdown. If not properly set it would attempt to interact with
state that doesn't exist after the PeerConnection has been Closed.

Setting the readyState is also clearly defined in the W3C webrtc-pc

Resolves #915
2019-11-22 18:06:43 -08:00
Sean DuBois
721b342e2e Properly generate DataChannel streamId
Before we computed DataChannel IDs before signaling, this
is incorrect because IDs must take into account if we are
running an DTLS Client or Server.

This updates the DataChannel ID generation code to take this
into account before generating a streamId.

Resolves #908
2019-11-14 10:51:05 -08:00
Vicken Simonian
5f25df2209 Various spell fixes
For error types, vars, docs and comments
2019-10-17 23:31:21 -07:00
Sean DuBois
92867d3de6 Support negotiated DataChannels in Go
Relates to #748
2019-09-28 22:34:57 -07:00
Sean DuBois
d692ddfa54 Support DataChannel protocol in Go
Relates to #748
2019-09-27 16:19:49 -07:00
Sean DuBois
d54b494292 Remove RTCDataChannel priority
This has been removed from webrtc-pc[0]

Relates to #748

[0] https://github.com/w3c/webrtc-pc/issues/2258
2019-09-26 15:44:19 -07:00
Sean DuBois
dbca703798 Don't return event status if unused
In lots of our event handlers we return the event status.
This is so we can know if the callee has finished. In lots
of cases we don't care so get rid of them to simplify the code.
2019-09-15 21:01:47 -07:00
spaceCh1mp
26f0fa5d33 Implement RTCDataChannel onError
OnError sets an event handler which is called
when the data transport cannot be read

Resolves #746
2019-07-28 01:27:03 -07:00
Sean DuBois
2f4049b15a Replace TODOs in PeerConnection with issues
Update all TODOs with issues in github

Relates to #106
2019-07-22 21:31:39 -07:00
Sean DuBois
e0a748c2d7 Remove TODO from DataChannel Priority
This value is properly passed into SCTP now

Relates to #106
2019-07-22 21:31:39 -07:00
Cecylia Bocovich
b6bacf34c6 Increase dataChannelBufferSize to send limit
The current dataChannelBufferSize is less than the limit used in
WriteSCTP (called by Send), which means that peers using this
implementations of WebRTC can send messages that will be thrown out by
Read because of an io.ErrShortBuffer error.
In the case that the message is too long, a more appropriate response
would be to close the channel and issue an error rather than log a
warning and continue reading data.
2019-07-12 11:29:42 -04:00
Hugo Arregui
2d465ebeee Fix datachannel stats invalid pointer
Datachannel can be have a nil datachannel pointer
2019-07-02 18:51:04 +00:00
Hugo Arregui
93261960b1 Basic stats
Load DC, CandidatePair and Candidate basic stats
2019-06-25 19:36:57 +00:00
Hugo Arregui
7c94c5478c Fix DC open
it's expected for a open Datachannel to have an associated
datachannel.Datachannel. Handling everything under the same lock
guarantee that
2019-05-22 14:18:42 -07:00
Hugo Arregui
24afce2c9a Execute openHandler once per session
Wrap it in Once and restore it every time a new session is established
2019-05-20 14:04:12 -03:00
Alex Browne
41c1f3c84e Fire DataChannel.onOpenHandler if already open
Fire the onOpenHandler immediately if the DataChannel is already open.
This helps prevent race conditions where the DataChannel is opened
before the onOpenHandler is set up, meaning the onopen event is never
received.
2019-05-13 13:47:34 -04:00
Adam Kiss
7820ed0726 Fixed create data channel
Data channel creation checks if the sctp transport is already
established. Because this check was incorrect, in some cases it returned
an error instead of delaying opening the data channel until the sctp
connection is established. Fixed the check. Added locking to
CreateDataChannel to avoid race condition. Added test.
2019-04-24 11:11:06 -07:00
Sean DuBois
c3e4e020d4 Fix race in SCTP teardown
When channel is being torn down we unset the association,
at the same time others may be accessing it. Found with
-race in travis-ci
2019-04-18 22:15:07 -07:00
Sean DuBois
dbde6114a2 Update import paths
Add /v2 to import paths everywhere
2019-04-07 02:17:15 -07:00
Yutaka Takeda
3884c8c32c Pass the logger factory to sctp and datachannel
Resolves #569
2019-04-06 15:52:49 -07:00
Yutaka Takeda
c7a5c7b0c1 Impleted bufferedAmount interface
Resolves #569
2019-04-06 15:52:49 -07:00
Sean DuBois
1cdfc10c84 Mass replace pions -> pion
Pions organization was renamed to pion
2019-04-04 15:32:03 -07:00
Hugo Arregui
bb83935773 Use newDataChannel in sctp transport
Replace direct instantiation. Replace some print lines too.
2019-04-03 15:26:30 -03:00
Hugo Arregui
87897285b1 Custom Loggers
Define LoggerFactory as part of the SettingEngine
2019-04-01 11:14:13 -03:00
backkem
f1c3fb8e81 Change detach to interface
This is in preparation of a JS/WASM shim.
2019-04-01 15:40:45 +02:00
backkem
fe0e4d692b Move logging out of tree
Relates to #361
2019-03-21 12:48:57 +01:00
Yutaka Takeda
8bd831fafe Change public DataChannel props to methods
Resolves #505
2019-03-19 08:33:18 -07:00
Yutaka Takeda
b31effa2b7 Switch from read lock to write lock
Resolves #505
2019-03-11 22:15:27 -07:00
Alex Browne
0f1ddf0825 Add JavaScript/WASM bindings
Resolves #478. Adds minimal JavaScript/WASM bindings. This makes it
possible to compile core parts of pions/webrtc to WASM and run it in the
browser. Only data channels are supported for now and there is
limited/no support for certificates and credentials.
2019-03-08 00:26:17 +01:00
Sean DuBois
43604d5491 Remove pkg/errors dependency
Lots of people are paying attention to what dependecies we add to their
projects now. This just makes things a little cleaner.

Resolves #469
2019-03-06 09:34:10 -08:00
backkem
f5d11df18d API: Review DataChannel
Resolves #427
2019-02-22 15:35:32 +01:00
Yutaka Takeda
0e9e1b0c48 Update sctp and datachannel revs
Resolves #334
2019-02-18 21:27:31 +01:00
Yutaka Takeda
4dc68ed0da Wire reliability params to datachannel
Resolves #334
2019-02-18 21:27:31 +01:00
Max Hawkins
0647ce9c26 Remove rtc prefix from filenames
Relates to #408
2019-02-17 16:22:56 -08:00