Skip to content

Commit 545efef

Browse files
committed
synchronized with lua-nginx-module #08a9baa.
bugfix: ngx.process: process.type() didn't return 'master' in master process. Thanks spacewander for the upstream patch.
1 parent 6fa77b8 commit 545efef

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/subsys/ngx_subsys_lua_worker.c.tt2

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,8 @@ ngx_[% subsys %]_lua_ffi_master_pid(void)
153153
int
154154
ngx_[% subsys %]_lua_ffi_get_process_type(void)
155155
{
156+
ngx_core_conf_t *ccf;
157+
156158
#if defined(HAVE_PRIVILEGED_PROCESS_PATCH) && !NGX_WIN32
157159
if (ngx_process == NGX_PROCESS_HELPER) {
158160
if (ngx_is_privileged_agent) {
@@ -161,6 +163,15 @@ ngx_[% subsys %]_lua_ffi_get_process_type(void)
161163
}
162164
#endif
163165

166+
if (ngx_process == NGX_PROCESS_SINGLE) {
167+
ccf = (ngx_core_conf_t *) ngx_get_conf(ngx_cycle->conf_ctx,
168+
ngx_core_module);
169+
170+
if (ccf->master) {
171+
return NGX_PROCESS_MASTER;
172+
}
173+
}
174+
164175
return ngx_process;
165176
}
166177

0 commit comments

Comments
 (0)