Code Review
/
src
/
app-framework-binder.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
watchdog: Isolate the watchdog from jobs
[src/app-framework-binder.git]
/
src
/
main-afb-daemon.c
diff --git
a/src/main-afb-daemon.c
b/src/main-afb-daemon.c
index
4fb4792
..
beb08d3
100644
(file)
--- a/
src/main-afb-daemon.c
+++ b/
src/main-afb-daemon.c
@@
-1,5
+1,5
@@
/*
/*
- * Copyright (C) 2015-201
8
"IoT.bzh"
+ * Copyright (C) 2015-201
9
"IoT.bzh"
* Author "Fulup Ar Foll"
* Author José Bollo <jose.bollo@iot.bzh>
*
* Author "Fulup Ar Foll"
* Author José Bollo <jose.bollo@iot.bzh>
*
@@
-66,6
+66,11
@@
#include "wrap-json.h"
#include "jobs.h"
#include "sig-monitor.h"
#include "wrap-json.h"
#include "jobs.h"
#include "sig-monitor.h"
+#include "watchdog.h"
+
+#if !defined(DEFAULT_BINDER_INTERFACE)
+# define DEFAULT_BINDER_INTERFACE NULL
+#endif
/*
if SELF_PGROUP == 0 the launched command is the group leader
/*
if SELF_PGROUP == 0 the launched command is the group leader
@@
-371,13
+376,20
@@
static struct afb_hsrv *start_http_server()
NOTICE("Waiting port=%d rootdir=%s", http_port, rootdir);
NOTICE("Browser URL= http://localhost:%d", http_port);
NOTICE("Waiting port=%d rootdir=%s", http_port, rootdir);
NOTICE("Browser URL= http://localhost:%d", http_port);
- rc = afb_hsrv_start(hsrv,
(uint16_t) http_port,
15);
+ rc = afb_hsrv_start(hsrv, 15);
if (!rc) {
ERROR("starting of httpd failed");
afb_hsrv_put(hsrv);
return NULL;
}
if (!rc) {
ERROR("starting of httpd failed");
afb_hsrv_put(hsrv);
return NULL;
}
+ rc = afb_hsrv_add_interface_tcp(hsrv, DEFAULT_BINDER_INTERFACE, (uint16_t) http_port);
+ if (!rc) {
+ ERROR("setting interface failed");
+ afb_hsrv_put(hsrv);
+ return NULL;
+ }
+
return hsrv;
}
return hsrv;
}
@@
-850,6
+862,13
@@
static void start(int signum, void *arg)
/* ready */
sd_notify(1, "READY=1");
/* ready */
sd_notify(1, "READY=1");
+
+ /* activate the watchdog */
+#if HAS_WATCHDOG
+ if (watchdog_activate() < 0)
+ ERROR("can't start the watchdog");
+#endif
+
return;
error:
exit(1);
return;
error:
exit(1);