[impl] isRunning call for Http server to check whether it is still running

[impl] Ability to update system files of the update program
This commit is contained in:
Peter Sykora 2018-03-31 14:49:36 +02:00
parent 4eac37cfae
commit 3e3de79dca
3 changed files with 13 additions and 0 deletions

View File

@ -746,6 +746,7 @@ public:
public: public:
void run() void run()
{ {
std::lock_guard<std::mutex> scopeGuard(m_mutex);
// Create and launch a listening port // Create and launch a listening port
std::make_shared<listener>( std::make_shared<listener>(
m_ioc, m_ioc,
@ -766,6 +767,7 @@ public:
void shutdown() void shutdown()
{ {
std::lock_guard<std::mutex> scopeGuard(m_lock);
m_ioc.stop(); m_ioc.stop();
for (auto& t : m_threads) for (auto& t : m_threads)
{ {
@ -774,12 +776,18 @@ public:
m_threads.clear(); m_threads.clear();
} }
bool isRunning() const
{
return m_ioc.stopped();
}
void clearCache() void clearCache()
{ {
m_etagCache.clear(); m_etagCache.clear();
} }
private: private:
mutable std::mutex m_lock;
int m_maxThreads; int m_maxThreads;
std::string m_docRoot; std::string m_docRoot;
etag_cache m_etagCache; etag_cache m_etagCache;
@ -813,3 +821,7 @@ void CCServer::run()
m_impl->run(); m_impl->run();
} }
bool CCServer::isRunning() const
{
return m_impl->isRunning();
}

View File

@ -16,6 +16,7 @@ public:
public: public:
void run(); void run();
bool isRunning() const;
void shutdown(); void shutdown();
void clearCache(); void clearCache();

Binary file not shown.