session CHANGE print caller in mutex lock fail

Conflicts:
	src/session_p.h
diff --git a/src/session.c b/src/session.c
index c04d74d..6456eba 100644
--- a/src/session.c
+++ b/src/session.c
@@ -104,7 +104,7 @@
  *        -1 - error
  */
 int
-nc_timedlock(pthread_mutex_t *lock, int timeout)
+nc_timedlock(pthread_mutex_t *lock, int timeout, const char *func)
 {
     int ret;
     struct timespec ts_timeout;
@@ -127,7 +127,7 @@
         return 0;
     } else if (ret) {
         /* error */
-        ERR("Mutex lock failed (%s).", strerror(ret));
+        ERR("Mutex lock failed (%s, %s).", func, strerror(ret));
         return -1;
     }
 
@@ -294,7 +294,7 @@
     }
 
     if (session->ti_lock) {
-        r = nc_timedlock(session->ti_lock, NC_READ_TIMEOUT * 1000);
+        r = nc_timedlock(session->ti_lock, NC_READ_TIMEOUT * 1000, __func__);
         if (r == -1) {
             return;
         } else if (!r) {
diff --git a/src/session_client.c b/src/session_client.c
index c4872cd..22cdca7 100644
--- a/src/session_client.c
+++ b/src/session_client.c
@@ -497,7 +497,7 @@
     struct nc_msg_cont *cont, **cont_ptr;
     NC_MSG_TYPE msgtype = 0; /* NC_MSG_ERROR */
 
-    r = nc_timedlock(session->ti_lock, timeout);
+    r = nc_timedlock(session->ti_lock, timeout, __func__);
     if (r == -1) {
         /* error */
         return NC_MSG_ERROR;
@@ -1805,7 +1805,7 @@
         return NC_MSG_ERROR;
     }
 
-    ret = nc_timedlock(session->ti_lock, timeout);
+    ret = nc_timedlock(session->ti_lock, timeout, __func__);
     if (ret == -1) {
         /* error */
         r = NC_MSG_ERROR;
diff --git a/src/session_p.h b/src/session_p.h
index 09936a8..bb662ae 100644
--- a/src/session_p.h
+++ b/src/session_p.h
@@ -317,7 +317,7 @@
 
 int nc_gettimespec(struct timespec *ts);
 
-int nc_timedlock(pthread_mutex_t *lock, int timeout);
+int nc_timedlock(pthread_mutex_t *lock, int timeout, const char *func);
 
 int nc_ps_lock(struct nc_pollsession *ps, uint8_t *id, const char *func);
 
diff --git a/src/session_server.c b/src/session_server.c
index 0de6b1a..6dc5740 100644
--- a/src/session_server.c
+++ b/src/session_server.c
@@ -1146,7 +1146,7 @@
     }
 
     /* reading an RPC and sending a reply must be atomic (no other RPC should be read) */
-    ret = nc_timedlock(cur_session->ti_lock, timeout);
+    ret = nc_timedlock(cur_session->ti_lock, timeout, __func__);
     if (ret < 0) {
         ret = NC_PSPOLL_ERROR;
         goto finish;
diff --git a/src/session_server_ssh.c b/src/session_server_ssh.c
index a79b095..86929c2 100644
--- a/src/session_server_ssh.c
+++ b/src/session_server_ssh.c
@@ -973,7 +973,7 @@
             return -1;
         }
 
-        ret = nc_timedlock(session->ti_lock, timeout);
+        ret = nc_timedlock(session->ti_lock, timeout, __func__);
         if (ret != 1) {
             return ret;
         }
@@ -1015,7 +1015,7 @@
             return -1;
         }
 
-        ret = nc_timedlock(session->ti_lock, timeout);
+        ret = nc_timedlock(session->ti_lock, timeout, __func__);
         if (ret != 1) {
             return ret;
         }
@@ -1053,7 +1053,7 @@
     int ret;
     struct nc_session *new;
 
-    ret = nc_timedlock(session->ti_lock, timeout);
+    ret = nc_timedlock(session->ti_lock, timeout, __func__);
 
     if (ret < 0) {
         return NC_PSPOLL_ERROR;