/* 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;
}
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 {
/* 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;
return NULL;
}
-struct afb_session *afb_session_create (const char *uuid, int timeout)
+struct afb_session *afb_session_create (int timeout)
{
time_t now;
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
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);
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);
}