mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-23 06:42:05 +01:00
Fixes
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@7047 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
2db477145d
commit
749916aa8a
1 changed files with 2 additions and 25 deletions
|
@ -32,7 +32,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
|
||||||
|
|
||||||
// The time we give to the candidates check before we accept or decline the
|
// The time we give to the candidates check before we accept or decline the
|
||||||
// transport (in milliseconds)
|
// 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
|
// The session this nenotiator belongs to
|
||||||
private final JingleSession session;
|
private final JingleSession session;
|
||||||
|
@ -828,7 +828,6 @@ public abstract class TransportNegotiator extends JingleNegotiator {
|
||||||
int highest = -1;
|
int highest = -1;
|
||||||
TransportCandidate.Ice chose = null;
|
TransportCandidate.Ice chose = null;
|
||||||
for (TransportCandidate.Ice transportCandidate : cands) {
|
for (TransportCandidate.Ice transportCandidate : cands) {
|
||||||
System.out.println("Pref: " + transportCandidate.getPreference() + " :" + transportCandidate.getIp());
|
|
||||||
if (transportCandidate.getPreference() > highest) {
|
if (transportCandidate.getPreference() > highest) {
|
||||||
chose = transportCandidate;
|
chose = transportCandidate;
|
||||||
highest = transportCandidate.getPreference();
|
highest = transportCandidate.getPreference();
|
||||||
|
@ -844,29 +843,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
|
||||||
* Return true for ICE candidates.
|
* Return true for ICE candidates.
|
||||||
*/
|
*/
|
||||||
public boolean acceptableTransportCandidate(TransportCandidate tc, List<TransportCandidate> localCandidates) {
|
public boolean acceptableTransportCandidate(TransportCandidate tc, List<TransportCandidate> localCandidates) {
|
||||||
try {
|
return tc instanceof TransportCandidate.Ice;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue