1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-23 06:42:05 +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) { public void testFinished(TestResult testResult, TransportCandidate candidate) {
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());
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(); 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

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()); //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()); ByteBuffer buf = ByteBuffer.wrap(packet.getData());
byte[] content = new byte[packet.getLength()]; byte[] content = new byte[packet.getLength()];
@ -714,8 +714,8 @@ public abstract class TransportCandidate {
packet.setData(content); packet.setData(content);
for (DatagramListener listener : listeners) { for (DatagramListener listener : listeners) {
reply = listener.datagramReceived(packet); accept = listener.datagramReceived(packet);
if (reply) break; if (accept) break;
} }
long delay = 200 / tries / 2; long delay = 200 / tries / 2;
@ -728,7 +728,7 @@ public abstract class TransportCandidate {
String ip = address[0]; String ip = address[0];
String port = address[1]; String port = address[1];
if (pass.equals(candidate.getPassword())) { if (pass.equals(candidate.getPassword()) && !accept) {
byte[] cont = null; byte[] cont = null;
try { try {