From f148205d108cae11b38ed7dc75984b80a577c2eb Mon Sep 17 00:00:00 2001 From: Fred Gleason Date: Tue, 18 Dec 2018 12:32:26 -0500 Subject: [PATCH] 2018-12-18 Fred Gleason * Fixed a bug in rdpadengined(8) that failed to kill a pypad script after receiving a DELETE notification for it. --- ChangeLog | 3 +++ rdpadengined/rdpadengined.cpp | 47 ++++++++++++++++++----------------- 2 files changed, 27 insertions(+), 23 deletions(-) diff --git a/ChangeLog b/ChangeLog index c27a1e97..1f332673 100644 --- a/ChangeLog +++ b/ChangeLog @@ -18214,3 +18214,6 @@ * Added a 'PYPAD_INSTANCES.EXIT_CODE' field to the database. * Added a 'PYPAD_INSTANCES.ERROR_TEXT' field to the database. * Incremented the database version to 304. +2018-12-18 Fred Gleason + * Fixed a bug in rdpadengined(8) that failed to kill a pypad + script after receiving a DELETE notification for it. diff --git a/rdpadengined/rdpadengined.cpp b/rdpadengined/rdpadengined.cpp index 48d03686..c8f99d3c 100644 --- a/rdpadengined/rdpadengined.cpp +++ b/rdpadengined/rdpadengined.cpp @@ -145,33 +145,34 @@ void MainObject::notificationReceivedData(RDNotification *notify) QString sql; 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(); - sql=QString("select SCRIPT_PATH from PYPAD_INSTANCES where ")+ - QString().sprintf("ID=%u && ",id)+ - "STATION_NAME=\""+RDEscapeString(rda->station()->name())+"\""; - q=new RDSqlQuery(sql); - while(q->next()) { - switch(notify->action()) { - case RDNotification::AddAction: + switch(notify->action()) { + case RDNotification::AddAction: + sql=QString("select SCRIPT_PATH from PYPAD_INSTANCES where ")+ + QString().sprintf("ID=%u && ",id)+ + "STATION_NAME=\""+RDEscapeString(rda->station()->name())+"\""; + q=new RDSqlQuery(sql); + if(q->first()) { 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; } }