Skip to content

Commit

Permalink
fix infinite loop on connection failures
Browse files Browse the repository at this point in the history
ngx_http_upsync_connect_handler():
When ngx_event_connect_peer() fails, we shouldn't set the current
timer timeout to 0 as that immediatelly calls the current function
again. Instead, we should call ngx_http_upsync_clean_event() to
properly clean up & to set the reconnection timer.
  • Loading branch information
sorc1 committed Mar 10, 2022
1 parent 63733af commit ef97046
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/ngx_http_upsync_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -2643,9 +2643,7 @@ ngx_http_upsync_connect_handler(ngx_event_t *event)
"upsync_connect_handler: cannot connect to upsync_server: %V ",
upsync_server->pc.name);

ngx_del_timer(&upsync_server->upsync_timeout_ev);
ngx_add_timer(&upsync_server->upsync_ev, 0);

ngx_http_upsync_clean_event(upsync_server);
return;
}

Expand Down

0 comments on commit ef97046

Please sign in to comment.