diff --git a/include/haproxy/proxy-t.h b/include/haproxy/proxy-t.h index c233d2909..b865ba2bd 100644 --- a/include/haproxy/proxy-t.h +++ b/include/haproxy/proxy-t.h @@ -479,7 +479,7 @@ struct proxy { struct log_steps log_steps; /* bitfield of log origins where log should be generated during request handling */ const char *file_prev; /* file of the previous instance found with the same name, or NULL */ int line_prev; /* line of the previous instance found with the same name, or 0 */ - unsigned int refcount; /* refcount on this proxy (only used for default proxy for now) */ + unsigned int def_ref; /* default proxy only refcount */ } conf; /* config information */ struct http_ext *http_ext; /* http ext options */ struct ceb_root *used_server_addr; /* list of server addresses in use */ diff --git a/src/cfgparse-listen.c b/src/cfgparse-listen.c index dbf923187..76d6b6f91 100644 --- a/src/cfgparse-listen.c +++ b/src/cfgparse-listen.c @@ -393,7 +393,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) * freed unless it is still referenced by proxies. */ if (last_defproxy && last_defproxy->id[0] == '\0' && - !last_defproxy->conf.refcount) { + !last_defproxy->conf.def_ref) { defaults_px_destroy(last_defproxy); } last_defproxy = NULL; diff --git a/src/haproxy.c b/src/haproxy.c index 9b13bd2f3..2ea61c836 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -2166,7 +2166,7 @@ static void step_init_2(int argc, char** argv) /* Free last defaults if it is unnamed and unreferenced. */ if (last_defproxy && last_defproxy->id[0] == '\0' && - !last_defproxy->conf.refcount) { + !last_defproxy->conf.def_ref) { defaults_px_destroy(last_defproxy); } last_defproxy = NULL; /* This variable is not used after parsing. */ @@ -2821,11 +2821,11 @@ void deinit(void) * they are respectively cleaned up in sink_deinit() and deinit_log_forward() */ - /* If named defaults were preserved, ensure refcount is resetted. */ + /* If named defaults were preserved, ensure count is resetted. */ if (!(global.tune.options & GTUNE_PURGE_DEFAULTS)) defaults_px_unref_all(); /* All proxies are removed now, so every defaults should also be freed - * when their refcount reached zero. + * when their count reached zero. */ BUG_ON(!LIST_ISEMPTY(&defaults_list)); diff --git a/src/proxy.c b/src/proxy.c index 04982b705..adbbd63f1 100644 --- a/src/proxy.c +++ b/src/proxy.c @@ -2973,7 +2973,7 @@ static void defaults_px_free(struct proxy *defproxy) void defaults_px_destroy(struct proxy *px) { BUG_ON(!(px->cap & PR_CAP_DEF)); - BUG_ON(px->conf.refcount != 0); + BUG_ON(px->conf.def_ref != 0); cebis_item_delete(&defproxy_by_name, conf.name_node, id, px); LIST_DELETE(&px->el); @@ -2983,7 +2983,7 @@ void defaults_px_destroy(struct proxy *px) } /* delete all unreferenced default proxies. A default proxy is unreferenced if - * its refcount is equal to zero. + * its count is equal to zero. */ void defaults_px_destroy_all_unref(void) { @@ -2992,7 +2992,7 @@ void defaults_px_destroy_all_unref(void) for (px = cebis_item_first(&defproxy_by_name, conf.name_node, id, struct proxy); px; px = nx) { BUG_ON(!(px->cap & PR_CAP_DEF)); nx = cebis_item_next(&defproxy_by_name, conf.name_node, id, px); - if (!px->conf.refcount) + if (!px->conf.def_ref) defaults_px_destroy(px); } } @@ -3005,7 +3005,7 @@ void defaults_px_detach(struct proxy *px) { BUG_ON(!(px->cap & PR_CAP_DEF)); cebis_item_delete(&defproxy_by_name, conf.name_node, id, px); - if (!px->conf.refcount) + if (!px->conf.def_ref) defaults_px_destroy(px); /* If not destroyed, can still be accessed in . */ } @@ -3017,7 +3017,7 @@ void defaults_px_ref_all(void) for (px = cebis_item_first(&defproxy_by_name, conf.name_node, id, struct proxy); px; px = cebis_item_next(&defproxy_by_name, conf.name_node, id, px)) { - ++px->conf.refcount; + ++px->conf.def_ref; } } @@ -3028,15 +3028,15 @@ void defaults_px_unref_all(void) for (px = cebis_item_first(&defproxy_by_name, conf.name_node, id, struct proxy); px; px = nx) { nx = cebis_item_next(&defproxy_by_name, conf.name_node, id, px); - BUG_ON(!px->conf.refcount); - if (!--px->conf.refcount) + BUG_ON(!px->conf.def_ref); + if (!--px->conf.def_ref) defaults_px_destroy(px); } } /* Add a reference on the default proxy for the proxy Nothing is * done if already references . Otherwise, the default proxy - * refcount is incremented by one. + * count is incremented by one. * * This operation is not thread safe. It must only be performed during init * stage or under thread isolation. @@ -3049,11 +3049,11 @@ static inline void defaults_px_ref(struct proxy *defpx, struct proxy *px) BUG_ON(px->defpx); px->defpx = defpx; - defpx->conf.refcount++; + defpx->conf.def_ref++; } /* Check that can inherits from default proxy. If some settings - * cannot be copied, refcount of the defaults instance is incremented. + * cannot be copied, count of the defaults instance is incremented. * Inheritance may be impossible due to incompatibility issues. In this case, * will be allocated to point to a textual description of the error. * @@ -3086,7 +3086,7 @@ int proxy_ref_defaults(struct proxy *px, struct proxy *defpx, char **errmsg) * - It cannot define 'tcp-response content' rules if it * is used to init frontend sections. * - * If no error is found, refcount of the default proxy is incremented. + * If no error is found, count of the default proxy is incremented. */ if ((!LIST_ISEMPTY(&defpx->http_req_rules) || !LIST_ISEMPTY(&defpx->http_res_rules) || @@ -3149,7 +3149,7 @@ int proxy_ref_defaults(struct proxy *px, struct proxy *defpx, char **errmsg) } /* proxy removes its reference on its default proxy. The default proxy - * refcount is decremented by one. If it was the last reference, the + * count is decremented by one. If it was the last reference, the * corresponding default proxy is destroyed. For now this operation is not * thread safe and is performed during deinit staged only. */ @@ -3157,7 +3157,7 @@ void proxy_unref_defaults(struct proxy *px) { if (px->defpx == NULL) return; - if (!--px->defpx->conf.refcount) + if (!--px->defpx->conf.def_ref) defaults_px_destroy(px->defpx); px->defpx = NULL; }