struct server *cli_find_server(struct appctx *appctx, char *arg);
struct server *new_server(struct proxy *proxy);
void srv_take(struct server *srv);
-struct server *srv_drop(struct server *srv);
+void srv_drop(struct server *srv);
void srv_free_params(struct server *srv);
int srv_preinit(struct server *srv);
int srv_set_ssl(struct server *s, int use_ssl);
*/
void deinit_proxy(struct proxy *p)
{
- struct server *s;
+ struct server *s, *s_next;
struct cap_hdr *h,*h_next;
struct listener *l,*l_next;
struct bind_conf *bind_conf, *bind_back;
if (p->lbprm.ops && p->lbprm.ops->server_deinit)
p->lbprm.ops->server_deinit(s);
- s = srv_drop(s);
+ s_next = s->next;
+ srv_drop(s);
+ s = s_next;
}/* end while(s) */
/* also free default-server parameters since some of them might have
*
* A general rule is to assume that proxy may already be freed, so cleanup checks
* must not depend on the proxy
- *
- * As a convenience, <srv.next> is returned if srv is not NULL. It may be useful
- * when calling srv_drop on the list of servers.
*/
-struct server *srv_drop(struct server *srv)
+void srv_drop(struct server *srv)
{
- struct server *next = NULL;
struct proxy *px = NULL;
int i __maybe_unused;
if (!srv)
- goto end;
-
- next = srv->next;
+ return;
/* If srv was deleted, a proxy refcount must be dropped. */
if (srv->flags & SRV_F_DELETED)
* server when reaching zero.
*/
if (HA_ATOMIC_SUB_FETCH(&srv->refcount, 1))
- goto end;
+ return;
/* This BUG_ON() is invalid for now as server released on deinit will
* trigger it as they are not properly removed from their tree.
srv_free(&srv);
proxy_drop(px);
-
- end:
- return next;
}
/* Remove a server <srv> from a tracking list if <srv> is tracking another