1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-25 21:42:07 +01:00

Fix XMPPTCPConnection to set 'host' and 'port'

Fixes SMACK-585
This commit is contained in:
Florian Schmaus 2014-07-21 16:37:31 +02:00
parent b117d3a918
commit fe258fe110
2 changed files with 5 additions and 6 deletions

View file

@ -202,12 +202,12 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
/** /**
* The used host to establish the connection to * The used host to establish the connection to
*/ */
private String host; protected String host;
/** /**
* The used port to establish the connection to * The used port to establish the connection to
*/ */
private int port; protected int port;
/** /**
* Set to true if the server requires the connection to be binded in order to continue. * Set to true if the server requires the connection to be binded in order to continue.

View file

@ -416,7 +416,6 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
} }
private void connectUsingConfiguration(ConnectionConfiguration config) throws SmackException, IOException { private void connectUsingConfiguration(ConnectionConfiguration config) throws SmackException, IOException {
Exception exception = null;
try { try {
maybeResolveDns(); maybeResolveDns();
} }
@ -426,7 +425,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
Iterator<HostAddress> it = config.getHostAddresses().iterator(); Iterator<HostAddress> it = config.getHostAddresses().iterator();
List<HostAddress> failedAddresses = new LinkedList<HostAddress>(); List<HostAddress> failedAddresses = new LinkedList<HostAddress>();
while (it.hasNext()) { while (it.hasNext()) {
exception = null; Exception exception = null;
HostAddress hostAddress = it.next(); HostAddress hostAddress = it.next();
String host = hostAddress.getFQDN(); String host = hostAddress.getFQDN();
int port = hostAddress.getPort(); int port = hostAddress.getPort();
@ -442,8 +441,8 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
} }
if (exception == null) { if (exception == null) {
// We found a host to connect to, break here // We found a host to connect to, break here
host = hostAddress.getFQDN(); this.host = host;
port = hostAddress.getPort(); this.port = port;
break; break;
} }
hostAddress.setException(exception); hostAddress.setException(exception);