1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-09-27 10:19:33 +02:00

Do not re-use the Socket after connect() failed

Fixes SMACK-724.
This commit is contained in:
Florian Schmaus 2016-06-19 12:06:21 +02:00
parent 1f87185ee8
commit fb55b9065f

View file

@ -579,6 +579,10 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
throw new UnknownHostException(host);
}
innerloop: while (inetAddresses.hasNext()) {
// Create a *new* Socket before every connection attempt, i.e. connect() call, since Sockets are not
// re-usable after a failed connection attempt. See also SMACK-724.
socket = socketFactory.createSocket();
final InetAddress inetAddress = inetAddresses.next();
final String inetAddressAndPort = inetAddress + " at port " + port;
LOGGER.finer("Trying to establish TCP connection to " + inetAddressAndPort);