Compare commits

...
1 Commits
Author SHA1 Message Date
Adam Honse 8e89d82c24 Check for local server before detecting devices from hardware 2020-06-27 17:32:01 -05:00
2 changed files with 27 additions and 2 deletions
+5 -1
View File
@@ -32,6 +32,9 @@ NetworkClient::NetworkClient(std::vector<RGBController *>& control) : controller
port_num = OPENRGB_SDK_PORT;
server_connected = false;
server_controller_count = 0;
ListenThread = NULL;
ConnectionThread = NULL;
}
void NetworkClient::ClientInfoChanged()
@@ -122,7 +125,8 @@ void NetworkClient::StopClient()
shutdown(client_sock, SD_RECEIVE);
closesocket(client_sock);
ListenThread->join();
if(ListenThread)
ListenThread->join();
ConnectionThread->join();
/*-------------------------------------------------*\
+22 -1
View File
@@ -6,6 +6,7 @@
* *
\******************************************************************************************/
#include "NetworkClient.h"
#include "NetworkServer.h"
#include "OpenRGB.h"
#include "ProfileManager.h"
@@ -17,6 +18,7 @@
#include "OpenRGBDialog2.h"
using namespace std::chrono_literals;
extern std::vector<i2c_smbus_interface*> busses;
extern std::vector<RGBController*> rgb_controllers;
@@ -37,7 +39,26 @@ int main(int argc, char* argv[])
ProfileManager profile_manager(rgb_controllers);
NetworkServer server(rgb_controllers);
DetectRGBControllers();
NetworkClient * client = new NetworkClient(rgb_controllers);
client->StartClient();
for(int timeout = 0; timeout < 10; timeout++)
{
if(client->GetOnline())
{
break;
}
std::this_thread::sleep_for(100ms);
}
if(!client->GetOnline())
{
client->StopClient();
delete client;
DetectRGBControllers();
}
profile_manager.LoadSizeFromProfile("sizes.ors");