X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fafb-ws-json1.c;h=68565aa22bae70914edcc58a18b7c54500a75677;hb=ca820c65c2b03a24e8936218171c6c1d138fd1f7;hp=0fa13dfdc1c3f9f62b60d1b7a5e98d9892841d07;hpb=f15ea770dd9b13a20331853a026091316984f9ca;p=src%2Fapp-framework-binder.git diff --git a/src/afb-ws-json1.c b/src/afb-ws-json1.c index 0fa13dfd..68565aa2 100644 --- a/src/afb-ws-json1.c +++ b/src/afb-ws-json1.c @@ -36,6 +36,7 @@ #include "afb-context.h" #include "afb-evt.h" #include "verbose.h" +#include "fdev.h" /* predeclaration of structures */ struct afb_ws_json1; @@ -99,11 +100,11 @@ static const struct afb_evt_itf evt_itf = { **************************************************************** ***************************************************************/ -struct afb_ws_json1 *afb_ws_json1_create(int fd, struct afb_apiset *apiset, struct afb_context *context, void (*cleanup)(void*), void *cleanup_closure) +struct afb_ws_json1 *afb_ws_json1_create(struct fdev *fdev, struct afb_apiset *apiset, struct afb_context *context, void (*cleanup)(void*), void *cleanup_closure) { struct afb_ws_json1 *result; - assert(fd >= 0); + assert(fdev); assert(context != NULL); result = malloc(sizeof * result); @@ -118,7 +119,7 @@ struct afb_ws_json1 *afb_ws_json1_create(int fd, struct afb_apiset *apiset, stru if (result->session == NULL) goto error2; - result->wsj1 = afb_wsj1_create(afb_systemd_get_event_loop(), fd, &wsj1_itf, result); + result->wsj1 = afb_wsj1_create(fdev, &wsj1_itf, result); if (result->wsj1 == NULL) goto error3; @@ -126,7 +127,7 @@ struct afb_ws_json1 *afb_ws_json1_create(int fd, struct afb_apiset *apiset, stru if (result->listener == NULL) goto error4; - result->cred = afb_cred_create_for_socket(fd); + result->cred = afb_cred_create_for_socket(fdev_fd(fdev)); result->apiset = afb_apiset_addref(apiset); return result; @@ -137,7 +138,7 @@ error3: error2: free(result); error: - close(fd); + fdev_unref(fdev); return NULL; }