only attempt to close socket if its open

On socket errors we always close the socket per amqp specification,
however there is no need to do so if the connection has already been
forcibly closed from the server side. This causes recursive loops
when using SSL connections
This commit is contained in:
Matt Broadstone 2015-03-05 14:20:30 -05:00
parent 6cc9ee7457
commit 9b3288ca9d
1 changed files with 7 additions and 2 deletions

View File

@ -193,8 +193,13 @@ void QAmqpClientPrivate::_q_socketError(QAbstractSocket::SocketError error)
}
// per spec, on any error we need to close the socket immediately
// and send no more data;
socket->close();
// and send no more data. only try to send the close message if we
// are actively connected
if (socket->state() == QAbstractSocket::ConnectedState ||
socket->state() == QAbstractSocket::ConnectingState) {
socket->abort();
}
errorString = socket->errorString();
if (autoReconnect) {