MINOR: queue: Change pendconn_get_next_strm into private function

This commit is contained in:
Christopher Faulet 2017-06-06 10:34:51 +02:00 committed by Willy Tarreau
parent 5f77fef34e
commit 87566c923b
2 changed files with 24 additions and 25 deletions

View File

@ -37,7 +37,6 @@
extern struct pool_head *pool2_pendconn;
int init_pendconn();
struct stream *pendconn_get_next_strm(struct server *srv, struct proxy *px);
struct pendconn *pendconn_add(struct stream *strm);
void pendconn_free(struct pendconn *p);
void process_srv_queue(struct server *s);

View File

@ -61,29 +61,6 @@ unsigned int srv_dynamic_maxconn(const struct server *s)
}
/*
* Manages a server's connection queue. This function will try to dequeue as
* many pending streams as possible, and wake them up.
*/
void process_srv_queue(struct server *s)
{
struct proxy *p = s->proxy;
int maxconn;
/* First, check if we can handle some connections queued at the proxy. We
* will take as many as we can handle.
*/
maxconn = srv_dynamic_maxconn(s);
while (s->served < maxconn) {
struct stream *strm = pendconn_get_next_strm(s, p);
if (strm == NULL)
break;
task_wakeup(strm->task, TASK_WOKEN_RES);
}
}
/* 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.
@ -97,7 +74,7 @@ void process_srv_queue(struct server *s)
* The stream is immediately marked as "assigned", and both its <srv> and
* <srv_conn> are set to <srv>,
*/
struct stream *pendconn_get_next_strm(struct server *srv, struct proxy *px)
static struct stream *pendconn_get_next_strm(struct server *srv, struct proxy *px)
{
struct pendconn *ps, *pp;
struct stream *strm;
@ -133,6 +110,29 @@ struct stream *pendconn_get_next_strm(struct server *srv, struct proxy *px)
return strm;
}
/*
* Manages a server's connection queue. This function will try to dequeue as
* many pending streams as possible, and wake them up.
*/
void process_srv_queue(struct server *s)
{
struct proxy *p = s->proxy;
int maxconn;
/* First, check if we can handle some connections queued at the proxy. We
* will take as many as we can handle.
*/
maxconn = srv_dynamic_maxconn(s);
while (s->served < maxconn) {
struct stream *strm = pendconn_get_next_strm(s, p);
if (strm == NULL)
break;
task_wakeup(strm->task, TASK_WOKEN_RES);
}
}
/* Adds the stream <strm> to the pending connection list of server <strm>->srv
* or to the one of <strm>->proxy if srv is NULL. All counters and back pointers
* are updated accordingly. Returns NULL if no memory is available, otherwise the