Stopped GUI from starting when only --server flag is set
This commit is contained in:
parent
36380457d6
commit
5c50cc2ca9
2 changed files with 27 additions and 17 deletions
15
cli.cpp
15
cli.cpp
|
|
@ -928,13 +928,6 @@ void ApplyOptions(DeviceOptions& options, std::vector<RGBController *> &rgb_cont
|
|||
}
|
||||
}
|
||||
|
||||
void WaitWhileServerOnline(NetworkServer* srv)
|
||||
{
|
||||
while (srv->GetOnline())
|
||||
{
|
||||
std::this_thread::sleep_for(1s);
|
||||
};
|
||||
}
|
||||
|
||||
unsigned int cli_pre_detection(int argc, char *argv[])
|
||||
{
|
||||
|
|
@ -1218,14 +1211,6 @@ unsigned int cli_post_detection(int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| If the server is online, keep running while it is online |
|
||||
\*---------------------------------------------------------*/
|
||||
if(ResourceManager::get()->GetServer()->GetOnline())
|
||||
{
|
||||
WaitWhileServerOnline(ResourceManager::get()->GetServer());
|
||||
}
|
||||
|
||||
std::this_thread::sleep_for(1s);
|
||||
|
||||
exit(0);
|
||||
|
|
|
|||
29
main.cpp
29
main.cpp
|
|
@ -76,6 +76,14 @@ void InitializeTimerResolutionThreadFunction()
|
|||
}
|
||||
#endif
|
||||
|
||||
void WaitWhileServerOnline(NetworkServer* srv)
|
||||
{
|
||||
while (srv->GetOnline())
|
||||
{
|
||||
std::this_thread::sleep_for(1s);
|
||||
};
|
||||
}
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* AttemptLocalConnection *
|
||||
|
|
@ -160,7 +168,10 @@ int main(int argc, char* argv[])
|
|||
| Process command line arguments before detection |
|
||||
\*---------------------------------------------------------*/
|
||||
unsigned int ret_flags = RET_FLAG_START_GUI;
|
||||
ret_flags |= cli_pre_detection(argc, argv);
|
||||
if (argc != 0)
|
||||
{
|
||||
ret_flags = cli_pre_detection(argc, argv);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Perform local connection and/or hardware detection if not |
|
||||
|
|
@ -239,6 +250,20 @@ int main(int argc, char* argv[])
|
|||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
if(ret_flags & RET_FLAG_START_SERVER)
|
||||
{
|
||||
if(!ResourceManager::get()->GetServer()->GetOnline())
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
WaitWhileServerOnline(ResourceManager::get()->GetServer());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue