Switched to using aboutToClose() signal instead of disconnected() signal in QHttpSocket.
This commit is contained in:
@@ -85,10 +85,9 @@ void QHttpSocketPrivate::onDisconnected()
|
||||
// writing have completed - if so, an error has occurred
|
||||
if(readState != ReadFinished || writeState != WriteFinished) {
|
||||
Q_EMIT q->error();
|
||||
q->setOpenMode(QIODevice::NotOpen);
|
||||
}
|
||||
|
||||
Q_EMIT q->disconnected();
|
||||
q->close();
|
||||
}
|
||||
|
||||
bool QHttpSocketPrivate::readHeaders()
|
||||
|
||||
@@ -198,14 +198,6 @@ Q_SIGNALS:
|
||||
*/
|
||||
void headersParsed();
|
||||
|
||||
/**
|
||||
* @brief Indicate that the socket has disconnected
|
||||
*
|
||||
* This signal is emitted when the underlying socket is disconnected. Once
|
||||
* this occurs, it is safe to delete this device.
|
||||
*/
|
||||
void disconnected();
|
||||
|
||||
protected:
|
||||
|
||||
/**
|
||||
|
||||
@@ -115,7 +115,7 @@ void TestQHttpSocket::testSignals()
|
||||
QSignalSpy readyReadSpy(&server, SIGNAL(readyRead()));
|
||||
QSignalSpy readChannelFinishedSpy(&server, SIGNAL(readChannelFinished()));
|
||||
QSignalSpy bytesWrittenSpy(&server, SIGNAL(bytesWritten(qint64)));
|
||||
QSignalSpy disconnectedSpy(&server, SIGNAL(disconnected()));
|
||||
QSignalSpy aboutToCloseSpy(&server, SIGNAL(aboutToClose()));
|
||||
|
||||
client.sendHeaders(Method, Path, headers);
|
||||
|
||||
@@ -141,7 +141,7 @@ void TestQHttpSocket::testSignals()
|
||||
QCOMPARE(bytesWritten, Data.length());
|
||||
|
||||
server.close();
|
||||
QTRY_COMPARE(disconnectedSpy.count(), 1);
|
||||
QTRY_COMPARE(aboutToCloseSpy.count(), 1);
|
||||
}
|
||||
|
||||
QTEST_MAIN(TestQHttpSocket)
|
||||
|
||||
Reference in New Issue
Block a user