2018-12-18 Fred Gleason <fredg@paravelsystems.com>

* Fixed a bug in rdpadengined(8) that failed to kill a pypad
	script after receiving a DELETE notification for it.
This commit is contained in:
Fred Gleason
2018-12-18 12:32:26 -05:00
parent bc42ff435c
commit f148205d10
2 changed files with 27 additions and 23 deletions

View File

@@ -18214,3 +18214,6 @@
* Added a 'PYPAD_INSTANCES.EXIT_CODE' field to the database. * Added a 'PYPAD_INSTANCES.EXIT_CODE' field to the database.
* Added a 'PYPAD_INSTANCES.ERROR_TEXT' field to the database. * Added a 'PYPAD_INSTANCES.ERROR_TEXT' field to the database.
* Incremented the database version to 304. * Incremented the database version to 304.
2018-12-18 Fred Gleason <fredg@paravelsystems.com>
* Fixed a bug in rdpadengined(8) that failed to kill a pypad
script after receiving a DELETE notification for it.

View File

@@ -145,33 +145,34 @@ void MainObject::notificationReceivedData(RDNotification *notify)
QString sql; QString sql;
RDSqlQuery *q; RDSqlQuery *q;
if(notify->type()==RDNotification::PypadType) { syslog(LOG_NOTICE,"NOTIFY: %s",(const char *)notify->write().toUtf8());
if(notify->type()==RDNotification::PypadType) {
int id=notify->id().toUInt(); int id=notify->id().toUInt();
sql=QString("select SCRIPT_PATH from PYPAD_INSTANCES where ")+ switch(notify->action()) {
QString().sprintf("ID=%u && ",id)+ case RDNotification::AddAction:
"STATION_NAME=\""+RDEscapeString(rda->station()->name())+"\""; sql=QString("select SCRIPT_PATH from PYPAD_INSTANCES where ")+
q=new RDSqlQuery(sql); QString().sprintf("ID=%u && ",id)+
while(q->next()) { "STATION_NAME=\""+RDEscapeString(rda->station()->name())+"\"";
switch(notify->action()) { q=new RDSqlQuery(sql);
case RDNotification::AddAction: if(q->first()) {
StartScript(id,q->value(0).toString()); StartScript(id,q->value(0).toString());
break;
case RDNotification::DeleteAction:
pad_instances.value(id)->setPrivateData((void *)true); // No Restart
KillScript(id);
break;
case RDNotification::ModifyAction:
KillScript(id);
break;
case RDNotification::NoAction:
case RDNotification::LastAction:
break;
} }
delete q;
break;
case RDNotification::DeleteAction:
pad_instances.value(id)->setPrivateData((void *)true); // No Restart
KillScript(id);
break;
case RDNotification::ModifyAction:
KillScript(id);
break;
case RDNotification::NoAction:
case RDNotification::LastAction:
break;
} }
delete q;
} }
} }