diff options
author | dormando <dormando@rydia.net> | 2023-03-04 21:44:24 -0800 |
---|---|---|
committer | dormando <dormando@rydia.net> | 2023-03-26 16:48:37 -0700 |
commit | e0fa1fe46aeb9e405cb58234f6016b2c48a10777 (patch) | |
tree | decf57c8e0a321c6e4094391b32e2d7bfbbfddc4 /proxy.h | |
parent | 923df263b5e34449acee2ce24906653c7d8808e1 (diff) | |
download | memcached-e0fa1fe46aeb9e405cb58234f6016b2c48a10777.tar.gz |
proxy: restrict functions for lua config vs route
Also changes the way the global context and thread contexts are fetched
from lua; via the VM extra space instead of upvalues, which is a little
faster and more universal.
It was always erroneous to run a lot of the config functions from routes
and vice versa, but there was no consistent strictness so users could
get into trouble.
Diffstat (limited to 'proxy.h')
-rw-r--r-- | proxy.h | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -76,10 +76,7 @@ #define ENDSTR "END\r\n" #define ENDLEN sizeof(ENDSTR)-1 -#define MCP_THREAD_UPVALUE 1 -#define MCP_ATTACH_UPVALUE 2 -#define MCP_BACKEND_UPVALUE 3 -#define MCP_CONTEXT_UPVALUE 4 +#define MCP_BACKEND_UPVALUE 1 #define MCP_YIELD_POOL 1 #define MCP_YIELD_AWAIT 2 @@ -217,6 +214,11 @@ typedef struct { pthread_mutex_t stats_lock; // used for rare global counters } proxy_ctx_t; +#define PROXY_GET_THR_CTX(L) ((*(LIBEVENT_THREAD **)lua_getextraspace(L))->proxy_ctx) +#define PROXY_GET_THR(L) (*(LIBEVENT_THREAD **)lua_getextraspace(L)) +// Operations from the config VM don't have a libevent thread. +#define PROXY_GET_CTX(L) (*(proxy_ctx_t **)lua_getextraspace(L)) + struct proxy_hook_tagged { uint64_t tag; int lua_ref; |