diff --git a/src/core/qhttpsocket.cpp b/src/core/qhttpsocket.cpp index d17de6e..4bf13c1 100644 --- a/src/core/qhttpsocket.cpp +++ b/src/core/qhttpsocket.cpp @@ -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() diff --git a/src/core/qhttpsocket.h b/src/core/qhttpsocket.h index 24a9fb3..8038ede 100644 --- a/src/core/qhttpsocket.h +++ b/src/core/qhttpsocket.h @@ -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: /** diff --git a/tests/core/TestQHttpSocket.cpp b/tests/core/TestQHttpSocket.cpp index 8d7710b..29ffb7b 100644 --- a/tests/core/TestQHttpSocket.cpp +++ b/tests/core/TestQHttpSocket.cpp @@ -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)