New plugin callback to know when datachannel is writable #2060
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This patch adds support for the
SCTP_SENDER_DRY_EVENT
event fromusrsctplib
to our SCTP stack, which helps us with two main things:setup_media
for that, since that only tells you when ICE+DTLS have succeeded (and so the PeerConnection is up and running), but not that datachannels are available too. For that you need for the SCTP setup to complete too, and that's what the firstSCTP_SENDER_DRY_EVENT
event tells us.This is tied to a new plugin callback called
data_ready
:It's not mandatory to be implemented by plugins, but all our stock plugins make use of it one way or another. This includes Lua and Duktape, which invoke the
dataReady()
callback in the respective language on the loaded script, if implemented.This patch also adds some partial support for SCTP pending messages. If a message you're trying to send is too large for the SCTP to send, it will buffer it internally, and then try to delivery it in chunks later. We don't have a cap in there at the moment, but I'm thinking we should: if you're thinking of abusing it to just pass a humongous amount of data to the stack, notice it will perform crappily, if not crash entirely. You should use the
data_ready
callback instead to do this in a more sensitive way.Still experimental but seems to work (tested briefly), so feedback welcome: if you're planning to use it, please test and let me know if it does its job, and there are no regressions.