Code Review
/
src
/
app-framework-binder.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
afb-daemon: Add /tmp has fallback for uploads
[src/app-framework-binder.git]
/
src
/
afb-stub-ws.c
diff --git
a/src/afb-stub-ws.c
b/src/afb-stub-ws.c
index
7ec2d63
..
3c28871
100644
(file)
--- a/
src/afb-stub-ws.c
+++ b/
src/afb-stub-ws.c
@@
-1,5
+1,5
@@
/*
/*
- * Copyright (C) 2015-201
8
"IoT.bzh"
+ * Copyright (C) 2015-201
9
"IoT.bzh"
* Author José Bollo <jose.bollo@iot.bzh>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Author José Bollo <jose.bollo@iot.bzh>
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@
-145,7
+145,7
@@
struct afb_stub_ws
uint8_t is_client;
/* the api name */
uint8_t is_client;
/* the api name */
- char apiname[
1
];
+ char apiname[];
};
static struct afb_proto_ws *afb_stub_ws_create_proto(struct afb_stub_ws *stubws, struct fdev *fdev, uint8_t server);
};
static struct afb_proto_ws *afb_stub_ws_create_proto(struct afb_stub_ws *stubws, struct fdev *fdev, uint8_t server);
@@
-266,6
+266,7
@@
static void client_api_call_cb(void * closure, struct afb_xreq *xreq)
return;
}
return;
}
+ afb_xreq_unhooked_addref(xreq);
rc = afb_proto_ws_client_call(
proto,
xreq->request.called_verb,
rc = afb_proto_ws_client_call(
proto,
xreq->request.called_verb,
@@
-273,10
+274,10
@@
static void client_api_call_cb(void * closure, struct afb_xreq *xreq)
afb_session_uuid(xreq->context.session),
xreq,
xreq_on_behalf_cred_export(xreq));
afb_session_uuid(xreq->context.session),
xreq,
xreq_on_behalf_cred_export(xreq));
- if (rc >= 0)
- afb_xreq_unhooked_addref(xreq);
- else
+ if (rc < 0) {
afb_xreq_reply(xreq, NULL, "internal", "can't send message");
afb_xreq_reply(xreq, NULL, "internal", "can't send message");
+ afb_xreq_unhooked_unref(xreq);
+ }
}
static void client_on_description_cb(void *closure, struct json_object *data)
}
static void client_on_description_cb(void *closure, struct json_object *data)
@@
-648,7
+649,7
@@
static void on_hangup(void *closure)
static int enqueue_processing(struct afb_proto_ws *proto, void (*callback)(int signum, void* arg), void *arg)
{
static int enqueue_processing(struct afb_proto_ws *proto, void (*callback)(int signum, void* arg), void *arg)
{
- return jobs_queue(
proto
, 0, callback, arg);
+ return jobs_queue(
NULL /* proto */
, 0, callback, arg);
}
/*****************************************************/
}
/*****************************************************/
@@
-672,7
+673,7
@@
static struct afb_stub_ws *afb_stub_ws_create(struct fdev *fdev, const char *api
{
struct afb_stub_ws *stubws;
{
struct afb_stub_ws *stubws;
- stubws = calloc(1, sizeof *stubws + strlen(apiname));
+ stubws = calloc(1, sizeof *stubws +
1 +
strlen(apiname));
if (stubws == NULL)
errno = ENOMEM;
else {
if (stubws == NULL)
errno = ENOMEM;
else {