mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-24 21:52:17 +00:00
MINOR: queue: Change pendconn_from_srv/pendconn_from_px into private functions
This commit is contained in:
parent
f0614e8111
commit
f3a55dbd22
@ -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);
|
||||
|
20
src/queue.c
20
src/queue.c
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user