Switched to using aboutToClose() signal instead of disconnected() signal in QHttpSocket.

This commit is contained in:
Nathan Osman
2015-06-23 19:00:31 -07:00
parent 5fc8234ab8
commit 43c33e6e03
3 changed files with 3 additions and 12 deletions

View File

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

View File

@@ -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:
/**

View File

@@ -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)