mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-03-31 23:58:16 +00:00
MINOR: queue: Change pendconn_get_next_strm into private function
This commit is contained in:
parent
5f77fef34e
commit
87566c923b
@ -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);
|
||||
|
48
src/queue.c
48
src/queue.c
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user