@@ -77,8 +77,7 @@ static void ngx_http_lua_pipe_resume_write_handler(ngx_event_t *ev);
77
77
static void ngx_http_lua_pipe_resume_wait_handler (ngx_event_t * ev );
78
78
static ngx_int_t ngx_http_lua_pipe_resume (ngx_http_request_t * r );
79
79
static void ngx_http_lua_pipe_dummy_event_handler (ngx_event_t * ev );
80
- static void ngx_http_lua_pipe_cleanup_helper (
81
- ngx_http_lua_co_ctx_t * wait_co_ctx );
80
+ static void ngx_http_lua_pipe_clear_event (ngx_event_t * ev );
82
81
static void ngx_http_lua_pipe_proc_read_stdout_cleanup (void * data );
83
82
static void ngx_http_lua_pipe_proc_read_stderr_cleanup (void * data );
84
83
static void ngx_http_lua_pipe_proc_write_cleanup (void * data );
@@ -2217,19 +2216,7 @@ ngx_http_lua_pipe_resume_helper(ngx_event_t *ev,
2217
2216
ev -> timedout = 0 ;
2218
2217
}
2219
2218
2220
- if (ev -> timer_set ) {
2221
- ngx_log_debug1 (NGX_LOG_DEBUG_HTTP , ev -> log , 0 ,
2222
- "lua pipe del timer for ev:%p" , ev );
2223
- ngx_del_timer (ev );
2224
- }
2225
-
2226
- if (ev -> posted ) {
2227
- ngx_log_debug1 (NGX_LOG_DEBUG_HTTP , ev -> log , 0 ,
2228
- "lua pipe del posted event for ev:%p" , ev );
2229
- ngx_delete_posted_event (ev );
2230
- }
2231
-
2232
- ev -> handler = ngx_http_lua_pipe_dummy_event_handler ;
2219
+ ngx_http_lua_pipe_clear_event (ev );
2233
2220
2234
2221
r = ngx_http_lua_get_req (wait_co_ctx -> co );
2235
2222
c = r -> connection ;
@@ -2377,15 +2364,21 @@ ngx_http_lua_pipe_dummy_event_handler(ngx_event_t *ev)
2377
2364
2378
2365
2379
2366
static void
2380
- ngx_http_lua_pipe_cleanup_helper ( ngx_http_lua_co_ctx_t * wait_co_ctx )
2367
+ ngx_http_lua_pipe_clear_event ( ngx_event_t * ev )
2381
2368
{
2382
- if (wait_co_ctx -> sleep .timer_set ) {
2383
- ngx_log_debug1 (NGX_LOG_DEBUG_HTTP , wait_co_ctx -> sleep .log , 0 ,
2384
- "lua pipe del timer for ev:%p" , & wait_co_ctx -> sleep );
2385
- ngx_del_timer (& wait_co_ctx -> sleep );
2369
+ ev -> handler = ngx_http_lua_pipe_dummy_event_handler ;
2370
+
2371
+ if (ev -> timer_set ) {
2372
+ ngx_log_debug1 (NGX_LOG_DEBUG_HTTP , ev -> log , 0 ,
2373
+ "lua pipe del timer for ev:%p" , ev );
2374
+ ngx_del_timer (ev );
2386
2375
}
2387
2376
2388
- wait_co_ctx -> cleanup = NULL ;
2377
+ if (ev -> posted ) {
2378
+ ngx_log_debug1 (NGX_LOG_DEBUG_HTTP , ev -> log , 0 ,
2379
+ "lua pipe del posted event for ev:%p" , ev );
2380
+ ngx_delete_posted_event (ev );
2381
+ }
2389
2382
}
2390
2383
2391
2384
@@ -2404,10 +2397,10 @@ ngx_http_lua_pipe_proc_read_stdout_cleanup(void *data)
2404
2397
c = proc -> pipe -> stdout_ctx -> c ;
2405
2398
if (c ) {
2406
2399
rev = c -> read ;
2407
- rev -> handler = ngx_http_lua_pipe_dummy_event_handler ;
2400
+ ngx_http_lua_pipe_clear_event ( rev ) ;
2408
2401
}
2409
2402
2410
- ngx_http_lua_pipe_cleanup_helper ( wait_co_ctx ) ;
2403
+ wait_co_ctx -> cleanup = NULL ;
2411
2404
}
2412
2405
2413
2406
@@ -2426,10 +2419,10 @@ ngx_http_lua_pipe_proc_read_stderr_cleanup(void *data)
2426
2419
c = proc -> pipe -> stderr_ctx -> c ;
2427
2420
if (c ) {
2428
2421
rev = c -> read ;
2429
- rev -> handler = ngx_http_lua_pipe_dummy_event_handler ;
2422
+ ngx_http_lua_pipe_clear_event ( rev ) ;
2430
2423
}
2431
2424
2432
- ngx_http_lua_pipe_cleanup_helper ( wait_co_ctx ) ;
2425
+ wait_co_ctx -> cleanup = NULL ;
2433
2426
}
2434
2427
2435
2428
@@ -2448,10 +2441,10 @@ ngx_http_lua_pipe_proc_write_cleanup(void *data)
2448
2441
c = proc -> pipe -> stdin_ctx -> c ;
2449
2442
if (c ) {
2450
2443
wev = c -> write ;
2451
- wev -> handler = ngx_http_lua_pipe_dummy_event_handler ;
2444
+ ngx_http_lua_pipe_clear_event ( wev ) ;
2452
2445
}
2453
2446
2454
- ngx_http_lua_pipe_cleanup_helper ( wait_co_ctx ) ;
2447
+ wait_co_ctx -> cleanup = NULL ;
2455
2448
}
2456
2449
2457
2450
@@ -2471,14 +2464,9 @@ ngx_http_lua_pipe_proc_wait_cleanup(void *data)
2471
2464
pipe_node = (ngx_http_lua_pipe_node_t * ) & node -> color ;
2472
2465
pipe_node -> wait_co_ctx = NULL ;
2473
2466
2474
- if (wait_co_ctx -> sleep .posted ) {
2475
- ngx_log_debug1 (NGX_LOG_DEBUG_HTTP , ngx_cycle -> log , 0 ,
2476
- "lua pipe del posted event for ev:%p" ,
2477
- & wait_co_ctx -> sleep );
2478
- ngx_delete_posted_event (& wait_co_ctx -> sleep );
2479
- }
2467
+ ngx_http_lua_pipe_clear_event (& wait_co_ctx -> sleep );
2480
2468
2481
- ngx_http_lua_pipe_cleanup_helper ( wait_co_ctx ) ;
2469
+ wait_co_ctx -> cleanup = NULL ;
2482
2470
}
2483
2471
2484
2472
0 commit comments