From 338409c769435be5135697c81aa0c090f0a369e8 Mon Sep 17 00:00:00 2001 From: seb Date: Wed, 12 Oct 2011 15:11:19 +0000 Subject: [PATCH] Fixes Google's ICE with TCP transport. --- src/org/ice4j/ice/Component.java | 12 ++++++++++++ src/org/ice4j/ice/ConnectivityCheckClient.java | 14 +++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/org/ice4j/ice/Component.java b/src/org/ice4j/ice/Component.java index 16b2a8f..d11120e 100644 --- a/src/org/ice4j/ice/Component.java +++ b/src/org/ice4j/ice/Component.java @@ -340,6 +340,18 @@ public class Component { if(localCnd.canReach(remoteCnd)) { + if(localCnd.getTransport() == Transport.TCP && + localCnd.getIceSocketWrapper().getTCPSocket(). + isConnected()) + { + if(!localCnd.getIceSocketWrapper().getTCPSocket(). + getRemoteSocketAddress().equals( + remoteCnd.getTransportAddress())) + { + continue; + } + } + CandidatePair pair = new CandidatePair(localCnd, remoteCnd); logger.info("new Pair added: " + pair.toShortString()); diff --git a/src/org/ice4j/ice/ConnectivityCheckClient.java b/src/org/ice4j/ice/ConnectivityCheckClient.java index ab17ffc..98cca6f 100644 --- a/src/org/ice4j/ice/ConnectivityCheckClient.java +++ b/src/org/ice4j/ice/ConnectivityCheckClient.java @@ -189,6 +189,8 @@ class ConnectivityCheckClient //nominated pairs. if(candidatePair.isNominated()) { + logger.info("set useCandidateSent for " + + candidatePair.toShortString()); candidatePair.setUseCandidateSent(); } } @@ -517,8 +519,13 @@ class ConnectivityCheckClient .getAttribute(Attribute.USERNAME); String username = new String(uname.getUsername()); String ufrag = username.substring(16, 32); - validLocalCandidate = parentAgent.findLocalCandidate(mappedAddress, - ufrag); + + if(mappedAddress.getTransport() == Transport.TCP) + validLocalCandidate = parentAgent.findLocalCandidate( + mappedAddress); + else + validLocalCandidate = parentAgent.findLocalCandidate( + mappedAddress, ufrag); } else if(parentAgent.getCompatibilityMode() == CompatibilityMode.RFC5245) { @@ -666,7 +673,8 @@ class ConnectivityCheckClient logger.info("IsControlling: " + parentAgent.isControlling() + " USE-CANDIDATE:" + - request.containsAttribute(Attribute.USE_CANDIDATE)); + (request.containsAttribute(Attribute.USE_CANDIDATE) || + checkedPair.useCandidateSent())); //If the agent was a controlling agent, and it had included a USE- //CANDIDATE attribute in the Binding request, the valid pair generated