sctp: Start connection synchronously when starting the association
authorSebastian Dröge <sebastian@centricular.com>
Thu, 6 Feb 2020 16:43:35 +0000 (18:43 +0200)
committerSebastian Dröge <slomo@coaxion.net>
Wed, 12 Feb 2020 16:11:15 +0000 (16:11 +0000)
commitc497370254b03fc1ecd72221e6359996ceb73e0c
treec4464f91852a51b5003f936764c8b5c18d0382ff
parent4c5c6e68c6caff1d7eb9aa52226b0ced63ea0369
sctp: Start connection synchronously when starting the association

Calling bind() only sets up some data structures and calling connect()
only produces one packet before it returns. That packet is stored in a
queue that is asynchronously forwarded by the encoder's source pad loop,
so not much is happening there either. Especially no waiting is
happening here and no forwarding of data to other elements.

This fixes a race condition during connection setup: the connection
would immediately fail if we pass a packet from the peer to the socket
before bind() and connect() have returned.

This can't happen anymore as bind() and connect() have returned already
before both elements reach the PAUSED state, and in webrtcbin there is
an additional blocking pad probe before the decoder that does not let
any data pass through before that anyway.
ext/sctp/sctpassociation.c
ext/sctp/sctpassociation.h