From 6cfa8a96b668aad7a4e5baa82e9786769fbd5cef Mon Sep 17 00:00:00 2001 From: Martchus Date: Thu, 1 Jul 2021 17:32:49 +0200 Subject: [PATCH] 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. --- connector/syncthingprocess.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/connector/syncthingprocess.cpp b/connector/syncthingprocess.cpp index bf2a9d8..4c1c84f 100644 --- a/connector/syncthingprocess.cpp +++ b/connector/syncthingprocess.cpp @@ -674,8 +674,7 @@ qint64 SyncthingProcess::readData(char *data, qint64 maxSize) return 0; } if (!m_process->bytesBuffered) { - bufferOutput(); - return 0; + return 0; // do *not* invoke bufferOutput() here; an async read operation is already pending } const auto bytesAvailable = m_process->bytesBuffered - m_process->bytesRead;