summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJose Bollo <jose.bollo@iot.bzh>2020-03-02 14:02:47 +0100
committerJosé Bollo <jose.bollo@iot.bzh>2020-03-03 10:40:30 +0100
commit38c6516c7ed567a5c4b5f961c7ab3f61b9362c0d (patch)
tree83a29c04cc21301809ea12104ff2486ac4b594cd
parentad15fdb2b1a82c49140fd33687cb48dcd743ee20 (diff)
Fix a tiny issue in the protocol
The id sent was 16 bits in one case and 32 bits in the other Bug-AGL: SPEC-3220 Change-Id: If38c99b2d903b6851ff4682e1f8d771aec7ddcee Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
-rw-r--r--src/afb-proto-ws.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/afb-proto-ws.c b/src/afb-proto-ws.c
index 0e102308..3365d60e 100644
--- a/src/afb-proto-ws.c
+++ b/src/afb-proto-ws.c
@@ -670,11 +670,11 @@ static void client_on_reply(struct afb_proto_ws *protows, struct readbuf *rb)
static void client_on_description(struct afb_proto_ws *protows, struct readbuf *rb)
{
- uint32_t descid;
+ uint16_t descid;
struct client_describe *desc, **prv;
struct json_object *object;
- if (readbuf_uint32(rb, &descid)) {
+ if (readbuf_uint16(rb, &descid)) {
pthread_mutex_lock(&protows->mutex);
prv = &protows->describes;
while ((desc = *prv) && desc->descid != descid)
@@ -970,13 +970,13 @@ overflow:
afb_proto_ws_unref(protows);
}
-static int server_send_description(struct afb_proto_ws *protows, uint32_t descid, struct json_object *descobj)
+static int server_send_description(struct afb_proto_ws *protows, uint16_t descid, struct json_object *descobj)
{
int rc = -1;
struct writebuf wb = { .iovcount = 0, .bufcount = 0 };
if (writebuf_char(&wb, CHAR_FOR_DESCRIPTION)
- && writebuf_uint32(&wb, descid)
+ && writebuf_uint16(&wb, descid)
&& writebuf_object(&wb, descobj))
rc = proto_write(protows, &wb);
return rc;