fix Warning
This commit is contained in:
1 parent
593c221d23
commit
8345470273
316 files changed
+1246
-929
No files matched your search
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
|
||||
#include "group.h"
|
||||
#include <utility>
|
||||
|
||||
#include <QtCore/QDateTime>
|
||||
#include <QtCore/QThread>
|
||||
@@ -52,7 +53,7 @@ Group::Group(const std::shared_ptr<DdsHandler> &ddsHandler,
|
||||
Group::~Group()
|
||||
{
|
||||
setRunningState(Core::RunningState::StoppedNormally);
|
||||
for (ServiceProcess *serviceProc :qAsConst(m_serviceProcs))
|
||||
for (ServiceProcess *serviceProc :std::as_const(m_serviceProcs))
|
||||
m_ddsHandler->dts()->removeServiceInformationByKey(serviceProc->serviceProcessId());
|
||||
qDeleteAll(m_serviceProcs); // in Service they are removed via ServiceProcess::destroyed signal
|
||||
m_ddsHandler->dts()->removeGroupInformationByKey(m_groupId);
|
||||
@@ -60,7 +61,7 @@ Group::~Group()
|
||||
|
||||
void Group::init()
|
||||
{
|
||||
for (int serviceId : qAsConst(m_scheme->services))
|
||||
for (int serviceId : std::as_const(m_scheme->services))
|
||||
{
|
||||
if (m_serviceProcs.contains(serviceId))
|
||||
continue;
|
||||
@@ -92,11 +93,11 @@ bool Group::setRunningState(Core::RunningState newState)
|
||||
case Core::RunningState::Starting:
|
||||
// make sure all services are there
|
||||
init();
|
||||
for (ServiceProcess *serviceProc : qAsConst(m_serviceProcs))
|
||||
for (ServiceProcess *serviceProc : std::as_const(m_serviceProcs))
|
||||
serviceProc->start();
|
||||
return true;
|
||||
case Core::RunningState::StoppedNormally:
|
||||
for (ServiceProcess *serviceProc : qAsConst(m_serviceProcs))
|
||||
for (ServiceProcess *serviceProc : std::as_const(m_serviceProcs))
|
||||
serviceProc->terminate();
|
||||
return true;
|
||||
default:
|
||||
@@ -118,7 +119,7 @@ void Group::startCore()
|
||||
init();
|
||||
|
||||
// ExerciseManagement must be started ...
|
||||
for (ServiceProcess *proc : qAsConst(m_serviceProcs))
|
||||
for (ServiceProcess *proc : std::as_const(m_serviceProcs))
|
||||
{
|
||||
if (proc->serviceName() == QLatin1String("ExerciseManagement"))
|
||||
{
|
||||
@@ -160,7 +161,7 @@ void Group::start()
|
||||
// make sure all services are there
|
||||
init();
|
||||
// get list of prio
|
||||
for (ServiceProcess *proc : qAsConst(m_serviceProcs))
|
||||
for (ServiceProcess *proc : std::as_const(m_serviceProcs))
|
||||
{
|
||||
if ( !prioList.contains(proc->prio()))
|
||||
{
|
||||
@@ -176,7 +177,7 @@ void Group::start()
|
||||
// m_actPrio = getNextPrio(prioList);
|
||||
//}
|
||||
|
||||
for (ServiceProcess *proc : qAsConst(m_serviceProcs))
|
||||
for (ServiceProcess *proc : std::as_const(m_serviceProcs))
|
||||
{
|
||||
if ( m_actPrio == proc->prio())
|
||||
{
|
||||
@@ -198,7 +199,7 @@ void Group::start()
|
||||
|
||||
void Group::stop()
|
||||
{
|
||||
for (ServiceProcess *proc : qAsConst(m_serviceProcs))
|
||||
for (ServiceProcess *proc : std::as_const(m_serviceProcs))
|
||||
{
|
||||
if (proc->state() != QProcess::NotRunning)
|
||||
proc->stopFromRequest();
|
||||
@@ -209,7 +210,7 @@ void Group::restart()
|
||||
{
|
||||
// make sure all services are there
|
||||
init();
|
||||
for (ServiceProcess *proc : qAsConst(m_serviceProcs))
|
||||
for (ServiceProcess *proc : std::as_const(m_serviceProcs))
|
||||
proc->restart();
|
||||
}
|
||||
|
||||
@@ -269,7 +270,7 @@ void Group::onNewServiceInfo()
|
||||
m_elapsedTimer.start();
|
||||
std::vector<int32_t> serviceIds;
|
||||
serviceIds.reserve(m_serviceProcs.size());
|
||||
for (ServiceProcess *proc : qAsConst(m_serviceProcs))
|
||||
for (ServiceProcess *proc : std::as_const(m_serviceProcs))
|
||||
serviceIds.push_back(proc->serviceProcessId());
|
||||
|
||||
GroupInformation info(m_groupId,
|
||||
@@ -297,7 +298,7 @@ void Group::onCompleteCoreTick()
|
||||
ServiceProcess *exmProc = nullptr;
|
||||
|
||||
// get EXM proc
|
||||
for (ServiceProcess *proc : qAsConst(m_serviceProcs))
|
||||
for (ServiceProcess *proc : std::as_const(m_serviceProcs))
|
||||
{
|
||||
if (proc->serviceName() == QLatin1String("ExerciseManagement"))
|
||||
{
|
||||
@@ -315,7 +316,7 @@ void Group::onCompleteCoreTick()
|
||||
if (exmProc->runningState() == Core::RunningState::Running)
|
||||
{
|
||||
// get list of prio
|
||||
for (ServiceProcess *proc : qAsConst(m_serviceProcs))
|
||||
for (ServiceProcess *proc : std::as_const(m_serviceProcs))
|
||||
{
|
||||
if ( !prioList.contains(proc->prio()))
|
||||
{
|
||||
@@ -327,7 +328,7 @@ void Group::onCompleteCoreTick()
|
||||
}
|
||||
|
||||
// start rest of group core
|
||||
for (ServiceProcess *proc : qAsConst(m_serviceProcs))
|
||||
for (ServiceProcess *proc : std::as_const(m_serviceProcs))
|
||||
{
|
||||
if (proc->state() != QProcess::Running && proc->prio() == m_actPrio)
|
||||
{
|
||||
@@ -352,7 +353,7 @@ void Group::onCompleteCoreTick()
|
||||
|
||||
ServiceProcess *Group::procFromPid(qint64 pid)
|
||||
{
|
||||
for (ServiceProcess *proc :qAsConst(m_serviceProcs))
|
||||
for (ServiceProcess *proc :std::as_const(m_serviceProcs))
|
||||
{
|
||||
if (proc->processId() == pid)
|
||||
return proc;
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
|
||||
#include "group_handler.h"
|
||||
#include <utility>
|
||||
#include "group.h"
|
||||
#include "heartbeat_listener.h"
|
||||
#include "service_donator.h"
|
||||
@@ -65,7 +66,7 @@ QVector<Group *> GroupHandler::groups() const
|
||||
|
||||
GroupScheme *GroupHandler::groupSchemeFromType(Core::ServiceGroupType type)
|
||||
{
|
||||
for (GroupScheme *scheme : qAsConst(m_groupSchemes))
|
||||
for (GroupScheme *scheme : std::as_const(m_groupSchemes))
|
||||
{
|
||||
if (scheme->groupType == type)
|
||||
return scheme;
|
||||
@@ -240,7 +241,7 @@ Core::FunctionReplyObject GroupHandler::onStopAllForExercise(int domainId, int e
|
||||
|
||||
int cntStopped = 0;
|
||||
int cntAlive = 0;
|
||||
for (Group *group : qAsConst(m_groups))
|
||||
for (Group *group : std::as_const(m_groups))
|
||||
{
|
||||
if (group->exercisePartitionId() == exercisePartitionId &&
|
||||
group->domainId() == domainId)
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
|
||||
#include "licence_handler.h"
|
||||
#include <utility>
|
||||
#include "dds_handler.h"
|
||||
#include <QtCore/QFile>
|
||||
#include <LtsLicence/aes_crypt.h>
|
||||
@@ -28,7 +29,7 @@ LicenceHandler::LicenceHandler(const std::shared_ptr<DdsHandler> &ddsHandler, co
|
||||
|
||||
LicenceHandler::~LicenceHandler()
|
||||
{
|
||||
for (const LtsLicence::Licence &info : qAsConst(m_licenceVec))
|
||||
for (const LtsLicence::Licence &info : std::as_const(m_licenceVec))
|
||||
m_ddsHandler->dts()->removeLicenceInformationByKey(info.name.toStdString());
|
||||
} // end of dtor()
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -302,7 +303,7 @@ QString LicenceHandler::dumpLicenceInformation(const LtsLicence::Licence &licenc
|
||||
|
||||
void LicenceHandler::publishAllData()
|
||||
{
|
||||
for (const LtsLicence::Licence &info : qAsConst(m_licenceVec))
|
||||
for (const LtsLicence::Licence &info : std::as_const(m_licenceVec))
|
||||
publishData(info);
|
||||
} // end of publishAllData()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@@ -54,9 +54,12 @@ static void daemonize()
|
||||
exit(EXIT_FAILURE);
|
||||
|
||||
/* Redirect standard files to /dev/null */
|
||||
freopen("/dev/null", "r", stdin);
|
||||
freopen("/dev/null", "w", stdout);
|
||||
freopen("/dev/null", "w", stderr);
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunused-result"
|
||||
(void)freopen("/dev/null", "r", stdin);
|
||||
(void)freopen("/dev/null", "w", stdout);
|
||||
(void)freopen("/dev/null", "w", stderr);
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
|
||||
#include "service.h"
|
||||
#include <utility>
|
||||
|
||||
#include <QtCore/QProcess>
|
||||
|
||||
@@ -83,7 +84,7 @@ ServiceManagement::ServiceProcess *ServiceManagement::Service::toServiceProcess(
|
||||
|
||||
ServiceManagement::ServiceProcess *ServiceManagement::Service::procFromPid(qint64 pid)
|
||||
{
|
||||
for (ServiceProcess *currentProc : qAsConst(m_procs))
|
||||
for (ServiceProcess *currentProc : std::as_const(m_procs))
|
||||
{
|
||||
if (currentProc->usablePid() == pid)
|
||||
return currentProc;
|
||||
@@ -93,7 +94,7 @@ ServiceManagement::ServiceProcess *ServiceManagement::Service::procFromPid(qint6
|
||||
|
||||
ServiceManagement::ServiceProcess *ServiceManagement::Service::procFromServiceProcId(int32_t id)
|
||||
{
|
||||
for (ServiceProcess *currentProc : qAsConst(m_procs))
|
||||
for (ServiceProcess *currentProc : std::as_const(m_procs))
|
||||
{
|
||||
if (currentProc->serviceProcessId() == id)
|
||||
return currentProc;
|
||||
@@ -103,13 +104,13 @@ ServiceManagement::ServiceProcess *ServiceManagement::Service::procFromServicePr
|
||||
|
||||
void ServiceManagement::Service::stopAllProcs()
|
||||
{
|
||||
for (ServiceProcess *currentProc : qAsConst(m_procs))
|
||||
for (ServiceProcess *currentProc : std::as_const(m_procs))
|
||||
currentProc->terminate();
|
||||
}
|
||||
|
||||
void ServiceManagement::Service::waitForStopped()
|
||||
{
|
||||
for (ServiceProcess *currentProc : qAsConst(m_procs))
|
||||
for (ServiceProcess *currentProc : std::as_const(m_procs))
|
||||
currentProc->waitForFinished(5000);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
|
||||
#include "service_handler.h"
|
||||
#include <utility>
|
||||
|
||||
#include <QtCore/QCoreApplication>
|
||||
#include <QtCore/QDateTime>
|
||||
@@ -111,9 +112,9 @@ void ServiceManagement::ServiceHandler::stopAllServices()
|
||||
INFO_LOG(m_logger) << "Stopping all Services ...";
|
||||
|
||||
// shutdown async
|
||||
for (Service *service : qAsConst(m_services))
|
||||
for (Service *service : std::as_const(m_services))
|
||||
service->stopAllProcs();
|
||||
for (Service *service : qAsConst(m_services))
|
||||
for (Service *service : std::as_const(m_services))
|
||||
service->waitForStopped();
|
||||
|
||||
INFO_LOG(m_logger) << "... all Services stopped :)";
|
||||
@@ -147,9 +148,9 @@ void ServiceManagement::ServiceHandler::onNewServiceInfoFromDds(const Core::Curr
|
||||
if (proc == nullptr)
|
||||
{
|
||||
bool found = false;
|
||||
for (Service *currentService : qAsConst(m_services))
|
||||
for (Service *currentService : std::as_const(m_services))
|
||||
{
|
||||
for (ServiceProcess *currentProc : qAsConst(currentService->allProcs()))
|
||||
for (ServiceProcess *currentProc : std::as_const(currentService->allProcs()))
|
||||
{
|
||||
if (currentProc->remotePid() == data.pid)
|
||||
{
|
||||
@@ -182,7 +183,7 @@ void ServiceManagement::ServiceHandler::onNewServiceInfoFromDds(const Core::Curr
|
||||
|
||||
ServiceManagement::Service *ServiceManagement::ServiceHandler::serviceFromId(int id)
|
||||
{
|
||||
for (Service *service : qAsConst(m_services))
|
||||
for (Service *service : std::as_const(m_services))
|
||||
{
|
||||
if (service->id() == id)
|
||||
return service;
|
||||
@@ -192,7 +193,7 @@ ServiceManagement::Service *ServiceManagement::ServiceHandler::serviceFromId(int
|
||||
|
||||
ServiceManagement::ServiceProcess *ServiceManagement::ServiceHandler::serviceProcessFromPid(qint64 pid)
|
||||
{
|
||||
for (Service *service : qAsConst(m_services))
|
||||
for (Service *service : std::as_const(m_services))
|
||||
{
|
||||
ServiceProcess *result = service->procFromPid(pid);
|
||||
if (result)
|
||||
@@ -203,7 +204,7 @@ ServiceManagement::ServiceProcess *ServiceManagement::ServiceHandler::servicePro
|
||||
|
||||
ServiceManagement::ServiceProcess *ServiceManagement::ServiceHandler::serviceProcessFromServiceProcId(int32_t id)
|
||||
{
|
||||
for (Service *service : qAsConst(m_services))
|
||||
for (Service *service : std::as_const(m_services))
|
||||
{
|
||||
ServiceProcess *result = service->procFromServiceProcId(id);
|
||||
if (result)
|
||||
@@ -218,9 +219,9 @@ void ServiceManagement::ServiceHandler::onHeartBeatObserverTimerTimeout()
|
||||
const qint64 minHeartbeatAge = tNow - HEARTBEAT_OBSERVER_INTERVAL;
|
||||
const qint64 minHeartbeatAgeStartup = tNow - HEARTBEAT_OBSERVER_INTERVAL * 6;
|
||||
|
||||
for (Service *currentService : qAsConst(m_services))
|
||||
for (Service *currentService : std::as_const(m_services))
|
||||
{
|
||||
for (ServiceProcess *currentProc : qAsConst(currentService->allProcs()))
|
||||
for (ServiceProcess *currentProc : std::as_const(currentService->allProcs()))
|
||||
{
|
||||
// dev mode for this proc -> we're not repsonsible for
|
||||
if (currentProc->devMode())
|
||||
|
||||
@@ -288,7 +288,8 @@ void ServiceManagement::ServiceProcess::killallRemote()
|
||||
sh.startDetached();
|
||||
#else
|
||||
sh.start();
|
||||
#endif DEBUG_LOG(m_logger) << "kill remote " << sh.program() << " " << args.join(QLatin1Char(' '));
|
||||
#endif
|
||||
DEBUG_LOG(m_logger) << "kill remote " << sh.program() << " " << args.join(QLatin1Char(' '));
|
||||
}
|
||||
|
||||
void ServiceManagement::ServiceProcess::restart()
|
||||
|
||||
Reference in new issue
Block a user