@@ -335,10 +335,10 @@ ngx_http_check_begin_handler(ngx_event_t *event)
335
335
336
336
ngx_add_timer (event , ucscf -> check_interval /2 );
337
337
338
- /* This process is processing the event now. */
339
- if (peer -> shm -> owner == ngx_pid ) {
340
- return ;
341
- }
338
+ /* This process is processing this peer now. */
339
+ if (( peer -> shm -> owner == ngx_pid ) ||
340
+ ( peer -> pc . connection != NULL ) ||
341
+ ( peer -> check_timeout_ev . timer_set )) {
342
342
343
343
interval = ngx_current_msec - peer -> shm -> access_time ;
344
344
ngx_log_debug5 (NGX_LOG_DEBUG_HTTP , event -> log , 0 ,
@@ -1223,11 +1223,14 @@ ngx_http_check_clean_event(ngx_http_check_peer_t *peer)
1223
1223
1224
1224
c = peer -> pc .connection ;
1225
1225
1226
- ngx_log_debug2 (NGX_LOG_DEBUG_HTTP , c -> log , 0 ,
1227
- "http check clean event: index:%ui, fd: %d" ,
1228
- peer -> index , c -> fd );
1226
+ if (c ) {
1227
+ ngx_log_debug2 (NGX_LOG_DEBUG_HTTP , c -> log , 0 ,
1228
+ "http check clean event: index:%ui, fd: %d" ,
1229
+ peer -> index , c -> fd );
1229
1230
1230
- ngx_close_connection (c );
1231
+ ngx_close_connection (c );
1232
+ peer -> pc .connection = NULL ;
1233
+ }
1231
1234
1232
1235
if (peer -> check_timeout_ev .timer_set ) {
1233
1236
ngx_del_timer (& peer -> check_timeout_ev );
@@ -1314,7 +1317,10 @@ ngx_http_check_clear_all_events()
1314
1317
/* Be careful, The shared memory may have been freed after reload */
1315
1318
if (peer [i ].check_timeout_ev .timer_set ) {
1316
1319
c = peer [i ].pc .connection ;
1317
- ngx_close_connection (c );
1320
+ if (c ) {
1321
+ ngx_close_connection (c );
1322
+ peer [i ].pc .connection = NULL ;
1323
+ }
1318
1324
ngx_del_timer (& peer [i ].check_timeout_ev );
1319
1325
}
1320
1326
0 commit comments