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

STUN Failure Ignored in Negotiation

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@7339 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Thiago Camargo 2007-03-01 21:03:31 +00:00 committed by thiago
parent 2c0984815b
commit 18c14f70d4
3 changed files with 26 additions and 23 deletions

View file

@ -266,7 +266,7 @@ public class ICECandidate extends TransportCandidate implements Comparable {
if (echo != null) {
try {
InetAddress address = InetAddress.getByName(getIp());
if (echo.test(address, getPort())) isUsable = true;
if (echo.test(address, getPort(),2000)) isUsable = true;
if (isUsable) break;
}
catch (UnknownHostException e) {
@ -321,16 +321,14 @@ public class ICECandidate extends TransportCandidate implements Comparable {
if (other.getChannel() != null) {
return false;
}
}
else if (!getChannel().equals(other.getChannel())) {
} else if (!getChannel().equals(other.getChannel())) {
return false;
}
if (getId() == null) {
if (other.getId() != null) {
return false;
}
}
else if (!getId().equals(other.getId())) {
} else if (!getId().equals(other.getId())) {
return false;
}
if (getNetwork() != other.getNetwork()) {
@ -340,8 +338,7 @@ public class ICECandidate extends TransportCandidate implements Comparable {
if (other.getPassword() != null) {
return false;
}
}
else if (!getPassword().equals(other.password)) {
} else if (!getPassword().equals(other.password)) {
return false;
}
if (getPreference() != other.getPreference()) {
@ -351,16 +348,14 @@ public class ICECandidate extends TransportCandidate implements Comparable {
if (other.getProto() != null) {
return false;
}
}
else if (!getProto().equals(other.getProto())) {
} else if (!getProto().equals(other.getProto())) {
return false;
}
if (getUsername() == null) {
if (other.getUsername() != null) {
return false;
}
}
else if (!getUsername().equals(other.getUsername())) {
} else if (!getUsername().equals(other.getUsername())) {
return false;
}
return true;
@ -369,11 +364,9 @@ public class ICECandidate extends TransportCandidate implements Comparable {
public boolean isNull() {
if (super.isNull()) {
return true;
}
else if (getProto().isNull()) {
} else if (getProto().isNull()) {
return true;
}
else if (getChannel().isNull()) {
} else if (getChannel().isNull()) {
return true;
}
return false;
@ -392,8 +385,7 @@ public class ICECandidate extends TransportCandidate implements Comparable {
ICECandidate tc = (ICECandidate) arg;
if (getPreference() < tc.getPreference()) {
return -1;
}
else if (getPreference() > tc.getPreference()) {
} else if (getPreference() > tc.getPreference()) {
return 1;
}
}

View file

@ -124,18 +124,29 @@ public class ICEResolver extends TransportResolver {
if (RTPBridge.serviceAvailable(connection)) {
try {
String localIp = iceNegociator.getPublicCandidate().getBase().getAddress().getInetAddress().getHostAddress();
String localIp;
int network;
if (iceNegociator.getPublicCandidate() != null) {
localIp = iceNegociator.getPublicCandidate().getBase().getAddress().getInetAddress().getHostAddress();
network = iceNegociator.getPublicCandidate().getNetwork();
}
else {
localIp = iceNegociator.getSortedCandidates().get(0).getAddress().getInetAddress().getHostAddress();
network = iceNegociator.getSortedCandidates().get(0).getNetwork();
}
sid = Math.abs(random.nextLong());
RTPBridge rtpBridge = RTPBridge.getRTPBridge(connection, String.valueOf(sid));
TransportCandidate localCandidate = new ICECandidate(
rtpBridge.getIp(), 1, iceNegociator.getPublicCandidate().getNetwork(), "1", rtpBridge.getPortA(), "1", 0, "relay");
rtpBridge.getIp(), 1, network, "1", rtpBridge.getPortA(), "1", 0, "relay");
localCandidate.setLocalIp(localIp);
TransportCandidate remoteCandidate = new ICECandidate(
rtpBridge.getIp(), 1, iceNegociator.getPublicCandidate().getNetwork(), "1", rtpBridge.getPortB(), "1", 0, "relay");
rtpBridge.getIp(), 1, network, "1", rtpBridge.getPortB(), "1", 0, "relay");
remoteCandidate.setLocalIp(localIp);
localCandidate.setSymmetric(remoteCandidate);