QLocalSocket/Win: eliminate checkReadyRead()
Change-Id: I459c0ba42d3e5b0da57884f5cdfc6f44a11600f7 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
This commit is contained in:
parent
3ccd626429
commit
0330036631
@ -224,28 +224,15 @@ qint64 QLocalSocket::readData(char *data, qint64 maxSize)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!d->pipeClosed) {
|
if (!d->pipeClosed) {
|
||||||
|
if (!d->actualReadBufferSize)
|
||||||
|
d->emitReadyReadTimer->stop();
|
||||||
if (!d->readSequenceStarted)
|
if (!d->readSequenceStarted)
|
||||||
d->startAsyncRead();
|
d->startAsyncRead();
|
||||||
d->checkReadyRead();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return readSoFar;
|
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
|
\internal
|
||||||
Reads data from the socket into the readbuffer
|
Reads data from the socket into the readbuffer
|
||||||
@ -333,6 +320,8 @@ bool QLocalSocketPrivate::completeAsyncRead()
|
|||||||
|
|
||||||
actualReadBufferSize += bytesRead;
|
actualReadBufferSize += bytesRead;
|
||||||
readBuffer.truncate(actualReadBufferSize);
|
readBuffer.truncate(actualReadBufferSize);
|
||||||
|
if (!emitReadyReadTimer->isActive())
|
||||||
|
emitReadyReadTimer->start();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -493,10 +482,8 @@ bool QLocalSocket::setSocketDescriptor(quintptr socketDescriptor,
|
|||||||
d->state = socketState;
|
d->state = socketState;
|
||||||
d->pipeClosed = false;
|
d->pipeClosed = false;
|
||||||
emit stateChanged(d->state);
|
emit stateChanged(d->state);
|
||||||
if (d->state == ConnectedState && openMode.testFlag(QIODevice::ReadOnly)) {
|
if (d->state == ConnectedState && openMode.testFlag(QIODevice::ReadOnly))
|
||||||
d->startAsyncRead();
|
d->startAsyncRead();
|
||||||
d->checkReadyRead();
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user