summaryrefslogtreecommitdiffstats
path: root/src/afb-session.c
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2017-11-06 13:10:55 +0100
committerJosé Bollo <jose.bollo@iot.bzh>2017-11-06 13:10:55 +0100
commit79ccbbb1843431c8b4acb3230e82d5cff415c7a4 (patch)
tree6e1d0f8759bfe91b415062d95a36d4075eda737b /src/afb-session.c
parentdbb880d5cfab46eba2a3594521c5847fa74c3b70 (diff)
afb-session: redefine the function 'afb_session_create'
Change-Id: Ib8a66af30ea2438248adb66c9a95ac82663ec223 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/afb-session.c')
-rw-r--r--src/afb-session.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/afb-session.c b/src/afb-session.c
index 77a20fa0..2b649efe 100644
--- a/src/afb-session.c
+++ b/src/afb-session.c
@@ -250,7 +250,7 @@ static struct afb_session *make_session (const char *uuid, int timeout, time_t n
/* generate the uuid */
if (uuid == NULL) {
- new_uuid(session->uuid);
+ do { new_uuid(session->uuid); } while(search(session->uuid));
} else {
if (strlen(uuid) >= sizeof session->uuid) {
errno = EINVAL;
@@ -284,7 +284,7 @@ error:
return NULL;
}
-struct afb_session *afb_session_create (const char *uuid, int timeout)
+struct afb_session *afb_session_create (int timeout)
{
time_t now;
@@ -292,13 +292,7 @@ struct afb_session *afb_session_create (const char *uuid, int timeout)
now = NOW;
cleanup (now);
- /* search for an existing one not too old */
- if (uuid != NULL && search(uuid) != NULL) {
- errno = EEXIST;
- return NULL;
- }
-
- return make_session(uuid, timeout, now);
+ return make_session(NULL, timeout, now);
}
// This function will return exiting session or newly created session