session CHANGE concurrency greatly improved
Enables concurrent polling of a single pollsession
structure and new session creation.
diff --git a/src/session_server_tls.c b/src/session_server_tls.c
index 5708593..cc6e413 100644
--- a/src/session_server_tls.c
+++ b/src/session_server_tls.c
@@ -935,13 +935,13 @@
}
/* LOCK */
- endpt = nc_server_endpt_lock(endpt_name, NC_TI_OPENSSL, NULL);
+ endpt = nc_server_endpt_lock_get(endpt_name, NC_TI_OPENSSL, NULL);
if (!endpt) {
return -1;
}
ret = nc_server_tls_set_server_cert(name, endpt->opts.tls);
/* UNLOCK */
- nc_server_endpt_unlock(endpt);
+ pthread_rwlock_unlock(&server_opts.endpt_lock);
return ret;
}
@@ -1017,13 +1017,13 @@
}
/* LOCK */
- endpt = nc_server_endpt_lock(endpt_name, NC_TI_OPENSSL, NULL);
+ endpt = nc_server_endpt_lock_get(endpt_name, NC_TI_OPENSSL, NULL);
if (!endpt) {
return -1;
}
ret = nc_server_tls_add_trusted_cert_list(name, endpt->opts.tls);
/* UNLOCK */
- nc_server_endpt_unlock(endpt);
+ pthread_rwlock_unlock(&server_opts.endpt_lock);
return ret;
}
@@ -1112,13 +1112,13 @@
}
/* LOCK */
- endpt = nc_server_endpt_lock(endpt_name, NC_TI_OPENSSL, NULL);
+ endpt = nc_server_endpt_lock_get(endpt_name, NC_TI_OPENSSL, NULL);
if (!endpt) {
return -1;
}
ret = nc_server_tls_del_trusted_cert_list(name, endpt->opts.tls);
/* UNLOCK */
- nc_server_endpt_unlock(endpt);
+ pthread_rwlock_unlock(&server_opts.endpt_lock);
return ret;
}
@@ -1185,13 +1185,13 @@
}
/* LOCK */
- endpt = nc_server_endpt_lock(endpt_name, NC_TI_OPENSSL, NULL);
+ endpt = nc_server_endpt_lock_get(endpt_name, NC_TI_OPENSSL, NULL);
if (!endpt) {
return -1;
}
ret = nc_server_tls_set_trusted_ca_paths(ca_file, ca_dir, endpt->opts.tls);
/* UNLOCK */
- nc_server_endpt_unlock(endpt);
+ pthread_rwlock_unlock(&server_opts.endpt_lock);
return ret;
}
@@ -1279,13 +1279,13 @@
}
/* LOCK */
- endpt = nc_server_endpt_lock(endpt_name, NC_TI_OPENSSL, NULL);
+ endpt = nc_server_endpt_lock_get(endpt_name, NC_TI_OPENSSL, NULL);
if (!endpt) {
return -1;
}
ret = nc_server_tls_set_crl_paths(crl_file, crl_dir, endpt->opts.tls);
/* UNLOCK */
- nc_server_endpt_unlock(endpt);
+ pthread_rwlock_unlock(&server_opts.endpt_lock);
return ret;
}
@@ -1337,13 +1337,13 @@
}
/* LOCK */
- endpt = nc_server_endpt_lock(endpt_name, NC_TI_OPENSSL, NULL);
+ endpt = nc_server_endpt_lock_get(endpt_name, NC_TI_OPENSSL, NULL);
if (!endpt) {
return;
}
nc_server_tls_clear_crls(endpt->opts.tls);
/* UNLOCK */
- nc_server_endpt_unlock(endpt);
+ pthread_rwlock_unlock(&server_opts.endpt_lock);
}
API void
@@ -1440,13 +1440,13 @@
}
/* LOCK */
- endpt = nc_server_endpt_lock(endpt_name, NC_TI_OPENSSL, NULL);
+ endpt = nc_server_endpt_lock_get(endpt_name, NC_TI_OPENSSL, NULL);
if (!endpt) {
return -1;
}
ret = nc_server_tls_add_ctn(id, fingerprint, map_type, name, endpt->opts.tls);
/* UNLOCK */
- nc_server_endpt_unlock(endpt);
+ pthread_rwlock_unlock(&server_opts.endpt_lock);
return ret;
}
@@ -1542,13 +1542,13 @@
}
/* LOCK */
- endpt = nc_server_endpt_lock(endpt_name, NC_TI_OPENSSL, NULL);
+ endpt = nc_server_endpt_lock_get(endpt_name, NC_TI_OPENSSL, NULL);
if (!endpt) {
return -1;
}
ret = nc_server_tls_del_ctn(id, fingerprint, map_type, name, endpt->opts.tls);
/* UNLOCK */
- nc_server_endpt_unlock(endpt);
+ pthread_rwlock_unlock(&server_opts.endpt_lock);
return ret;
}
@@ -1634,13 +1634,13 @@
}
/* LOCK */
- endpt = nc_server_endpt_lock(endpt_name, NC_TI_OPENSSL, NULL);
+ endpt = nc_server_endpt_lock_get(endpt_name, NC_TI_OPENSSL, NULL);
if (!endpt) {
return -1;
}
ret = nc_server_tls_get_ctn(id, fingerprint, map_type, name, endpt->opts.tls);
/* UNLOCK */
- nc_server_endpt_unlock(endpt);
+ pthread_rwlock_unlock(&server_opts.endpt_lock);
return ret;
}