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:
parent
9c94b31057
commit
82272fc7e6
3 changed files with 11 additions and 3 deletions
|
@ -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();
|
||||
|
||||
|
|
|
@ -33,7 +33,8 @@ Api::Api(SuperNode *sn) :
|
|||
|
||||
Api::~Api()
|
||||
{
|
||||
assert(state != State::STARTED);
|
||||
if (state == State::STARTED)
|
||||
stop();
|
||||
}
|
||||
|
||||
void Api::start()
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue