server session BUGFIX lock fixes and optimizations
diff --git a/src/session_server_ssh.c b/src/session_server_ssh.c
index a04de3b..0bb4d4b 100644
--- a/src/session_server_ssh.c
+++ b/src/session_server_ssh.c
@@ -100,11 +100,13 @@
     int ret;
     struct nc_endpt *endpt;
 
+    /* LOCK */
     endpt = nc_server_endpt_lock(endpt_name, NC_TI_LIBSSH);
     if (!endpt) {
         return -1;
     }
     ret = nc_server_ssh_set_hostkey(privkey_path, endpt->ti_opts);
+    /* UNLOCK */
     nc_server_endpt_unlock(endpt);
 
     return ret;
@@ -151,11 +153,13 @@
     int ret;
     struct nc_endpt *endpt;
 
+    /* LOCK */
     endpt = nc_server_endpt_lock(endpt_name, NC_TI_LIBSSH);
     if (!endpt) {
         return -1;
     }
     ret = nc_server_ssh_set_banner(banner, endpt->ti_opts);
+    /* UNLOCK */
     nc_server_endpt_unlock(endpt);
 
     return ret;
@@ -194,11 +198,13 @@
     int ret;
     struct nc_endpt *endpt;
 
+    /* LOCK */
     endpt = nc_server_endpt_lock(endpt_name, NC_TI_LIBSSH);
     if (!endpt) {
         return -1;
     }
     ret = nc_server_ssh_set_auth_methods(auth_methods, endpt->ti_opts);
+    /* UNLOCK */
     nc_server_endpt_unlock(endpt);
 
     return ret;
@@ -236,11 +242,13 @@
     int ret;
     struct nc_endpt *endpt;
 
+    /* LOCK */
     endpt = nc_server_endpt_lock(endpt_name, NC_TI_LIBSSH);
     if (!endpt) {
         return -1;
     }
     ret = nc_server_ssh_set_auth_attempts(auth_attempts, endpt->ti_opts);
+    /* UNLOCK */
     nc_server_endpt_unlock(endpt);
 
     return ret;
@@ -278,11 +286,13 @@
     int ret;
     struct nc_endpt *endpt;
 
+    /* LOCK */
     endpt = nc_server_endpt_lock(endpt_name, NC_TI_LIBSSH);
     if (!endpt) {
         return -1;
     }
     ret = nc_server_ssh_set_auth_timeout(auth_timeout, endpt->ti_opts);
+    /* UNLOCK */
     nc_server_endpt_unlock(endpt);
 
     return ret;
@@ -327,11 +337,13 @@
     int ret;
     struct nc_endpt *endpt;
 
+    /* LOCK */
     endpt = nc_server_endpt_lock(endpt_name, NC_TI_LIBSSH);
     if (!endpt) {
         return -1;
     }
     ret = nc_server_ssh_add_authkey(pubkey_path, username, endpt->ti_opts);
+    /* UNLOCK */
     nc_server_endpt_unlock(endpt);
 
     return ret;
@@ -400,11 +412,13 @@
     int ret;
     struct nc_endpt *endpt;
 
+    /* LOCK */
     endpt = nc_server_endpt_lock(endpt_name, NC_TI_LIBSSH);
     if (!endpt) {
         return -1;
     }
     ret = nc_server_ssh_del_authkey(pubkey_path, username, endpt->ti_opts);
+    /* UNLOCK */
     nc_server_endpt_unlock(endpt);
 
     return ret;