From 5bb8258cd0c2a5600bc90ac9f7dc06b4746a16f9 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sat, 17 Oct 2015 13:54:09 +0300 Subject: [PATCH] Fix a bug in receiving data from the server QIODevice::readyRead is edge-triggered, not level-triggered. Thus it can't be relied on to be triggered again if only part of the available data is read. --- remote/source/xinemacontrol.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/remote/source/xinemacontrol.cpp b/remote/source/xinemacontrol.cpp index db349e7..f793e3b 100644 --- a/remote/source/xinemacontrol.cpp +++ b/remote/source/xinemacontrol.cpp @@ -64,12 +64,16 @@ void XinemaControl::send_request(const QString &req) void XinemaControl::data_available() { - char rbuf[1024]; - int len = socket.read(rbuf, sizeof(rbuf)); - if(len<0) - return; + while(socket.bytesAvailable()) + { + char rbuf[1024]; + int len = socket.read(rbuf, sizeof(rbuf)); + if(len<0) + break; + + buffer.append(rbuf, len); + } - buffer.append(rbuf, len); unsigned start = 0; while(1) { -- 2.45.2