Skip to content

Commit d8b408a

Browse files
timebugdoujiang24
authored andcommitted
bugfix: build error with nginx 1.7.4 or older version
1 parent 2d82f07 commit d8b408a

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

src/ngx_http_lua_sleep.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,20 @@ ngx_http_lua_sleep_cleanup(void *data)
159159
}
160160

161161
#ifdef HAVE_POSTED_DELAYED_EVENTS_PATCH
162+
#if (nginx_version >= 1007005)
162163
if (coctx->sleep.posted) {
164+
#else
165+
if (coctx->sleep.prev) {
166+
#endif
163167
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, ngx_cycle->log, 0,
164168
"lua clean up the posted event for pending ngx.sleep");
165169

166-
ngx_delete_posted_event(&coctx->sleep);
170+
/*
171+
* We need the extra parentheses around the argument
172+
* of ngx_delete_posted_event() just to work around macro issues in
173+
* nginx cores older than 1.7.5 (exclusive).
174+
*/
175+
ngx_delete_posted_event((&coctx->sleep));
167176
}
168177
#endif
169178
}

src/ngx_http_lua_socket_tcp.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6024,8 +6024,17 @@ ngx_http_lua_tcp_queue_conn_op_cleanup(void *data)
60246024
"lua tcp socket abort queueing, conn_op_ctx: %p, u: %p",
60256025
conn_op_ctx, u);
60266026

6027+
#if (nginx_version >= 1007005)
60276028
if (conn_op_ctx->event.posted) {
6028-
ngx_delete_posted_event(&conn_op_ctx->event);
6029+
#else
6030+
if (conn_op_ctx->event.prev) {
6031+
#endif
6032+
/*
6033+
* We need the extra parentheses around the argument
6034+
* of ngx_delete_posted_event() just to work around macro issues in
6035+
* nginx cores older than 1.7.5 (exclusive).
6036+
*/
6037+
ngx_delete_posted_event((&conn_op_ctx->event));
60296038

60306039
} else if (conn_op_ctx->event.timer_set) {
60316040
ngx_del_timer(&conn_op_ctx->event);

0 commit comments

Comments
 (0)