diff options
author | Markus Goetz <Markus.Goetz@nokia.com> | 2009-08-27 13:43:17 (GMT) |
---|---|---|
committer | Markus Goetz <Markus.Goetz@nokia.com> | 2009-08-27 13:45:21 (GMT) |
commit | 2e21223f7ebef714191dedfe2c5ea31ee033f226 (patch) | |
tree | e1ad1d00f7aa4c08d21d0aedc379af75db31f692 /src/network/access/qhttpnetworkconnectionchannel.cpp | |
parent | 99823eb61a873c5ef0f6a3e1c213fb0d197c6de7 (diff) | |
download | Qt-2e21223f7ebef714191dedfe2c5ea31ee033f226.zip Qt-2e21223f7ebef714191dedfe2c5ea31ee033f226.tar.gz Qt-2e21223f7ebef714191dedfe2c5ea31ee033f226.tar.bz2 |
QNAM HTTP Code: Moved isSocket* functions to channel object
Cleaner code.
Reviewed-by: TrustMe
Diffstat (limited to 'src/network/access/qhttpnetworkconnectionchannel.cpp')
-rw-r--r-- | src/network/access/qhttpnetworkconnectionchannel.cpp | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index 9d78c55..05c6ebe 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -705,10 +705,30 @@ void QHttpNetworkConnectionChannel::closeAndResendCurrentRequest() QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection); } +bool QHttpNetworkConnectionChannel::isSocketBusy() const +{ + return (state & QHttpNetworkConnectionChannel::BusyState); +} + +bool QHttpNetworkConnectionChannel::isSocketWriting() const +{ + return (state & QHttpNetworkConnectionChannel::WritingState); +} + +bool QHttpNetworkConnectionChannel::isSocketWaiting() const +{ + return (state & QHttpNetworkConnectionChannel::WaitingState); +} + +bool QHttpNetworkConnectionChannel::isSocketReading() const +{ + return (state & QHttpNetworkConnectionChannel::ReadingState); +} + //private slots void QHttpNetworkConnectionChannel::_q_readyRead() { - if (connection->d_func()->isSocketWaiting(socket) || connection->d_func()->isSocketReading(socket)) { + if (isSocketWaiting() || isSocketReading()) { state = QHttpNetworkConnectionChannel::ReadingState; if (reply) receiveReply(); @@ -719,7 +739,7 @@ void QHttpNetworkConnectionChannel::_q_bytesWritten(qint64 bytes) { Q_UNUSED(bytes); // bytes have been written to the socket. write even more of them :) - if (connection->d_func()->isSocketWriting(socket)) + if (isSocketWriting()) sendRequest(); // otherwise we do nothing } @@ -727,7 +747,7 @@ void QHttpNetworkConnectionChannel::_q_bytesWritten(qint64 bytes) void QHttpNetworkConnectionChannel::_q_disconnected() { // read the available data before closing - if (connection->d_func()->isSocketWaiting(socket) || connection->d_func()->isSocketReading(socket)) { + if (isSocketWaiting() || isSocketReading()) { state = QHttpNetworkConnectionChannel::ReadingState; if (reply) receiveReply(); |