aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2018-06-13 13:13:40 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2018-07-10 17:12:13 +0200
commit8f91a2c2dfa8535a2bae5854648138de4abe7f65 (patch)
tree5f3cb1b9f2326a37bb7ef59dbe9d97ea29feb4c3 /src
parent2046edda1b507544240d3796d6bc494b7bbded6c (diff)
Fix binding initialization
Change-Id: I1cacb160bccdbfca5001cd8a52a0383dd73e1403 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'src')
-rw-r--r--src/test-binding.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/test-binding.c b/src/test-binding.c
index ddbc6d7..d1c6c1f 100644
--- a/src/test-binding.c
+++ b/src/test-binding.c
@@ -26,8 +26,7 @@
// default api to print log when apihandle not avaliable
afb_dynapi *AFB_default;
-// Config Section definition (note: controls section index should match handle
-// retrieval in HalConfigExec)
+// Config Section definition
static CtlSectionT ctrlSections[] = {
{.key = "resources", .loadCB = PluginConfig},
{.key = "onload", .loadCB = OnloadConfig},
@@ -67,14 +66,6 @@ static int CtrlInitOneApi(AFB_ApiT apiHandle) {
int err = 0;
AFB_default = apiHandle; // hugely hack to make all V2 AFB_DEBUG to work in fileutils
- // retrieve section config from api handle
- CtlConfigT *ctrlConfig = (CtlConfigT *)afb_dynapi_get_userdata(apiHandle);
- err = CtlConfigExec(apiHandle, ctrlConfig);
- if(err) {
- AFB_ApiError(apiHandle, "Error at CtlConfigExec step");
- return err;
- }
-
return err;
}
@@ -108,7 +99,7 @@ static int CtrlLoadOneApi(void *cbdata, AFB_ApiT apiHandle) {
}
int afbBindingVdyn(afb_dynapi *apiHandle) {
-
+ int status, err = 0;
AFB_default = apiHandle;
AFB_ApiNotice(apiHandle, "Controller in afbBindingVdyn");
@@ -142,7 +133,13 @@ int afbBindingVdyn(afb_dynapi *apiHandle) {
ctrlConfig->info);
// create one API per config file (Pre-V3 return code ToBeChanged)
- int status = afb_dynapi_new_api(apiHandle, ctrlConfig->api, ctrlConfig->info, 1, CtrlLoadOneApi, ctrlConfig);
+ status = afb_dynapi_new_api(apiHandle, ctrlConfig->api, ctrlConfig->info, 1, CtrlLoadOneApi, ctrlConfig);
+
+ err = CtlConfigExec(apiHandle, ctrlConfig);
+ if(err) {
+ AFB_ApiError(apiHandle, "Error at CtlConfigExec step");
+ return err;
+ }
return status;
}