Don't enforce anymore to have the function
'afbBindingV1ServiceInit' defined when expecting
events through 'afbBindingV1ServiceEvent'.
This will allow to handle broadcasted events.
Change-Id: Ib75904487ad99fdc50813deaf6013f4ba4c47421
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
/* get the initialisation */
init = dlsym(desc->handle, afb_api_so_v1_service_init);
- if (init == NULL) {
+ onevent = dlsym(desc->handle, afb_api_so_v1_service_event);
+ if (init == NULL && onevent == NULL) {
/* not an error when onneed */
if (onneed != 0)
return 0;
}
/* get the event handler if any */
- onevent = dlsym(desc->handle, afb_api_so_v1_service_event);
desc->service = afb_svc_create_v1(apiset, share_session, init, onevent);
if (desc->service == NULL) {
/* starting error */
}
/* initialises the svc now */
- rc = start(to_afb_service(svc));
- if (rc < 0)
- goto error;
+ if (start) {
+ rc = start(to_afb_service(svc));
+ if (rc < 0)
+ goto error;
+ }
return svc;