afb-proto-ws: Add error report 85/18585/1
authorJose Bollo <jose.bollo@iot.bzh>
Mon, 3 Dec 2018 14:16:30 +0000 (15:16 +0100)
committerJose Bollo <jose.bollo@iot.bzh>
Wed, 5 Dec 2018 09:08:10 +0000 (10:08 +0100)
Change-Id: I58c88f8bcaf4cfb8a53b58eeefd7fa3415bf894a
Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
src/CMakeLists.txt
src/afb-proto-ws.c
src/afb-stub-ws.c

index e1a1073..d81c314 100644 (file)
@@ -126,7 +126,7 @@ ENDIF()
 ###########################################
 # build and install libafbwsc
 ###########################################
-ADD_LIBRARY(afbwsc SHARED afb-ws.c afb-ws-client.c afb-wsj1.c websock.c afb-proto-ws.c fdev.c fdev-systemd.c)
+ADD_LIBRARY(afbwsc SHARED afb-ws.c afb-ws-client.c afb-wsj1.c websock.c afb-proto-ws.c fdev.c fdev-systemd.c verbose.c)
 SET_TARGET_PROPERTIES(afbwsc PROPERTIES
        VERSION ${LIBAFBWSC_VERSION}
        SOVERSION ${LIBAFBWSC_SOVERSION})
index 86112a3..f74869c 100644 (file)
@@ -37,6 +37,7 @@
 #include "afb-proto-ws.h"
 #include "jobs.h"
 #include "fdev.h"
+#include "verbose.h"
 
 struct afb_proto_ws;
 
@@ -515,6 +516,8 @@ static void client_on_event_create(struct afb_proto_ws *protows, struct readbuf
 
        if (protows->client_itf->on_event_create && client_msg_event_read(rb, &event_id, &event_name))
                protows->client_itf->on_event_create(protows->closure, event_name, (int)event_id);
+       else
+               ERROR("Ignoring creation of event");
 }
 
 /* removes an event */
@@ -525,6 +528,8 @@ static void client_on_event_remove(struct afb_proto_ws *protows, struct readbuf
 
        if (protows->client_itf->on_event_remove && client_msg_event_read(rb, &event_id, &event_name))
                protows->client_itf->on_event_remove(protows->closure, event_name, (int)event_id);
+       else
+               ERROR("Ignoring deletion of event");
 }
 
 /* subscribes an event */
@@ -536,6 +541,8 @@ static void client_on_event_subscribe(struct afb_proto_ws *protows, struct readb
 
        if (protows->client_itf->on_event_subscribe && client_msg_call_get(protows, rb, &call) && client_msg_event_read(rb, &event_id, &event_name))
                protows->client_itf->on_event_subscribe(protows->closure, call->request, event_name, (int)event_id);
+       else
+               ERROR("Ignoring subscription to event");
 }
 
 /* unsubscribes an event */
@@ -547,6 +554,8 @@ static void client_on_event_unsubscribe(struct afb_proto_ws *protows, struct rea
 
        if (protows->client_itf->on_event_unsubscribe && client_msg_call_get(protows, rb, &call) && client_msg_event_read(rb, &event_id, &event_name))
                protows->client_itf->on_event_unsubscribe(protows->closure, call->request, event_name, (int)event_id);
+       else
+               ERROR("Ignoring unsubscription to event");
 }
 
 /* receives broadcasted events */
@@ -557,6 +566,8 @@ static void client_on_event_broadcast(struct afb_proto_ws *protows, struct readb
 
        if (protows->client_itf->on_event_broadcast && readbuf_string(rb, &event_name, NULL) && readbuf_object(rb, &object))
                protows->client_itf->on_event_broadcast(protows->closure, event_name, object);
+       else
+               ERROR("Ignoring broadcast of event");
 }
 
 /* pushs an event */
@@ -568,6 +579,8 @@ static void client_on_event_push(struct afb_proto_ws *protows, struct readbuf *r
 
        if (protows->client_itf->on_event_push && client_msg_event_read(rb, &event_id, &event_name) && readbuf_object(rb, &object))
                protows->client_itf->on_event_push(protows->closure, event_name, (int)event_id, object);
+       else
+               ERROR("Ignoring push of event");
 }
 
 static void client_on_reply(struct afb_proto_ws *protows, struct readbuf *rb)
index a41a9b0..5dfacb7 100644 (file)
@@ -235,6 +235,7 @@ static struct client_event *client_event_search(struct afb_stub_ws *stubws, uint
        while (ev != NULL && (ev->id != eventid || 0 != strcmp(afb_evt_event_x2_fullname(ev->event), name)))
                ev = ev->next;
 
+       DEBUG("searching event %s[%d]: %s", name, eventid, ev ? "found" : "not found");
        return ev;
 }