conncheck: match remote candidates on the socket reliability
authorFabrice Bellet <fabrice@bellet.info>
Thu, 20 Feb 2020 16:05:51 +0000 (17:05 +0100)
committerOlivier CrĂȘte <olivier.crete@ocrete.ca>
Mon, 2 Mar 2020 22:31:58 +0000 (22:31 +0000)
When the couple (address, port) is identical between two remote
candidates, we may have to match a remote candidate based on its socket
reliability.

agent/conncheck.c

index 315a587..841749c 100644 (file)
@@ -1923,6 +1923,7 @@ priv_match_remote_candidate_transport_and_socket_type (NiceAgent *agent,
     NiceCandidate *candidate, NiceSocket *socket)
 {
   gboolean ret = TRUE;
+  gboolean reliable = nice_socket_is_reliable (socket);
   g_assert (socket);
   g_assert (candidate);
 
@@ -1932,15 +1933,14 @@ priv_match_remote_candidate_transport_and_socket_type (NiceAgent *agent,
    * couple (address, port), they must be identified by their
    * matching transport.
    */
-  if (socket->type == NICE_SOCKET_TYPE_UDP_BSD &&
-      candidate->transport == NICE_CANDIDATE_TRANSPORT_TCP_ACTIVE)
+  if (!reliable && candidate->transport == NICE_CANDIDATE_TRANSPORT_TCP_ACTIVE)
     ret = FALSE;
-  if (socket->type == NICE_SOCKET_TYPE_TCP_BSD &&
-      candidate->transport == NICE_CANDIDATE_TRANSPORT_UDP)
+  if (reliable && candidate->transport == NICE_CANDIDATE_TRANSPORT_UDP)
     ret = FALSE;
 
-  nice_debug_verbose ("Agent %p : socket/candidate compat: %s and %s: %s",
+  nice_debug_verbose ("Agent %p : socket/candidate compat: %s (%s) and %s: %s",
       agent, priv_socket_type_to_string (socket->type),
+      reliable ? "reliable" : "not reliable",
       priv_candidate_transport_to_string (candidate->transport),
       ret ? "yes" : "no");