1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-12-26 20:47:58 +01:00

ECHO Fixes

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@7475 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Thiago Camargo 2007-03-12 19:46:03 +00:00 committed by thiago
parent 3787c7a8af
commit 1983632730
2 changed files with 11 additions and 11 deletions

View file

@ -269,6 +269,13 @@ public class ICECandidate extends TransportCandidate implements Comparable {
public void testFinished(TestResult testResult, TransportCandidate candidate) {
if (testResult.isReachable() && checkingCandidate.equals(candidate)) {
result.setResult(true);
System.out.println("RESULT>>>OK:" + candidate.getIp() + ":" + candidate.getPort());
for (TransportCandidate c : localCandidates) {
CandidateEcho echo = candidate.getCandidateEcho();
if (echo != null) {
echo.removeResultListener(this);
}
}
}
}
};
@ -301,13 +308,6 @@ public class ICECandidate extends TransportCandidate implements Comparable {
e.printStackTrace();
}
for (TransportCandidate candidate : localCandidates) {
CandidateEcho echo = candidate.getCandidateEcho();
if (echo != null) {
echo.removeResultListener(resultListener);
}
}
triggerCandidateChecked(result.isReachable());
//TODO candidate is being checked trigger

View file

@ -705,7 +705,7 @@ public abstract class TransportCandidate {
//System.out.println("ECHO Packet Received in: " + socket.getLocalAddress().getHostAddress() + ":" + socket.getLocalPort() + " From: " + packet.getAddress().getHostAddress() + ":" + packet.getPort());
boolean reply = false;
boolean accept = false;
ByteBuffer buf = ByteBuffer.wrap(packet.getData());
byte[] content = new byte[packet.getLength()];
@ -714,8 +714,8 @@ public abstract class TransportCandidate {
packet.setData(content);
for (DatagramListener listener : listeners) {
reply = listener.datagramReceived(packet);
if (reply) break;
accept = listener.datagramReceived(packet);
if (accept) break;
}
long delay = 200 / tries / 2;
@ -728,7 +728,7 @@ public abstract class TransportCandidate {
String ip = address[0];
String port = address[1];
if (pass.equals(candidate.getPassword())) {
if (pass.equals(candidate.getPassword()) && !accept) {
byte[] cont = null;
try {