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
ensure that the copy is done by libmicrohttp
[src/app-framework-binder.git]
/
src
/
session.c
diff --git
a/src/session.c
b/src/session.c
index
3e08808
..
ae44f79
100644
(file)
--- a/
src/session.c
+++ b/
src/session.c
@@
-25,6
+25,8
@@
#include <assert.h>
#include <errno.h>
#include <assert.h>
#include <errno.h>
+#include <json.h>
+
#include "session.h"
#define NOW (time(NULL))
#include "session.h"
#define NOW (time(NULL))
@@
-290,18
+292,18
@@
void ctxTokenNew (struct AFB_clientCtx *clientCtx)
clientCtx->expiration = NOW + sessions.timeout;
}
clientCtx->expiration = NOW + sessions.timeout;
}
-struct afb_event_
send
er_list
+struct afb_event_
listen
er_list
{
{
- struct afb_event_
send
er_list *next;
- struct afb_event_
sender send
er;
+ struct afb_event_
listen
er_list *next;
+ struct afb_event_
listener listen
er;
int refcount;
};
int refcount;
};
-int ctxClientEvent
SenderAdd(struct AFB_clientCtx *clientCtx, struct afb_event_sender send
er)
+int ctxClientEvent
ListenerAdd(struct AFB_clientCtx *clientCtx, struct afb_event_listener listen
er)
{
{
- struct afb_event_
send
er_list *iter, **prv;
+ struct afb_event_
listen
er_list *iter, **prv;
- prv = &clientCtx->
send
ers;
+ prv = &clientCtx->
listen
ers;
for (;;) {
iter = *prv;
if (iter == NULL) {
for (;;) {
iter = *prv;
if (iter == NULL) {
@@
-310,12
+312,12
@@
int ctxClientEventSenderAdd(struct AFB_clientCtx *clientCtx, struct afb_event_se
errno = ENOMEM;
return -1;
}
errno = ENOMEM;
return -1;
}
- iter->
sender = send
er;
+ iter->
listener = listen
er;
iter->refcount = 1;
*prv = iter;
return 0;
}
iter->refcount = 1;
*prv = iter;
return 0;
}
- if (iter->
sender.itf == sender.itf && iter->sender.closure == send
er.closure) {
+ if (iter->
listener.itf == listener.itf && iter->listener.closure == listen
er.closure) {
iter->refcount++;
return 0;
}
iter->refcount++;
return 0;
}
@@
-323,16
+325,16
@@
int ctxClientEventSenderAdd(struct AFB_clientCtx *clientCtx, struct afb_event_se
}
}
}
}
-void ctxClientEvent
SenderRemove(struct AFB_clientCtx *clientCtx, struct afb_event_sender send
er)
+void ctxClientEvent
ListenerRemove(struct AFB_clientCtx *clientCtx, struct afb_event_listener listen
er)
{
{
- struct afb_event_
send
er_list *iter, **prv;
+ struct afb_event_
listen
er_list *iter, **prv;
- prv = &clientCtx->
send
ers;
+ prv = &clientCtx->
listen
ers;
for (;;) {
iter = *prv;
if (iter == NULL)
return;
for (;;) {
iter = *prv;
if (iter == NULL)
return;
- if (iter->
sender.itf == sender.itf && iter->sender.closure == send
er.closure) {
+ if (iter->
listener.itf == listener.itf && iter->listener.closure == listen
er.closure) {
if (!--iter->refcount) {
*prv = iter->next;
free(iter);
if (!--iter->refcount) {
*prv = iter->next;
free(iter);
@@
-345,13
+347,13
@@
void ctxClientEventSenderRemove(struct AFB_clientCtx *clientCtx, struct afb_even
static int send(struct AFB_clientCtx *clientCtx, const char *event, struct json_object *object)
{
static int send(struct AFB_clientCtx *clientCtx, const char *event, struct json_object *object)
{
- struct afb_event_
send
er_list *iter;
+ struct afb_event_
listen
er_list *iter;
int result;
result = 0;
int result;
result = 0;
- iter = clientCtx->
send
ers;
+ iter = clientCtx->
listen
ers;
while (iter != NULL) {
while (iter != NULL) {
- iter->
sender.itf->send(iter->sender.closure, event, object
);
+ iter->
listener.itf->send(iter->listener.closure, event, json_object_get(object)
);
result++;
iter = iter->next;
}
result++;
iter = iter->next;
}