aboutsummaryrefslogtreecommitdiffstats
path: root/src/afb-supervision.c
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2018-02-22 13:22:48 +0100
committerJosé Bollo <jose.bollo@iot.bzh>2018-02-22 13:22:48 +0100
commitca820c65c2b03a24e8936218171c6c1d138fd1f7 (patch)
treef7e31ea8e63d3321af64226e360a78c504a09bb3 /src/afb-supervision.c
parentf15ea770dd9b13a20331853a026091316984f9ca (diff)
fdev: Introduce fdev for file event handling
This is an effort to keep cutting dependency to systemd. Change-Id: I9a0c032a1095e297c7f3ac5b67827fda3658b8d9 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/afb-supervision.c')
-rw-r--r--src/afb-supervision.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/afb-supervision.c b/src/afb-supervision.c
index f41ca18b..0f8a16bb 100644
--- a/src/afb-supervision.c
+++ b/src/afb-supervision.c
@@ -43,6 +43,7 @@
#include "afs-supervision.h"
#include "afb-stub-ws.h"
#include "afb-debug.h"
+#include "afb-fdev.h"
#include "verbose.h"
#include "wrap-json.h"
#include "jobs.h"
@@ -138,6 +139,7 @@ static void try_connect_supervisor()
int fd;
ssize_t srd;
struct afs_supervision_initiator initiator;
+ struct fdev *fdev;
/* get the mutex */
pthread_mutex_lock(&mutex);
@@ -195,10 +197,15 @@ static void try_connect_supervisor()
}
/* make the supervisor link */
- supervisor = afb_stub_ws_create_server(fd, supervision_apiname, supervision_apiset);
+ fdev = afb_fdev_create(fd);
+ if (!fdev) {
+ ERROR("Creation of fdev failed: %m");
+ goto end2;
+ }
+ supervisor = afb_stub_ws_create_server(fdev, supervision_apiname, supervision_apiset);
if (!supervisor) {
ERROR("Creation of supervisor failed: %m");
- goto end2;
+ goto end;
}
afb_stub_ws_on_hangup(supervisor, on_supervisor_hangup);