1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-12-22 10:37:59 +01:00

Only create the socket once

in XMPPTCPConnection.connectUsingConfiguration().
This commit is contained in:
Florian Schmaus 2016-01-10 18:24:01 +01:00
parent ac0c05be04
commit 7845f21465

View file

@ -545,11 +545,11 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
if (socketFactory == null) {
socketFactory = SocketFactory.getDefault();
}
socket = socketFactory.createSocket();
for (HostAddress hostAddress : hostAddresses) {
Iterator<InetAddress> inetAddresses = null;
String host = hostAddress.getFQDN();
int port = hostAddress.getPort();
socket = socketFactory.createSocket();
try {
inetAddresses = Arrays.asList(InetAddress.getAllByName(host)).iterator();
if (!inetAddresses.hasNext()) {