diff options
author | Joerg Bornemann <joerg.bornemann@nokia.com> | 2011-12-13 12:22:40 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-12-15 19:17:04 +0100 |
commit | 033003663172fa6fd2eb5be7bef9e12effd49de6 (patch) | |
tree | 651721ed8ae4ef39e1074b25a903f012f5d2db06 /src | |
parent | 3ccd6264296a3d5b1652964c758cbd1063c8c8f2 (diff) |
QLocalSocket/Win: eliminate checkReadyRead()
Change-Id: I459c0ba42d3e5b0da57884f5cdfc6f44a11600f7
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/network/socket/qlocalsocket_win.cpp | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/src/network/socket/qlocalsocket_win.cpp b/src/network/socket/qlocalsocket_win.cpp index cb4d50d658..9d7fb4ef42 100644 --- a/src/network/socket/qlocalsocket_win.cpp +++ b/src/network/socket/qlocalsocket_win.cpp @@ -224,9 +224,10 @@ qint64 QLocalSocket::readData(char *data, qint64 maxSize) } if (!d->pipeClosed) { + if (!d->actualReadBufferSize) + d->emitReadyReadTimer->stop(); if (!d->readSequenceStarted) d->startAsyncRead(); - d->checkReadyRead(); } return readSoFar; @@ -234,20 +235,6 @@ qint64 QLocalSocket::readData(char *data, qint64 maxSize) /*! \internal - Schedules or cancels a readyRead() emission depending on actual data availability - */ -void QLocalSocketPrivate::checkReadyRead() -{ - if (actualReadBufferSize > 0) { - if (!emitReadyReadTimer->isActive()) - emitReadyReadTimer->start(); - } else { - emitReadyReadTimer->stop(); - } -} - -/*! - \internal Reads data from the socket into the readbuffer */ void QLocalSocketPrivate::startAsyncRead() @@ -333,6 +320,8 @@ bool QLocalSocketPrivate::completeAsyncRead() actualReadBufferSize += bytesRead; readBuffer.truncate(actualReadBufferSize); + if (!emitReadyReadTimer->isActive()) + emitReadyReadTimer->start(); return true; } @@ -493,10 +482,8 @@ bool QLocalSocket::setSocketDescriptor(quintptr socketDescriptor, d->state = socketState; d->pipeClosed = false; emit stateChanged(d->state); - if (d->state == ConnectedState && openMode.testFlag(QIODevice::ReadOnly)) { + if (d->state == ConnectedState && openMode.testFlag(QIODevice::ReadOnly)) d->startAsyncRead(); - d->checkReadyRead(); - } return true; } |