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
*/
private String host;
protected String host;
/**
* 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.

View File

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