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
Add gitbook documentation (support PDF generation).
[src/app-framework-binder.git]
/
src
/
afb-ws-json1.c
diff --git
a/src/afb-ws-json1.c
b/src/afb-ws-json1.c
index
3d1f29d
..
c796b17
100644
(file)
--- a/
src/afb-ws-json1.c
+++ b/
src/afb-ws-json1.c
@@
-25,7
+25,7
@@
#include <json-c/json.h>
#include <json-c/json.h>
-#include <afb/afb-
req
-itf.h>
+#include <afb/afb-
event
-itf.h>
#include "afb-wsj1.h"
#include "afb-ws-json1.h"
#include "afb-wsj1.h"
#include "afb-ws-json1.h"
@@
-129,8
+129,6
@@
struct afb_ws_json1 *afb_ws_json1_create(int fd, struct afb_apiset *apiset, stru
goto error4;
result->cred = afb_cred_create_for_socket(fd);
goto error4;
result->cred = afb_cred_create_for_socket(fd);
- if (!result->cred)
- result->cred = afb_cred_current();
result->apiset = afb_apiset_addref(apiset);
return result;
result->apiset = afb_apiset_addref(apiset);
return result;
@@
-147,13
+145,13
@@
error:
static struct afb_ws_json1 *aws_addref(struct afb_ws_json1 *ws)
{
static struct afb_ws_json1 *aws_addref(struct afb_ws_json1 *ws)
{
-
ws->refcount++
;
+
__atomic_add_fetch(&ws->refcount, 1, __ATOMIC_RELAXED)
;
return ws;
}
static void aws_unref(struct afb_ws_json1 *ws)
{
return ws;
}
static void aws_unref(struct afb_ws_json1 *ws)
{
- if (
--ws->refcount == 0
) {
+ if (
!__atomic_sub_fetch(&ws->refcount, 1, __ATOMIC_RELAXED)
) {
afb_evt_listener_unref(ws->listener);
afb_wsj1_unref(ws->wsj1);
if (ws->cleanup != NULL)
afb_evt_listener_unref(ws->listener);
afb_wsj1_unref(ws->wsj1);
if (ws->cleanup != NULL)