aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatarLibravatar daurnimator <quae@daurnimator.com> 2018-05-29 13:09:52 +1000
committerLibravatarLibravatar daurnimator <quae@daurnimator.com> 2018-05-29 13:19:15 +1000
commitc8c895ae4bcb1aed1a65c79b168fecd7eb29f5de (patch)
treefab7196d137889f62cc6f5c4c88d5a0282145dc3
parentbbe0e3538c498c19949991c4ccdc4aa124d5f43e (diff)
downloadluaossl-c8c895ae4bcb1aed1a65c79b168fecd7eb29f5de.tar.gz
luaossl-c8c895ae4bcb1aed1a65c79b168fecd7eb29f5de.tar.bz2
luaossl-c8c895ae4bcb1aed1a65c79b168fecd7eb29f5de.zip
src/openssl.c: cache is no longer just for SSL* pointers
-rw-r--r--src/openssl.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/openssl.c b/src/openssl.c
index feff022..87e0723 100644
--- a/src/openssl.c
+++ b/src/openssl.c
@@ -8942,7 +8942,7 @@ EXPORT int luaopen__openssl_ssl_context(lua_State *L) {
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
static void ssl_push(lua_State *L, SSL *ssl) {
- lua_rawgetp(L, LUA_REGISTRYINDEX, (void *)&ssl_push);
+ lua_rawgetp(L, LUA_REGISTRYINDEX, (void *)&initall);
if (LUA_TNIL == lua_rawgetp(L, -1, ssl)) {
SSL **ud;
@@ -8988,7 +8988,7 @@ static int ssl_new(lua_State *L) {
return auxL_error(L, auxL_EOPENSSL, "ssl.new");
/* Add to SSL* cache */
- lua_rawgetp(L, LUA_REGISTRYINDEX, (void *)&ssl_push);
+ lua_rawgetp(L, LUA_REGISTRYINDEX, (void *)&initall);
lua_pushvalue(L, -2);
lua_rawsetp(L, -2, *ud);
lua_pop(L, 1);
@@ -11107,12 +11107,14 @@ static void initall(lua_State *L) {
auxL_addclass(L, OCSP_RESPONSE_CLASS, or_methods, or_metatable, 0);
auxL_addclass(L, OCSP_BASICRESP_CLASS, ob_methods, ob_metatable, 0);
- /* Create cache for SSL* pointers */
+ /* Create cache for pointers */
lua_newtable(L);
- lua_createtable(L, 0, 1);
+ lua_createtable(L, 0, 2);
lua_pushliteral(L, "kv");
lua_setfield(L, -2, "__mode");
+ lua_pushliteral(L, "luaossl cache");
+ lua_setfield(L, -2, "__name");
lua_setmetatable(L, -2);
- lua_rawsetp(L, LUA_REGISTRYINDEX, (void *)&ssl_push);
+ lua_rawsetp(L, LUA_REGISTRYINDEX, (void *)&initall);
} /* initall() */