summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJose Bollo <jose.bollo@iot.bzh>2018-12-03 15:16:30 +0100
committerJose Bollo <jose.bollo@iot.bzh>2018-12-05 10:08:10 +0100
commit9295a52e5ea920a969aa0bf7aedd2342fb59c8fe (patch)
tree58b31d30763ecfd6dca31dc7ccaae8b3dec6d3f3
parent3f2e3d9ee06073b4bdbfe0f0321574f66397505e (diff)
afb-proto-ws: Add error report
Change-Id: I58c88f8bcaf4cfb8a53b58eeefd7fa3415bf894a Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/afb-proto-ws.c13
-rw-r--r--src/afb-stub-ws.c1
3 files changed, 15 insertions, 1 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index e1a1073a..d81c314e 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -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})
diff --git a/src/afb-proto-ws.c b/src/afb-proto-ws.c
index 86112a32..f74869cf 100644
--- a/src/afb-proto-ws.c
+++ b/src/afb-proto-ws.c
@@ -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)
diff --git a/src/afb-stub-ws.c b/src/afb-stub-ws.c
index a41a9b02..5dfacb73 100644
--- a/src/afb-stub-ws.c
+++ b/src/afb-stub-ws.c
@@ -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;
}