59 Commits

Author SHA1 Message Date
cnderrauber
c5d629f4fc Add methods for tweaking sctp cc to settingending
Relate: https://github.com/pion/sctp/pull/354
2025-05-19 15:45:23 +08:00
Sean DuBois
705b728d28 Pass Configured MTU into SCTP
Before pion/sctp would always do 1228
2025-04-25 14:21:36 -04:00
sirzooro
c79463deab Added SCTPTransport.BufferedAmount
It simplifies tracking amount of unsent data for all data channels,
including ones in closing state. Especially useful for IoT apps
which use multiple data channels and have to monitor memory usage.
2025-04-14 18:22:17 +02:00
Sean DuBois
e4ff415b2b Support DataChannel messages larger then MaxUint16
SCTP now internally can handle larger messages

Resolves #2712
2025-03-04 18:22:14 -08:00
Joe Turki
feeeebf251 Upgrade golangci-lint, more linters
Introduces new linters, upgrade golangci-lint to version (v1.63.4)
2025-01-18 07:16:06 -06:00
sukun
b82306ab62 Fix detached datachannels handling
https://github.com/pion/webrtc/pull/2696 introduced removing
datachannels from the sctptransport for better garbage collection.

That PR introduced a race condition for data channels created before
connection establishment. When an out of band negotiated data channel,
created before peerconnection establishment is detached, there's a race
between the data channel being removed from `r.dataChannels` and it
being copied in to the existing data channel slice in the
acceptDataChannels goroutine.

This PR fixes this race by copying the slice before any datachannels
could be detached.
2024-12-24 17:00:21 +00:00
cnderrauber
9cfda8be16 Add EnableDataChannelBlockWrite to SettingEngine
The settingengine can enabled block write if
datachannel is detached, makes it working like
a normal net.Conn.
2024-12-16 12:18:56 +08:00
Cedric Raymond
5bf7c9465c Send Abort In SCTP Close
Sending Abort message to follow WebRTC standard
2024-09-23 13:56:37 -04:00
Pion
752e442994 Update CI configs to v0.11.15
Update lint scripts and CI configs.
2024-08-16 14:13:11 -04:00
sukun
6cfa00f1bc Provide SCTP Association OnClose callback 2024-08-12 22:15:39 +05:30
sukun
835ac3b08e Drop reference to detached datachannels
This allows users of detached datachannels to garbage collect
resources associated with the datachannel and the sctp stream.
There is no functional change here.
2024-03-24 22:21:35 -04:00
Sean DuBois
5d7c2bf74f Remove unused member in SCTPTransport
RTOMax wasn't actually being stored, is being pulled directly from
SettingEngine
2024-03-18 13:14:44 -04:00
Benny Daon
fb82fff2bc Add SetSCTPRTOMax to SettingEngine
Allows the user to cap the retranmission timeout, this change adds
RTOMax to SettingEngine and pass it on when creating the SCTP Assocation
2024-03-18 09:40:55 -04:00
Sean DuBois
1dbcf67844 Put SCTP Zero Checksum behind SettingEngine
Old versions of Pion break against it
2024-03-18 09:33:27 -04:00
Sean DuBois
fc6f9a2ec8 Enable SCTP Zero Checksum
Available in github.com/pion/sctp@v1.8.12
2024-02-09 14:38:24 -05:00
Sean DuBois
dc4b591c4d Start pion/webrtc/v4
60eea43 is a breaking change
2023-09-05 11:48:14 -04:00
Will Forcey
ee483daf56 Add SCTPTransportStats 2023-08-21 00:19:32 -04:00
Steffen Vogel
683fc837d0 Make repo REUSE compliant 2023-05-05 11:58:49 -04:00
Jerry Tao
16fea9ee04 Set DataChannel SCTPTransport before OnDataChannel
ORTC API would return a nil SCTPTransport for DataChannels returned via
Callback
2023-04-24 00:51:50 -04:00
Pion
308f8616a3 Update CI configs to v0.10.6
Update lint scripts and CI configs.
2023-04-08 14:24:19 -04:00
Atsushi Watanabe
777437895c Fix datachannel accept EOF check logic
Fix the logic inverted by c1467e4
2022-05-11 20:52:16 -04:00
Pion
c1467e4871 Update CI configs to v0.7.2
Update lint scripts and CI configs.
2022-04-27 23:00:19 -04:00
Yutaka Takeda
eb1f6ad2db Max recv buf size via SettingEngine
Relates to pion/sctp#218
2022-04-27 17:19:02 -07:00
Sean DuBois
157220e800 Run gofmt to add new build constraints
Also remove some 1.13 specific WASM code
2022-01-17 22:36:01 -05:00
Sean DuBois
e2af355047 Take lock when getting DataChannel ID
Resolves #2023
2021-11-15 13:28:58 -05:00
Sean DuBois
1705641fa4 Open all DataChannels before accepting remote
A race existed with Negotiated DataChannels before this. Before
the remote could sends us a DataChannel message before the
datachannel was negotiated locally. We would then discard the
message and print an error.

