aboutsummaryrefslogtreecommitdiffstats
path: root/src/main-afb-daemon.c
diff options
context:
space:
mode:
authorJose Bollo <jose.bollo@iot.bzh>2018-10-30 14:31:33 +0100
committerJosé Bollo <jose.bollo@iot.bzh>2018-12-13 10:47:50 +0000
commitc31411aaba6c8bd04f68bfdb1f042d018e677790 (patch)
tree4f460d9bc14b95cc728507368c235c298f855e6e /src/main-afb-daemon.c
parent2703a6bd8611726fa61118bf9c68a6e2ea0b9b22 (diff)
afb-hsrv: Prepare selection of listening interfaces
The listening socket will no more be the default one but will be the selected ones, with ability to select more than just one listening interface. Nevertheless, the behavior is not changed at the moment. The default interface (0.0.0.0) is still used. A further change will add the ability to select the listening interfaces. That evolution depends on a fix of libmicrohttpd to enable at the same time epoll and no-listen-fd. Bug-AGL: SPEC-1833 Bug-AGL: SPEC-1016 Change-Id: Ia78671cbee90a243ba7b2c724b6155cffbde6920 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/main-afb-daemon.c')
-rw-r--r--src/main-afb-daemon.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/main-afb-daemon.c b/src/main-afb-daemon.c
index 4fb4792c..bb2f0a56 100644
--- a/src/main-afb-daemon.c
+++ b/src/main-afb-daemon.c
@@ -67,6 +67,10 @@
#include "jobs.h"
#include "sig-monitor.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 afb-daemon is the group leader
@@ -371,13 +375,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);
- 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;
}
+ 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;
}