llgs tests: Use noack-mode for communication to avoid pr37294

llvm-svn: 331180
diff --git a/lldb/unittests/tools/lldb-server/tests/TestClient.cpp b/lldb/unittests/tools/lldb-server/tests/TestClient.cpp
index 9580358..2410b62 100644
--- a/lldb/unittests/tools/lldb-server/tests/TestClient.cpp
+++ b/lldb/unittests/tools/lldb-server/tests/TestClient.cpp
@@ -30,8 +30,6 @@
 TestClient::TestClient(std::unique_ptr<Connection> Conn) {
   SetConnection(Conn.release());
   SetPacketTimeout(std::chrono::seconds(10));
-
-  SendAck(); // Send this as a handshake.
 }
 
 TestClient::~TestClient() {
@@ -41,6 +39,18 @@
   EXPECT_THAT_ERROR(SendMessage("k"), Succeeded());
 }
 
+Error TestClient::initializeConnection() {
+  if (SendAck() == 0)
+    return make_error<StringError>("Sending initial ACK failed.",
+                                   inconvertibleErrorCode());
+
+  if (Error E = SendMessage("QStartNoAckMode"))
+    return E;
+
+  m_send_acks = false;
+  return Error::success();
+}
+
 Expected<std::unique_ptr<TestClient>> TestClient::launch(StringRef Log) {
   return launch(Log, {});
 }
@@ -97,6 +107,9 @@
   auto Conn = llvm::make_unique<ConnectionFileDescriptor>(accept_socket);
   auto Client = std::unique_ptr<TestClient>(new TestClient(std::move(Conn)));
 
+  if (Error E = Client->initializeConnection())
+    return std::move(E);
+
   if (!InferiorArgs.empty()) {
     if (Error E = Client->queryProcess())
       return std::move(E);