mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-23 06:42:05 +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
|
@ -98,8 +98,8 @@ public class ICECandidate extends TransportCandidate implements Comparable {
|
||||||
* @param type type as defined in ICE-12
|
* @param type type as defined in ICE-12
|
||||||
*/
|
*/
|
||||||
public ICECandidate(String ip, int generation, int network,
|
public ICECandidate(String ip, int generation, int network,
|
||||||
String password, int port, String username,
|
String password, int port, String username,
|
||||||
int preference, String type) {
|
int preference, String type) {
|
||||||
super(ip, port, generation);
|
super(ip, port, generation);
|
||||||
|
|
||||||
proto = Protocol.UDP;
|
proto = Protocol.UDP;
|
||||||
|
@ -266,7 +266,7 @@ public class ICECandidate extends TransportCandidate implements Comparable {
|
||||||
if (echo != null) {
|
if (echo != null) {
|
||||||
try {
|
try {
|
||||||
InetAddress address = InetAddress.getByName(getIp());
|
InetAddress address = InetAddress.getByName(getIp());
|
||||||
if (echo.test(address, getPort())) isUsable = true;
|
if (echo.test(address, getPort(),2000)) isUsable = true;
|
||||||
if (isUsable) break;
|
if (isUsable) break;
|
||||||
}
|
}
|
||||||
catch (UnknownHostException e) {
|
catch (UnknownHostException e) {
|
||||||
|
@ -321,16 +321,14 @@ public class ICECandidate extends TransportCandidate implements Comparable {
|
||||||
if (other.getChannel() != null) {
|
if (other.getChannel() != null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
} else if (!getChannel().equals(other.getChannel())) {
|
||||||
else if (!getChannel().equals(other.getChannel())) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (getId() == null) {
|
if (getId() == null) {
|
||||||
if (other.getId() != null) {
|
if (other.getId() != null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
} else if (!getId().equals(other.getId())) {
|
||||||
else if (!getId().equals(other.getId())) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (getNetwork() != other.getNetwork()) {
|
if (getNetwork() != other.getNetwork()) {
|
||||||
|
@ -340,8 +338,7 @@ public class ICECandidate extends TransportCandidate implements Comparable {
|
||||||
if (other.getPassword() != null) {
|
if (other.getPassword() != null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
} else if (!getPassword().equals(other.password)) {
|
||||||
else if (!getPassword().equals(other.password)) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (getPreference() != other.getPreference()) {
|
if (getPreference() != other.getPreference()) {
|
||||||
|
@ -351,16 +348,14 @@ public class ICECandidate extends TransportCandidate implements Comparable {
|
||||||
if (other.getProto() != null) {
|
if (other.getProto() != null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
} else if (!getProto().equals(other.getProto())) {
|
||||||
else if (!getProto().equals(other.getProto())) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (getUsername() == null) {
|
if (getUsername() == null) {
|
||||||
if (other.getUsername() != null) {
|
if (other.getUsername() != null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
} else if (!getUsername().equals(other.getUsername())) {
|
||||||
else if (!getUsername().equals(other.getUsername())) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -369,11 +364,9 @@ public class ICECandidate extends TransportCandidate implements Comparable {
|
||||||
public boolean isNull() {
|
public boolean isNull() {
|
||||||
if (super.isNull()) {
|
if (super.isNull()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
} else if (getProto().isNull()) {
|
||||||
else if (getProto().isNull()) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
} else if (getChannel().isNull()) {
|
||||||
else if (getChannel().isNull()) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -392,8 +385,7 @@ public class ICECandidate extends TransportCandidate implements Comparable {
|
||||||
ICECandidate tc = (ICECandidate) arg;
|
ICECandidate tc = (ICECandidate) arg;
|
||||||
if (getPreference() < tc.getPreference()) {
|
if (getPreference() < tc.getPreference()) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
} else if (getPreference() > tc.getPreference()) {
|
||||||
else if (getPreference() > tc.getPreference()) {
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,18 +124,29 @@ public class ICEResolver extends TransportResolver {
|
||||||
|
|
||||||
if (RTPBridge.serviceAvailable(connection)) {
|
if (RTPBridge.serviceAvailable(connection)) {
|
||||||
try {
|
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());
|
sid = Math.abs(random.nextLong());
|
||||||
|
|
||||||
RTPBridge rtpBridge = RTPBridge.getRTPBridge(connection, String.valueOf(sid));
|
RTPBridge rtpBridge = RTPBridge.getRTPBridge(connection, String.valueOf(sid));
|
||||||
|
|
||||||
TransportCandidate localCandidate = new ICECandidate(
|
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);
|
localCandidate.setLocalIp(localIp);
|
||||||
|
|
||||||
TransportCandidate remoteCandidate = new ICECandidate(
|
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);
|
remoteCandidate.setLocalIp(localIp);
|
||||||
|
|
||||||
localCandidate.setSymmetric(remoteCandidate);
|
localCandidate.setSymmetric(remoteCandidate);
|
||||||
|
|
|
@ -28,7 +28,7 @@ import org.jivesoftware.smackx.jingle.listeners.CreatedJingleSessionListener;
|
||||||
*/
|
*/
|
||||||
public class ICETransportManager extends JingleTransportManager implements JingleSessionListener, CreatedJingleSessionListener {
|
public class ICETransportManager extends JingleTransportManager implements JingleSessionListener, CreatedJingleSessionListener {
|
||||||
|
|
||||||
ICEResolver iceResolver = null;
|
ICEResolver iceResolver = null;
|
||||||
|
|
||||||
public ICETransportManager(XMPPConnection xmppConnection, String server, int port) {
|
public ICETransportManager(XMPPConnection xmppConnection, String server, int port) {
|
||||||
iceResolver = new ICEResolver(xmppConnection, server, port);
|
iceResolver = new ICEResolver(xmppConnection, server, port);
|
||||||
|
|
Loading…
Reference in a new issue