fixed start/stop of webinterface from GUI

This commit is contained in:
csoler 2019-11-13 21:06:20 +01:00
parent d19d1685de
commit 9007d266a8
No known key found for this signature in database
GPG key ID: 7BCA522266C0804C
6 changed files with 43 additions and 17 deletions

View file

@ -452,7 +452,22 @@ void JsonApiServer::setNewAccessRequestCallback(
const std::function<bool (const std::string&)>& callback )
{ mNewAccessRequestCallback = callback; }
void JsonApiServer::shutdown() { mService.stop(); }
void JsonApiServer::shutdown()
{
mService.stop();
RsThread::ask_for_stop();
std::cerr << "Stopping JsonApiServer" ;
while(isRunning())
{
sleep(1);
std::cerr << "." ;
std::cerr.flush();
}
std::cerr << std::endl;
}
bool JsonApiServer::requestNewTokenAutorization(const std::string& token)
{

View file

@ -144,7 +144,7 @@ public:
try
{
std::cerr << "Starting web service on port " << std::dec << _listening_port << std::endl;
std::cerr << "(II) Starting web service on port " << std::dec << _listening_port << std::endl;
_service->start( settings );
}
catch(std::exception& e)
@ -153,7 +153,7 @@ public:
return;
}
std::cerr << "(II) Shutting down webui service." << std::endl;
std::cerr << "(II) webui service stopped." << std::endl;
}
void stop()
{
@ -162,7 +162,10 @@ public:
RsThread::ask_for_stop();
while(isRunning())
sleep(1);
{
std::cerr << "(II) shutting down webui service." << std::endl;
rstime::rs_usleep(1000*1000);
}
}
void setListeningPort(uint16_t p) { _listening_port = p ; }