Do not buffer further output when `readData()` is called on empty buffer
See comment; otherwise calls to `readAll()` with no `bytesAvailable()` like done in the `syncthingctl` tests fail sporadically as async read operations are started concurrently.
This commit is contained in:
parent
695696bb00
commit
6cfa8a96b6
|
@ -674,8 +674,7 @@ qint64 SyncthingProcess::readData(char *data, qint64 maxSize)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (!m_process->bytesBuffered) {
|
if (!m_process->bytesBuffered) {
|
||||||
bufferOutput();
|
return 0; // do *not* invoke bufferOutput() here; an async read operation is already pending
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto bytesAvailable = m_process->bytesBuffered - m_process->bytesRead;
|
const auto bytesAvailable = m_process->bytesBuffered - m_process->bytesRead;
|
||||||
|
|
Loading…
Reference in New Issue