1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-04 15:45:58 +01:00

Candidate Class Fixes

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@7499 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Thiago Camargo 2007-03-13 17:30:58 +00:00 committed by thiago
parent 879eab6e9d
commit d7a8aafba2
3 changed files with 38 additions and 8 deletions

View file

@ -270,12 +270,6 @@ public class ICECandidate extends TransportCandidate implements Comparable {
if (testResult.isReachable() && checkingCandidate.equals(candidate)) { if (testResult.isReachable() && checkingCandidate.equals(candidate)) {
result.setResult(true); result.setResult(true);
System.out.println("RESULT>>>OK:" + candidate.getIp() + ":" + candidate.getPort()); System.out.println("RESULT>>>OK:" + candidate.getIp() + ":" + candidate.getPort());
for (TransportCandidate c : localCandidates) {
CandidateEcho echo = candidate.getCandidateEcho();
if (echo != null) {
echo.removeResultListener(this);
}
}
} }
} }
}; };
@ -308,6 +302,13 @@ public class ICECandidate extends TransportCandidate implements Comparable {
e.printStackTrace(); e.printStackTrace();
} }
for (TransportCandidate candidate : localCandidates) {
CandidateEcho echo = candidate.getCandidateEcho();
if (echo != null) {
echo.removeResultListener(resultListener);
}
}
triggerCandidateChecked(result.isReachable()); triggerCandidateChecked(result.isReachable());
//TODO candidate is being checked trigger //TODO candidate is being checked trigger
@ -382,6 +383,29 @@ public class ICECandidate extends TransportCandidate implements Comparable {
else if (!getUsername().equals(other.getUsername())) { else if (!getUsername().equals(other.getUsername())) {
return false; return false;
} }
if (getIp() == null) {
if (other.getIp() != null) {
return false;
}
}
else if (!getIp().equals(other.getIp())) {
return false;
}
if (getPort() != other.getPort()) {
return false;
}
if (getType() == null) {
if (other.getType() != null) {
return false;
}
}
else if (!getType().equals(other.getType())) {
return false;
}
return true; return true;
} }

View file

@ -353,6 +353,11 @@ public abstract class TransportCandidate {
else if (!getIp().equals(other.getIp())) { else if (!getIp().equals(other.getIp())) {
return false; return false;
} }
if (getPort() != other.getPort()) {
return false;
}
if (getName() == null) { if (getName() == null) {
if (other.getName() != null) { if (other.getName() != null) {
return false; return false;

View file

@ -147,7 +147,8 @@ public abstract class TransportNegotiator extends JingleNegotiator {
throws XMPPException { throws XMPPException {
for (int i = 0; i < resolver.getCandidateCount(); i++) { for (int i = 0; i < resolver.getCandidateCount(); i++) {
//TODO FIX The EQUAL Sentence //TODO FIX The EQUAL Sentence
if (resolver.getCandidate(i).getIp().equals(bestLocalCandidate.getIp())) { if (resolver.getCandidate(i).getIp().equals(bestLocalCandidate.getIp())
&& resolver.getCandidate(i).getPort() == bestLocalCandidate.getPort()) {
acceptedLocalCandidate = resolver.getCandidate(i); acceptedLocalCandidate = resolver.getCandidate(i);
return; return;
} }
@ -384,7 +385,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
// Add the candidate to the list // Add the candidate to the list
if (remoteCandidate != null) { if (remoteCandidate != null) {
synchronized (validRemoteCandidates) { synchronized (validRemoteCandidates) {
System.out.println("ADDED Valid Cand: " + remoteCandidate.getIp()); System.out.println("ADDED Valid Cand: " + remoteCandidate.getIp() + ":" + remoteCandidate.getPort());
validRemoteCandidates.add(remoteCandidate); validRemoteCandidates.add(remoteCandidate);
} }
} }