QLocalSocket/Win: eliminate checkReadyRead()

Change-Id: I459c0ba42d3e5b0da57884f5cdfc6f44a11600f7
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
This commit is contained in:
Joerg Bornemann 2011-12-13 12:22:40 +01:00 committed by Qt by Nokia
parent 3ccd626429
commit 0330036631

View File

@ -224,28 +224,15 @@ 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;
}
/*!
\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
@ -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;
}