mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-16 12:12:06 +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:
parent
2c0984815b
commit
18c14f70d4
3 changed files with 26 additions and 23 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue