From: Fabrice Bellet Date: Mon, 20 Apr 2020 21:24:21 +0000 (+0200) Subject: conncheck: properly select tcp-active discovered candidate X-Git-Tag: 0.1.17~38 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e7b049429fc3e1d5a5ce9197d5d5c128d599e379;p=platform%2Fupstream%2Flibnice.git conncheck: properly select tcp-active discovered candidate Some tcp-active discovered peer-reflexive local candidates may only be recognised by their local socket, if they have the same address and same port. It may happen when a nat generates an identical mapping from two different base local candidates. --- diff --git a/agent/conncheck.c b/agent/conncheck.c index 01731f9..7ba378b 100644 --- a/agent/conncheck.c +++ b/agent/conncheck.c @@ -1971,9 +1971,14 @@ local_candidate_and_socket_compatible (NiceAgent *agent, g_assert (socket); g_assert (lcand); - if (nice_socket_has_compatible_transport (socket, &transport)) + if (nice_socket_has_compatible_transport (socket, &transport)) { ret = (lcand->transport == transport); - else if (socket->type == NICE_SOCKET_TYPE_UDP_TURN) + /* tcp-active discovered peer-reflexive local candidate, where + * socket is the tcp connect related socket */ + if (ret && transport == NICE_CANDIDATE_TRANSPORT_TCP_ACTIVE && + nice_address_get_port (&lcand->addr) > 0) + ret = (lcand->sockptr == socket); + } else if (socket->type == NICE_SOCKET_TYPE_UDP_TURN) /* Socket of type udp-turn will match a unique local candidate * by its sockptr value. An an udp-turn socket doesn't carry enough * information when base socket is udp-turn-over-tcp to disambiguate