summaryrefslogtreecommitdiffstats
path: root/src/network/access
diff options
context:
space:
mode:
authorMarkus Goetz <Markus.Goetz@nokia.com>2011-03-16 12:06:08 (GMT)
committerMarkus Goetz <Markus.Goetz@nokia.com>2011-03-16 12:17:05 (GMT)
commit76f84c7a91751b4ddc5d9c4c59b6e5158d7ea998 (patch)
tree0e2fd04e628af65a8b0c3144a4612496a30904b4 /src/network/access
parente81c9e62f2052f2584d67827c88a0578fa2e3fab (diff)
downloadQt-76f84c7a91751b4ddc5d9c4c59b6e5158d7ea998.zip
Qt-76f84c7a91751b4ddc5d9c4c59b6e5158d7ea998.tar.gz
Qt-76f84c7a91751b4ddc5d9c4c59b6e5158d7ea998.tar.bz2
QTcpSocket: Fix for disconnect in Unbuffered mode.
We need to set the state properly after we have been disconnected. Also fix the HTTP layer, it needs to handle the disconnect when reading. Reviewed-by: Peter Hartmann
Diffstat (limited to 'src/network/access')
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp
index 2076d72..c735801 100644
--- a/src/network/access/qhttpnetworkconnectionchannel.cpp
+++ b/src/network/access/qhttpnetworkconnectionchannel.cpp
@@ -905,15 +905,18 @@ bool QHttpNetworkConnectionChannel::isSocketReading() const
//private slots
void QHttpNetworkConnectionChannel::_q_readyRead()
{
- // We got a readyRead but no bytes are available..
- // This happens for the Unbuffered QTcpSocket
- // Also check if socket is in ConnectedState since
- // this function may also be invoked via the event loop.
if (socket->state() == QAbstractSocket::ConnectedState && socket->bytesAvailable() == 0) {
+ // We got a readyRead but no bytes are available..
+ // This happens for the Unbuffered QTcpSocket
+ // Also check if socket is in ConnectedState since
+ // this function may also be invoked via the event loop.
char c;
qint64 ret = socket->peek(&c, 1);
if (ret < 0) {
- socket->disconnectFromHost();
+ _q_error(socket->error());
+ // We still need to handle the reply so it emits its signals etc.
+ if (reply)
+ _q_receiveReply();
return;
}
}