mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-04-09 14:33:28 +02:00
2019-09-09 Fred Gleason <fredg@paravelsystems.com>
* Added a 'ServiceTimeout=' directive to the '[Tuning]' section of rd.conf(5).
This commit is contained in:
parent
7b772ca101
commit
c057441daa
@ -19093,3 +19093,6 @@
|
||||
* Fixed a regression in rdairplay(1) and rdvairplayd(8) that
|
||||
caused hard timed events with the 'Start Immediately' attribute
|
||||
to fail to start if one or more other events were playing.
|
||||
2019-09-09 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Added a 'ServiceTimeout=' directive to the '[Tuning]' section
|
||||
of rd.conf(5).
|
||||
|
@ -125,7 +125,12 @@ ChannelsPerPcm=-1
|
||||
;
|
||||
|
||||
[Tuning]
|
||||
; This section defines the realtime parameters used when running
|
||||
; This directive tells Rivendell modules how long to wait for the
|
||||
; 'rivendell' systemd service to become active (seconds). Default
|
||||
; value is '30'.
|
||||
ServiceTimeout=30
|
||||
|
||||
; These directives define the realtime parameters used when running
|
||||
; audio components. Normally, these are useful only for debugging.
|
||||
UseRealtime=Yes
|
||||
RealtimePriority=9
|
||||
|
4
lib/rd.h
4
lib/rd.h
@ -600,5 +600,9 @@
|
||||
#define RD_PAD_CLIENT_TCP_PORT 34289
|
||||
#define RD_PAD_SOURCE_UNIX_ADDRESS "m4w8n8fsfddf-473fdueusurt-8954"
|
||||
|
||||
/*
|
||||
* Default 'ServiceTimeout=' value in rd.conf(5)
|
||||
*/
|
||||
#define RD_DEFAULT_SERVICE_TIMEOUT 30
|
||||
|
||||
#endif // RD_H
|
||||
|
@ -341,40 +341,50 @@ void RDApplication::userChangedData()
|
||||
bool RDApplication::CheckService(QString *err_msg)
|
||||
{
|
||||
bool ret=false;
|
||||
QStringList args;
|
||||
QProcess *proc=new QProcess(this);
|
||||
int trial=config()->serviceTimeout();
|
||||
|
||||
args.push_back("--property");
|
||||
args.push_back("ActiveState");
|
||||
args.push_back("show");
|
||||
args.push_back("rivendell");
|
||||
proc->start("systemctl",args);
|
||||
proc->waitForFinished();
|
||||
if(proc->exitStatus()!=QProcess::NormalExit) {
|
||||
*err_msg=tr("systemctl(1) crashed.");
|
||||
if(trial<=0) {
|
||||
trial=1;
|
||||
}
|
||||
else {
|
||||
if(proc->exitCode()!=0) {
|
||||
*err_msg=tr("systemctl(1) returned exit code")+
|
||||
QString().sprintf(" %d:\n",proc->exitCode())+
|
||||
proc->readAllStandardError();
|
||||
while((!ret)&&(trial>0)) {
|
||||
QStringList args;
|
||||
QProcess *proc=new QProcess(this);
|
||||
|
||||
args.push_back("--property");
|
||||
args.push_back("ActiveState");
|
||||
args.push_back("show");
|
||||
args.push_back("rivendell");
|
||||
proc->start("systemctl",args);
|
||||
proc->waitForFinished();
|
||||
if(proc->exitStatus()!=QProcess::NormalExit) {
|
||||
*err_msg=tr("systemctl(1) crashed.");
|
||||
}
|
||||
else {
|
||||
*err_msg=tr("Rivendell service is not active.");
|
||||
QStringList f0=QString(proc->readAllStandardOutput()).
|
||||
split("\n",QString::SkipEmptyParts);
|
||||
for(int i=0;i<f0.size();i++) {
|
||||
QStringList f1=f0.at(i).trimmed().split("=");
|
||||
if((f1.size()==2)&&(f1.at(0)=="ActiveState")) {
|
||||
ret=f1.at(1).toLower()=="active";
|
||||
if(ret) {
|
||||
*err_msg=tr("OK");
|
||||
if(proc->exitCode()!=0) {
|
||||
*err_msg=tr("systemctl(1) returned exit code")+
|
||||
QString().sprintf(" %d:\n",proc->exitCode())+
|
||||
proc->readAllStandardError();
|
||||
}
|
||||
else {
|
||||
*err_msg=tr("Rivendell service is not active.");
|
||||
QStringList f0=QString(proc->readAllStandardOutput()).
|
||||
split("\n",QString::SkipEmptyParts);
|
||||
for(int i=0;i<f0.size();i++) {
|
||||
QStringList f1=f0.at(i).trimmed().split("=");
|
||||
if((f1.size()==2)&&(f1.at(0)=="ActiveState")) {
|
||||
ret=f1.at(1).toLower()=="active";
|
||||
if(ret) {
|
||||
*err_msg=tr("OK");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
delete proc;
|
||||
|
||||
trial--;
|
||||
sleep(1);
|
||||
}
|
||||
delete proc;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -417,6 +417,13 @@ int RDConfig::transcodingDelay() const
|
||||
return conf_transcoding_delay;
|
||||
}
|
||||
|
||||
|
||||
int RDConfig::serviceTimeout() const
|
||||
{
|
||||
return conf_service_timeout;
|
||||
}
|
||||
|
||||
|
||||
// Don't use this method in application code, use RDTempDirectory()
|
||||
QString RDConfig::tempDirectory()
|
||||
{
|
||||
@ -583,6 +590,8 @@ bool RDConfig::load()
|
||||
conf_use_realtime=profile->boolValue("Tuning","UseRealtime",false);
|
||||
conf_realtime_priority=profile->intValue("Tuning","RealtimePriority",9);
|
||||
conf_transcoding_delay=profile->intValue("Tuning","TranscodingDelay");
|
||||
conf_service_timeout=
|
||||
profile->intValue("Tuning","ServiceTimeout",RD_DEFAULT_SERVICE_TIMEOUT);
|
||||
conf_temp_directory=profile->stringValue("Tuning","TempDirectory","");
|
||||
conf_sas_station=profile->stringValue("SASFilter","Station","");
|
||||
conf_sas_matrix=profile->intValue("SASFilter","Matrix",0);
|
||||
@ -681,6 +690,7 @@ void RDConfig::clear()
|
||||
conf_use_realtime=false;
|
||||
conf_realtime_priority=9;
|
||||
conf_transcoding_delay=0;
|
||||
conf_service_timeout=RD_DEFAULT_SERVICE_TIMEOUT;
|
||||
conf_temp_directory="";
|
||||
conf_sas_station="";
|
||||
conf_sas_matrix=-1;
|
||||
|
@ -106,6 +106,7 @@ class RDConfig
|
||||
bool useRealtime();
|
||||
int realtimePriority();
|
||||
int transcodingDelay() const;
|
||||
int serviceTimeout() const;
|
||||
QString tempDirectory();
|
||||
QString sasStation() const;
|
||||
int sasMatrix() const;
|
||||
@ -172,6 +173,7 @@ class RDConfig
|
||||
bool conf_use_realtime;
|
||||
int conf_transcoding_delay;
|
||||
int conf_realtime_priority;
|
||||
int conf_service_timeout;
|
||||
QString conf_temp_directory;
|
||||
QString conf_sas_station;
|
||||
int conf_sas_matrix;
|
||||
|
Loading…
x
Reference in New Issue
Block a user