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 .gitreview defaultbranch for eel
[src/app-framework-binder.git]
/
src
/
afb-session.c
diff --git
a/src/afb-session.c
b/src/afb-session.c
index
1cb1d8d
..
6b6ad63
100644
(file)
--- a/
src/afb-session.c
+++ b/
src/afb-session.c
@@
-57,6
+57,7
@@
struct afb_session
time_t expiration; // expiration time of the token
pthread_mutex_t mutex;
struct cookie *cookies[COOKEYCOUNT];
time_t expiration; // expiration time of the token
pthread_mutex_t mutex;
struct cookie *cookies[COOKEYCOUNT];
+ char autoclose;
char idx;
char uuid[SIZEUUID]; // long term authentication of remote client
char token[SIZEUUID]; // short term authentication of remote client
char idx;
char uuid[SIZEUUID]; // long term authentication of remote client
char token[SIZEUUID]; // short term authentication of remote client
@@
-358,7
+359,7
@@
void afb_session_unref(struct afb_session *session)
assert(session->refcount != 0);
if (!__atomic_sub_fetch(&session->refcount, 1, __ATOMIC_RELAXED)) {
pthread_mutex_lock(&session->mutex);
assert(session->refcount != 0);
if (!__atomic_sub_fetch(&session->refcount, 1, __ATOMIC_RELAXED)) {
pthread_mutex_lock(&session->mutex);
- if (session->uuid[0] == 0)
+ if (session->
autoclose || session->
uuid[0] == 0)
destroy (session);
else
pthread_mutex_unlock(&session->mutex);
destroy (session);
else
pthread_mutex_unlock(&session->mutex);
@@
-383,6
+384,13
@@
void afb_session_close (struct afb_session *session)
pthread_mutex_unlock(&session->mutex);
}
pthread_mutex_unlock(&session->mutex);
}
+/* set the autoclose flag */
+void afb_session_set_autoclose(struct afb_session *session, int autoclose)
+{
+ assert(session != NULL);
+ session->autoclose = (char)!!autoclose;
+}
+
// is the session active?
int afb_session_is_active (struct afb_session *session)
{
// is the session active?
int afb_session_is_active (struct afb_session *session)
{