This PR moves the processing of remote datachannel messages after
we have registered all local ones. It also informs
datachannel.Accept of existing datachannels in order to prevent
any initialization logic from proceeding incorrectly.
2021-11-09 10:51:14 -05:00
Eric Daniels
5dc7245bee Fire DataChannel.onOpen when already negotiated
Fix regression from 0180ee. Before Datachannels would always fire
OnOpen. Now they only fire when DCEP ACK is received. This caused
OnOpen to not be fired for negotiated channels. This re-enables
the previous behavior of firing OnOpen for negotiated channels.
2021-11-01 12:23:37 -04:00
Benny Daon
0180ee3805 Use OnOpen handler for DataChannels
Using an improvment of pion/datachannel, the channel opener can now
set an event to be called when the DATA_CHANNEL_ACK message is recieved

Resolves #1063
Relates to pion/datachannel#81
2021-10-28 11:59:51 -04:00
Dean Sheather
f8ecedc524 Fix double loop in data channel ID generation
(*SCTPTransport).generateAndSetDataChannelID performed a double loop to
find the next available data channel ID. This changes that behavior to
generate a lookup map with the taken IDs first, so generating a data
channel ID takes much less time.

Before, it would take more than 1000ms to generate the next data channel
ID once you had roughly 50k of them. Now it only takes 4ms at that same
point.

Fixes #1945
2021-09-07 20:45:30 -04:00
Markus Tzoe
338dfa81f1 SCTPTransport: add association()
use assocation() instead of accessing private struct member from
outside
2021-04-06 20:54:46 -07:00
Markus Tzoe
2f77a28dca Fixes DataChannel panic on sctptransport race
DataChannel.open would panic during which if PeerConnection is closed,
stopping underlying sctpTransport which sets association to nil;

And ensureSCTP() method doesn't guarantee sctpTransport's availability
out of it's own scope.
2021-04-05 22:06:24 -07:00
Sean DuBois
9715626a0c Revert "Read/Write RTP/RTCP packets with context"
This change caused a ~24% performance decrease

Relates to pion/webrtc#1564

This reverts commit 47a7a64898.
2020-12-02 20:11:06 -08:00
Atsushi Watanabe
47a7a64898 Read/Write RTP/RTCP packets with context
Control cancel/timeout by context.
2020-12-01 11:08:48 +09:00
Sean DuBois
804a12fed3 Update CI configs to v0.4.7
Update lint scripts and CI configs.
2020-09-30 09:06:34 -07:00
soolaugust
6f6de25b24 Modify all hdlr to handler for better reading
change hdlr -> handler, Hdlr -> Handler for better reading.
Since this is first commit, add myself to contributors
2020-08-17 22:04:29 -07:00
Sean DuBois
9f1417347a Support creating a DataChannel during renegotation
Before when creating an offer during renegotation we didn't support
adding a DataChannel.

Resolves #1361
2020-08-12 21:43:34 -07:00
Sean DuBois
89d7de1787 Start /v3
See #9 for the features we have planned, and the breaking changes that
may occur.
2020-06-25 09:45:27 -07:00
Atsushi Watanabe
58338965b2 Fix DataChannel open race
Concurrent call of generateDataChannelID caused data race.
2020-03-28 15:15:21 -07:00
Ilya Mayorov
896f8e360f Callback to handle SCTPTransport errors
Add SCTPTransport.OnError() func to handle errors in a new goroutine.
2019-12-08 22:39:55 -08:00
Sean DuBois
36b02632d1 Match W3C when closing
PeerConnection.Close() doesn't match the W3C RFC on closing,
re-order the transports so that they close in the proper order.

In the future we will use the DTLS Close alert and RTCP Bye to
better communicate shutdown
2019-11-21 11:55:48 -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
Hugo Arregui
ec6c432dc8 Add ICE transport and SCTP transport stats
bytes received, bytes sent
2019-08-22 18:31:17 +00:00
Sean DuBois
67073fbe16 Fix SCTPTransport race if stopped during start
Pass association to readLoop instead of accessing SCTPTransport
inside readloop. It is possible that before the read loop starts
the SCTPTransport assocation could be cleared, this would cause
us to pass a  nil assocation to pion/datachannel

Resolves #571
2019-08-22 11:03:30 -07:00
Sean DuBois
0a62e5d4c1 Create WASM covering review
We have a few things that need to be addressed, I
have ticketed them. We should now completely pass godox!

Resolves #106
2019-07-27 09:35:55 -07:00
Sean DuBois
b205912701 Ticket SCTP TODOs
Currently we log some errors that should stop the PeerConnection
Also get rid of port value, this doesn't have any value for
us

Relates to #106
2019-07-27 09:35:55 -07: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