From 563ff31fe32d39fdaff1216394ef1dc124ca21ea Mon Sep 17 00:00:00 2001 From: Adam Honse Date: Mon, 31 May 2021 23:44:33 -0500 Subject: [PATCH] Wait up to 5 seconds for the local server connection to retrieve all controllers before continuing, so that CLI mode has all controllers available for applying changes --- main.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/main.cpp b/main.cpp index 34e1e161..745e19cd 100644 --- a/main.cpp +++ b/main.cpp @@ -129,6 +129,19 @@ bool AttemptLocalConnection() ResourceManager::get()->RegisterNetworkClient(client); success = true; + + /*-----------------------------------------------------*\ + | Wait up to 5 seconds for the client connection to | + | retrieve all controllers | + \*-----------------------------------------------------*/ + for(int timeout = 0; timeout < 1000; timeout++) + { + if(client->GetOnline()) + { + break; + } + std::this_thread::sleep_for(5ms); + } } return success;