summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/afb-export.c4
-rw-r--r--src/afb-session.c12
-rw-r--r--src/afb-session.h2
-rw-r--r--src/main.c2
4 files changed, 7 insertions, 13 deletions
diff --git a/src/afb-export.c b/src/afb-export.c
index ea783b8b..3a898bbe 100644
--- a/src/afb-export.c
+++ b/src/afb-export.c
@@ -1072,7 +1072,7 @@ static struct afb_export *create(struct afb_apiset *apiset, const char *apiname,
/* session shared with other exports */
if (common_session == NULL) {
- common_session = afb_session_create (NULL, 0);
+ common_session = afb_session_create (0);
if (common_session == NULL)
return NULL;
}
@@ -1181,7 +1181,7 @@ struct afb_binding_interface_v1 *afb_export_get_interface_v1(struct afb_export *
int afb_export_unshare_session(struct afb_export *export)
{
if (export->session == common_session) {
- export->session = afb_session_create (NULL, 0);
+ export->session = afb_session_create (0);
if (export->session)
afb_session_unref(common_session);
else {
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
diff --git a/src/afb-session.h b/src/afb-session.h
index b5dc3944..c76d6769 100644
--- a/src/afb-session.h
+++ b/src/afb-session.h
@@ -22,7 +22,7 @@ struct afb_session;
extern void afb_session_init(int max_session_count, int timeout, const char *initok);
extern const char *afb_session_initial_token();
-extern struct afb_session *afb_session_create (const char *uuid, int timeout);
+extern struct afb_session *afb_session_create (int timeout);
extern struct afb_session *afb_session_get (const char *uuid, int *created);
extern const char *afb_session_uuid (struct afb_session *session);
diff --git a/src/main.c b/src/main.c
index b5b00234..150b7810 100644
--- a/src/main.c
+++ b/src/main.c
@@ -525,7 +525,7 @@ static void run_startup_calls()
list = config->calls;
if (list) {
sreq = calloc(1, sizeof *sreq);
- sreq->session = afb_session_create("startup", 3600);
+ sreq->session = afb_session_create(3600);
sreq->current = list;
startup_call_current(sreq);
}