X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;ds=inline;f=src%2Fafb-proto-ws.c;h=1f7039e6731a7b0e73d6fbdc1f0f5eaf3b495647;hb=ec04e7de2d8068c804acff096e88e81b9cde70e7;hp=89d4522c1ad4781671460c30a2cf3c9da16d2df4;hpb=e36f8d572ca660f5c06fe45297d13c7a6818cc65;p=src%2Fapp-framework-binder.git diff --git a/src/afb-proto-ws.c b/src/afb-proto-ws.c index 89d4522c..1f7039e6 100644 --- a/src/afb-proto-ws.c +++ b/src/afb-proto-ws.c @@ -35,7 +35,6 @@ #include "afb-ws.h" #include "afb-msg-json.h" #include "afb-proto-ws.h" -#include "jobs.h" #include "fdev.h" struct afb_proto_ws; @@ -160,7 +159,7 @@ struct afb_proto_ws void (*on_hangup)(void *closure); /* queuing facility for processing messages */ - int (*queuing)(void (*process)(int s, void *c), void *closure); + int (*queuing)(struct afb_proto_ws *proto, void (*process)(int s, void *c), void *closure); }; /******************* streaming objects **********************************/ @@ -347,7 +346,7 @@ static void queue_message_processing(struct afb_proto_ws *protows, char *data, s binary->rb.head = data; binary->rb.end = data + size; if (!protows->queuing - || protows->queuing(processing, binary) < 0) + || protows->queuing(protows, processing, binary) < 0) processing(0, binary); return; } @@ -1022,7 +1021,7 @@ struct afb_proto_ws *afb_proto_ws_create_server(struct fdev *fdev, const struct void afb_proto_ws_unref(struct afb_proto_ws *protows) { - if (!__atomic_sub_fetch(&protows->refcount, 1, __ATOMIC_RELAXED)) { + if (protows && !__atomic_sub_fetch(&protows->refcount, 1, __ATOMIC_RELAXED)) { afb_proto_ws_hangup(protows); afb_ws_destroy(protows->ws); pthread_mutex_destroy(&protows->mutex); @@ -1055,7 +1054,7 @@ void afb_proto_ws_on_hangup(struct afb_proto_ws *protows, void (*on_hangup)(void protows->on_hangup = on_hangup; } -void afb_proto_ws_set_queuing(struct afb_proto_ws *protows, int (*queuing)(void (*)(int,void*), void*)) +void afb_proto_ws_set_queuing(struct afb_proto_ws *protows, int (*queuing)(struct afb_proto_ws*, void (*)(int,void*), void*)) { protows->queuing = queuing; }