X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fafb-proto-ws.c;h=89d4522c1ad4781671460c30a2cf3c9da16d2df4;hb=refs%2Fchanges%2F51%2F16251%2F2;hp=c079bf69884dd5bcad9dbf89790fc723f91a5e64;hpb=a1a507793efff92b35603e4948e9f6dff4fba99c;p=src%2Fapp-framework-binder.git diff --git a/src/afb-proto-ws.c b/src/afb-proto-ws.c index c079bf69..89d4522c 100644 --- a/src/afb-proto-ws.c +++ b/src/afb-proto-ws.c @@ -89,7 +89,7 @@ For the purpose of handling events the server can: struct client_call { struct client_call *next; /* the next call */ struct afb_proto_ws *protows; /* the proto_ws */ - void *request; + void *request; /* the request closure */ uint32_t callid; /* the message identifier */ }; @@ -936,8 +936,18 @@ static void on_hangup(void *closure) { struct afb_proto_ws *protows = closure; struct client_describe *cd, *ncd; + struct client_call *call, *ncall; + + ncd = __atomic_exchange_n(&protows->describes, NULL, __ATOMIC_RELAXED); + ncall = __atomic_exchange_n(&protows->calls, NULL, __ATOMIC_RELAXED); + + while (ncall) { + call= ncall; + ncall = call->next; + protows->client_itf->on_reply(protows->closure, call->request, NULL, "disconnected", "server hung up"); + free(call); + } - ncd = protows->describes; while (ncd) { cd= ncd; ncd = cd->next;