MINOR: shctx: rename lock functions
Rename lock functions to shctx_lock() and shctx_unlock() to be coherent
with the new API.
diff --git a/include/proto/shctx.h b/include/proto/shctx.h
index 2e72451..55cb2a7 100644
--- a/include/proto/shctx.h
+++ b/include/proto/shctx.h
@@ -45,25 +45,25 @@
#if defined (USE_PRIVATE_CACHE)
-#define shared_context_lock(shctx)
-#define shared_context_unlock(shctx)
+#define shctx_lock(shctx)
+#define shctx_unlock(shctx)
#elif defined (USE_PTHREAD_PSHARED)
extern int use_shared_mem;
-#define shared_context_lock(shctx) if (use_shared_mem) pthread_mutex_lock(&shctx->mutex)
-#define shared_context_unlock(shctx) if (use_shared_mem) pthread_mutex_unlock(&shctx->mutex)
+#define shctx_lock(shctx) if (use_shared_mem) pthread_mutex_lock(&shctx->mutex)
+#define shctx_unlock(shctx) if (use_shared_mem) pthread_mutex_unlock(&shctx->mutex)
#else
extern int use_shared_mem;
#ifdef USE_SYSCALL_FUTEX
-static inline void _shared_context_wait4lock(unsigned int *count, unsigned int *uaddr, int value)
+static inline void _shctx_wait4lock(unsigned int *count, unsigned int *uaddr, int value)
{
syscall(SYS_futex, uaddr, FUTEX_WAIT, value, NULL, 0, 0);
}
-static inline void _shared_context_awakelocker(unsigned int *uaddr)
+static inline void _shctx_awakelocker(unsigned int *uaddr)
{
syscall(SYS_futex, uaddr, FUTEX_WAKE, 1, NULL, 0, 0);
}
@@ -82,7 +82,7 @@
}
#endif
-static inline void _shared_context_wait4lock(unsigned int *count, unsigned int *uaddr, int value)
+static inline void _shctx_wait4lock(unsigned int *count, unsigned int *uaddr, int value)
{
int i;
@@ -93,7 +93,7 @@
*count = *count << 1;
}
-#define _shared_context_awakelocker(a)
+#define _shctx_awakelocker(a)
#endif
@@ -147,7 +147,7 @@
#endif
-static inline void _shared_context_lock(struct shared_context *shctx)
+static inline void _shctx_lock(struct shared_context *shctx)
{
unsigned int x;
unsigned int count = 4;
@@ -158,23 +158,23 @@
x = xchg(&shctx->waiters, 2);
while (x) {
- _shared_context_wait4lock(&count, &shctx->waiters, 2);
+ _shctx_wait4lock(&count, &shctx->waiters, 2);
x = xchg(&shctx->waiters, 2);
}
}
}
-static inline void _shared_context_unlock(struct shared_context *shctx)
+static inline void _shctx_unlock(struct shared_context *shctx)
{
if (atomic_dec(&shctx->waiters)) {
shctx->waiters = 0;
- _shared_context_awakelocker(&shctx->waiters);
+ _shctx_awakelocker(&shctx->waiters);
}
}
-#define shared_context_lock(shctx) if (use_shared_mem) _shared_context_lock(shctx)
+#define shctx_lock(shctx) if (use_shared_mem) _shctx_lock(shctx)
-#define shared_context_unlock(shctx) if (use_shared_mem) _shared_context_unlock(shctx)
+#define shctx_unlock(shctx) if (use_shared_mem) _shctx_unlock(shctx)
#endif
diff --git a/src/ssl_sock.c b/src/ssl_sock.c
index 09e27b3..13d9526 100644
--- a/src/ssl_sock.c
+++ b/src/ssl_sock.c
@@ -3821,10 +3821,10 @@
if (sid_length < SSL_MAX_SSL_SESSION_ID_LENGTH)
memset(encid + sid_length, 0, SSL_MAX_SSL_SESSION_ID_LENGTH-sid_length);
- shared_context_lock(ssl_shctx);
+ shctx_lock(ssl_shctx);
/* store to cache */
sh_ssl_sess_store(encid, encsess, data_len);
- shared_context_unlock(ssl_shctx);
+ shctx_unlock(ssl_shctx);
err:
/* reset original length values */
SSL_SESSION_set1_id(sess, sid_data, sid_length);
@@ -3855,13 +3855,13 @@
}
/* lock cache */
- shared_context_lock(ssl_shctx);
+ shctx_lock(ssl_shctx);
/* lookup for session */
sh_ssl_sess = sh_ssl_sess_tree_lookup(key);
if (!sh_ssl_sess) {
/* no session found: unlock cache and exit */
- shared_context_unlock(ssl_shctx);
+ shctx_unlock(ssl_shctx);
global.shctx_misses++;
return NULL;
}
@@ -3871,7 +3871,7 @@
shctx_row_data_get(ssl_shctx, first, data, sizeof(struct sh_ssl_sess_hdr), first->len-sizeof(struct sh_ssl_sess_hdr));
- shared_context_unlock(ssl_shctx);
+ shctx_unlock(ssl_shctx);
/* decode ASN1 session */
p = data;
@@ -3903,7 +3903,7 @@
sid_data = tmpkey;
}
- shared_context_lock(ssl_shctx);
+ shctx_lock(ssl_shctx);
/* lookup for session */
sh_ssl_sess = sh_ssl_sess_tree_lookup(sid_data);
@@ -3913,7 +3913,7 @@
}
/* unlock cache */
- shared_context_unlock(ssl_shctx);
+ shctx_unlock(ssl_shctx);
}
/* Set session cache mode to server and disable openssl internal cache.