ice_session: various fixes with TURN connections

This patch contains two fixes:
1. It moves a check for waiting passive connections to finish.
Indeed, we were waiting for passive connections (such as TURN) to
give a result only when we were a controlling agent (and nominating).
In fact, if the agent is not nominating (before getting a USE-CANDIDATE
or if it's controlled, the problem is the same, we need to wait that
the peer connects if we are the only one with TURN enabled).
Also, the RFC is only talking about waiting passive connections, not
if controlling or not.
2. It increases the number of connections attempt if we got a
connection reset by peer (if the TURN didn't authorize us). The previous
timeout was 4 seconds (12 now). It was not enough if we were sending
candidates over the DHT (the first put encrypted can take 10 seconds,
then it will be faster, causing some first call to fail).

For more details:
https://git.jami.net/savoirfairelinux/jami-daemon/-/issues/746

Note: squash with rfc6544 if rebased to pjproject 2.13

Change-Id: I3b8e807d9cf0722d59500eec9cb5ebdfe97133e2
3 files changed