1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-12-26 20:47:58 +01:00
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@7047 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Thiago Camargo 2007-02-08 22:35:17 +00:00 committed by thiago
parent 2db477145d
commit 749916aa8a

View file

@ -32,7 +32,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
// The time we give to the candidates check before we accept or decline the
// transport (in milliseconds)
private final static int CANDIDATES_ACCEPT_PERIOD = 4000;
private final static int CANDIDATES_ACCEPT_PERIOD = 3000;
// The session this nenotiator belongs to
private final JingleSession session;
@ -828,7 +828,6 @@ public abstract class TransportNegotiator extends JingleNegotiator {
int highest = -1;
TransportCandidate.Ice chose = null;
for (TransportCandidate.Ice transportCandidate : cands) {
System.out.println("Pref: " + transportCandidate.getPreference() + " :" + transportCandidate.getIp());
if (transportCandidate.getPreference() > highest) {
chose = transportCandidate;
highest = transportCandidate.getPreference();
@ -844,29 +843,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
* Return true for ICE candidates.
*/
public boolean acceptableTransportCandidate(TransportCandidate tc, List<TransportCandidate> localCandidates) {
try {
TransportCandidate.Ice ice = (TransportCandidate.Ice) tc;
if (ice.getType().equals("relay")) return true;
for (TransportCandidate candidate : localCandidates) {
TransportCandidate.CandidateEcho echo = candidate.getCandidateEcho();
if (echo != null) {
if (echo.test(InetAddress.getByName(ice.getIp()), ice.getPort(), 500))
return true;
}
}
InetAddress.getByName(tc.getIp()).isReachable(3000);
DatagramSocket socket = new DatagramSocket(0);
socket.connect(InetAddress.getByName(tc.getIp()), tc.getPort());
return true;
}
catch (UnknownHostException e) {
e.printStackTrace();
}
catch (IOException e) {
e.printStackTrace();
}
return false;
return tc instanceof TransportCandidate.Ice;
}
}
}