Browse Source

server: Fix regression in partial message handling

If a partial message is flushed into the input pipe for CMake Server,
the parser will try and parse it as a full message because of some bad
loop checks.  This was introduced accidentally in commit
v3.10.0-rc1~365^2~2 (server: Refactor to make the event loop owned by
server object, 2017-03-24).
vector-of-bool 8 years ago
parent
commit
01c42155cc
1 changed files with 2 additions and 3 deletions
  1. 2 3
      Source/cmConnection.cxx

+ 2 - 3
Source/cmConnection.cxx

@@ -97,11 +97,10 @@ void cmEventBasedConnection::ReadData(const std::string& data)
   this->RawReadBuffer += data;
   if (BufferStrategy) {
     std::string packet = BufferStrategy->BufferMessage(this->RawReadBuffer);
-    do {
+    while (!packet.empty()) {
       ProcessRequest(packet);
       packet = BufferStrategy->BufferMessage(this->RawReadBuffer);
-    } while (!packet.empty());
-
+    }
   } else {
     ProcessRequest(this->RawReadBuffer);
     this->RawReadBuffer.clear();