post_config hook: */
| 858 | |
| 859 | /* post_config hook: */ |
| 860 | static int balancer_post_config(apr_pool_t *pconf, apr_pool_t *plog, |
| 861 | apr_pool_t *ptemp, server_rec *s) |
| 862 | { |
| 863 | apr_status_t rv; |
| 864 | proxy_server_conf *conf; |
| 865 | ap_slotmem_instance_t *new = NULL; |
| 866 | apr_time_t tstamp; |
| 867 | apr_array_header_t *ids; |
| 868 | int idx; |
| 869 | |
| 870 | /* balancer_post_config() will be called twice during startup. So, don't |
| 871 | * set up the static data the 1st time through. */ |
| 872 | if (ap_state_query(AP_SQ_MAIN_STATE) == AP_SQ_MS_CREATE_PRE_CONFIG) { |
| 873 | return OK; |
| 874 | } |
| 875 | |
| 876 | ap_proxy_retry_worker_fn = |
| 877 | APR_RETRIEVE_OPTIONAL_FN(ap_proxy_retry_worker); |
| 878 | if (!ap_proxy_retry_worker_fn) { |
| 879 | ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, APLOGNO(02230) |
| 880 | "mod_proxy must be loaded for mod_proxy_balancer"); |
| 881 | return !OK; |
| 882 | } |
| 883 | |
| 884 | /* |
| 885 | * Get slotmem setups |
| 886 | */ |
| 887 | storage = ap_lookup_provider(AP_SLOTMEM_PROVIDER_GROUP, "shm", |
| 888 | AP_SLOTMEM_PROVIDER_VERSION); |
| 889 | if (!storage) { |
| 890 | ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, APLOGNO(01177) |
| 891 | "Failed to lookup provider 'shm' for '%s': is " |
| 892 | "mod_slotmem_shm loaded??", |
| 893 | AP_SLOTMEM_PROVIDER_GROUP); |
| 894 | return !OK; |
| 895 | } |
| 896 | |
| 897 | ids = make_servers_ids(s, ptemp); |
| 898 | |
| 899 | tstamp = apr_time_now(); |
| 900 | /* |
| 901 | * Go thru each Vhost and create the shared mem slotmem for |
| 902 | * each balancer's workers |
| 903 | */ |
| 904 | for (idx = 0; s; ++idx) { |
| 905 | int i,j; |
| 906 | const char *id; |
| 907 | proxy_balancer *balancer; |
| 908 | ap_slotmem_type_t type; |
| 909 | void *sconf = s->module_config; |
| 910 | conf = (proxy_server_conf *)ap_get_module_config(sconf, &proxy_module); |
| 911 | /* |
| 912 | * During create_proxy_config() we created a dummy id. Now that |
| 913 | * we have identifying info, we can create the real id |
| 914 | */ |
| 915 | id = APR_ARRAY_IDX(ids, idx, const char *); |
| 916 | conf->id = apr_psprintf(pconf, "p%x", |
| 917 | ap_proxy_hashfunc(id, PROXY_HASHFUNC_DEFAULT)); |
nothing calls this directly
no test coverage detected