session CHANGE concurrency greatly improved

Enables concurrent polling of a single pollsession
structure and new session creation.
diff --git a/src/session_client_tls.c b/src/session_client_tls.c
index b845ba1..f6435b1 100644
--- a/src/session_client_tls.c
+++ b/src/session_client_tls.c
@@ -597,7 +597,7 @@
     }
 
     /* prepare session structure */
-    session = calloc(1, sizeof *session);
+    session = nc_new_session(0);
     if (!session) {
         ERRMEM;
         return NULL;
@@ -606,12 +606,9 @@
     session->side = NC_CLIENT;
 
     /* transport lock */
-    session->ti_lock = malloc(sizeof *session->ti_lock);
-    if (!session->ti_lock) {
-        ERRMEM;
-        goto fail;
-    }
     pthread_mutex_init(session->ti_lock, NULL);
+    pthread_cond_init(session->ti_cond, NULL);
+    *session->ti_inuse = 0;
 
     /* fill the session */
     session->ti_type = NC_TI_OPENSSL;
@@ -721,7 +718,7 @@
     }
 
     /* prepare session structure */
-    session = calloc(1, sizeof *session);
+    session = nc_new_session(0);
     if (!session) {
         ERRMEM;
         return NULL;
@@ -730,12 +727,9 @@
     session->side = NC_CLIENT;
 
     /* transport lock */
-    session->ti_lock = malloc(sizeof *session->ti_lock);
-    if (!session->ti_lock) {
-        ERRMEM;
-        goto fail;
-    }
     pthread_mutex_init(session->ti_lock, NULL);
+    pthread_cond_init(session->ti_cond, NULL);
+    *session->ti_inuse = 0;
 
     session->ti_type = NC_TI_OPENSSL;
     session->ti.tls = tls;