1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

api: web: Do proper shutdown if startup was interrupted

Signed-off-by: Philipp Jungkamp <Philipp.Jungkamp@opal-rt.com>
This commit is contained in:
Philipp Jungkamp 2023-08-22 16:10:22 +02:00 committed by Steffen Vogel
parent 9c94b31057
commit 82272fc7e6
3 changed files with 11 additions and 3 deletions

View file

@ -24,9 +24,9 @@ namespace node {
/* Forward declarations */
class Api;
class Web {
class Web final {
protected:
private:
enum State state;
Logger logger;
@ -55,6 +55,8 @@ public:
*/
Web(Api *a = nullptr);
~Web();
void start();
void stop();

View file

@ -33,7 +33,8 @@ Api::Api(SuperNode *sn) :
Api::~Api()
{
assert(state != State::STARTED);
if (state == State::STARTED)
stop();
}
void Api::start()

View file

@ -185,6 +185,11 @@ Web::Web(Api *a) :
lws_set_log_level(lwsLogLevel(logging.getLevel()), lwsLogger);
}
Web::~Web() {
if(state == State::STARTED)
stop();
}
int Web::parse(json_t *json)
{
int ret, enabled = 1;