Fix cmake not adding Werror on clang, and _lots_ of warnings (#4963)
* Fix cmake not adding Werror on clang, and _lots_ of warnings * WIP: Build fixes * Cannot make intermediate blockhandler instance * Tiger's changes * Fix BitIndex check * Handle invalid NextState values in cMultiVersionProtocol Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
This commit is contained in:
22
src/Root.cpp
22
src/Root.cpp
@@ -45,10 +45,8 @@
|
||||
|
||||
|
||||
|
||||
extern bool g_RunAsService;
|
||||
decltype(cRoot::s_Root) cRoot::s_Root;
|
||||
decltype(cRoot::s_NextState) cRoot::s_NextState;
|
||||
decltype(cRoot::s_StopEvent) cRoot::s_StopEvent;
|
||||
extern bool g_RunAsService;
|
||||
cRoot * cRoot::s_Root = nullptr;
|
||||
|
||||
|
||||
|
||||
@@ -194,7 +192,7 @@ bool cRoot::Run(cSettingsRepositoryInterface & a_OverridesRepo)
|
||||
m_StartTime = std::chrono::steady_clock::now();
|
||||
|
||||
HandleInput();
|
||||
s_StopEvent.Wait();
|
||||
m_StopEvent.Wait();
|
||||
|
||||
// Stop the server:
|
||||
m_WebAdmin->Stop();
|
||||
@@ -233,7 +231,7 @@ bool cRoot::Run(cSettingsRepositoryInterface & a_OverridesRepo)
|
||||
LOG("Shutdown successful!");
|
||||
LOG("--- Stopped Log ---");
|
||||
|
||||
return s_NextState == NextState::Restart;
|
||||
return m_NextState == NextState::Restart;
|
||||
}
|
||||
|
||||
|
||||
@@ -957,7 +955,7 @@ void cRoot::HandleInput()
|
||||
cLogCommandOutputCallback Output;
|
||||
AString Command;
|
||||
|
||||
while (s_NextState == NextState::Run)
|
||||
while (m_NextState == NextState::Run)
|
||||
{
|
||||
#ifndef _WIN32
|
||||
timeval Timeout{ 0, 0 };
|
||||
@@ -980,7 +978,7 @@ void cRoot::HandleInput()
|
||||
return;
|
||||
}
|
||||
|
||||
if (s_NextState != NextState::Run)
|
||||
if (m_NextState != NextState::Run)
|
||||
{
|
||||
// Already shutting down, can't execute commands
|
||||
break;
|
||||
@@ -1001,7 +999,7 @@ void cRoot::HandleInput()
|
||||
void cRoot::TransitionNextState(NextState a_NextState)
|
||||
{
|
||||
{
|
||||
auto Current = s_NextState.load();
|
||||
auto Current = m_NextState.load();
|
||||
do
|
||||
{
|
||||
// Stopping is final, so stops override restarts:
|
||||
@@ -1010,15 +1008,15 @@ void cRoot::TransitionNextState(NextState a_NextState)
|
||||
return;
|
||||
}
|
||||
}
|
||||
while (!s_NextState.compare_exchange_strong(Current, a_NextState));
|
||||
while (!m_NextState.compare_exchange_strong(Current, a_NextState));
|
||||
}
|
||||
|
||||
if (s_NextState == NextState::Run)
|
||||
if (m_NextState == NextState::Run)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
s_StopEvent.Set();
|
||||
m_StopEvent.Set();
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
|
||||
Reference in New Issue
Block a user