static ngx_int_t ngx_http_tfs_module_init(ngx_cycle_t *cycle) { ngx_http_tfs_main_conf_t *tmcf; tmcf = ngx_http_cycle_get_module_main_conf(cycle, ngx_http_tfs_module); if (tmcf == NULL) { return NGX_ERROR; } if (tmcf->enable_rcs == NGX_HTTP_TFS_NO) { return NGX_OK; } return ngx_http_tfs_timers_init(cycle, tmcf->lock_file.data); }
static ngx_int_t ngx_http_tfs_module_init(ngx_cycle_t *cycle) { ngx_uint_t i; ngx_http_tfs_upstream_t **tup; ngx_http_tfs_main_conf_t *tmcf; ngx_http_tfs_timers_data_t *data; tmcf = ngx_http_cycle_get_module_main_conf(cycle, ngx_http_tfs_module); if (tmcf == NULL) { return NGX_ERROR; } tup = tmcf->upstreams.elts; for (i = 0; i < tmcf->upstreams.nelts; i++) { if (!tup[i]->enable_rcs || !tup[i]->lock_file.len || !tup[i]->used) { return NGX_OK; } data = ngx_pcalloc(cycle->pool, sizeof(ngx_http_tfs_timers_data_t)); if (data == NULL) { return NGX_ERROR; } data->main_conf = tmcf; data->upstream = tup[i]; data->lock = ngx_http_tfs_timers_init(cycle, tup[i]->lock_file.data); if (data->lock == NULL) { return NGX_ERROR; } tup[i]->timer_data = data; } return NGX_OK; }