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
1 changed files with 1 additions and 1 deletions

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()) {