agent: fix tcp connection to turn servers
authorFabrice Bellet <fabrice@bellet.info>
Wed, 6 May 2020 12:09:08 +0000 (14:09 +0200)
committerOlivier CrĂȘte <olivier.crete@ocrete.ca>
Fri, 8 May 2020 19:34:12 +0000 (19:34 +0000)
commitf974224ecede2898386d2959b6c4a8510c044251
treeafe4ebd5d20398ffc030a643bacaf5e6e83f2eb1
parentdaa6c296a7aff68bb44b5364bef70fbdc749f746
agent: fix tcp connection to turn servers

A previous commit broke the logic used to start a discovery request for
tcp turn servers. The ambiguity came from the distinction between the
type of the turn server (turn->type), the compatibility of the
transport of the local base candidate (turn_tcp), and the reliability
of the underlying tcp socket (reliable_tcp).

reliable_tcp indicates whether the turn allocate request should be
"framed" in a tcp packet, according to RFC 4571. This is required in
OC2007R2 only.

This commit also puts the setup of the tcp turn socket in a separate
function, because such setup is also required when handling
try-alternate (code 300) stun errors on these tcp sockets, where we have
to setup a new connection to another tcp turn server.
agent/agent-priv.h
agent/agent.c