MINOR: queue: Change pendconn_from_srv/pendconn_from_px into private functions

This commit is contained in:
Christopher Faulet 2017-06-09 14:26:38 +02:00 committed by Willy Tarreau
parent f0614e8111
commit f3a55dbd22
2 changed files with 20 additions and 21 deletions

View File

@ -44,27 +44,6 @@ unsigned int srv_dynamic_maxconn(const struct server *s);
int pendconn_redistribute(struct server *s);
int pendconn_grab_from_px(struct server *s);
/* Returns the first pending connection for server <s>, which may be NULL if
* nothing is pending.
*/
static inline struct pendconn *pendconn_from_srv(const struct server *s) {
if (!s->nbpend)
return NULL;
return LIST_ELEM(s->pendconns.n, struct pendconn *, list);
}
/* Returns the first pending connection for proxy <px>, which may be NULL if
* nothing is pending.
*/
static inline struct pendconn *pendconn_from_px(const struct proxy *px) {
if (!px->nbpend)
return NULL;
return LIST_ELEM(px->pendconns.n, struct pendconn *, list);
}
/* Returns 0 if all slots are full on a server, or 1 if there are slots available. */
static inline int server_has_room(const struct server *s) {
return !s->maxconn || s->cur_sess < srv_dynamic_maxconn(s);

View File

@ -61,6 +61,26 @@ unsigned int srv_dynamic_maxconn(const struct server *s)
}
/* Returns the first pending connection for server <s>, which may be NULL if
* nothing is pending.
*/
static inline struct pendconn *pendconn_from_srv(const struct server *s) {
if (!s->nbpend)
return NULL;
return LIST_ELEM(s->pendconns.n, struct pendconn *, list);
}
/* Returns the first pending connection for proxy <px>, which may be NULL if
* nothing is pending.
*/
static inline struct pendconn *pendconn_from_px(const struct proxy *px) {
if (!px->nbpend)
return NULL;
return LIST_ELEM(px->pendconns.n, struct pendconn *, list);
}
/* Detaches the next pending connection from either a server or a proxy, and
* returns its associated stream. If no pending connection is found, NULL is
* returned. Note that neither <srv> nor <px> may be NULL.