Commit bb644147 authored by Dridi Boukelmoune's avatar Dridi Boukelmoune

v1p: Honor pipe_task_deadline parameter

parent 32215660
......@@ -40,6 +40,7 @@
#include "cache_http1.h"
#include "vtcp.h"
#include "vtim.h"
#include "VSC_vbe.h"
......@@ -117,7 +118,8 @@ stream_close_t
V1P_Process(const struct req *req, int fd, struct v1p_acct *v1a)
{
struct pollfd fds[2];
vtim_dur tmo;
vtim_dur tmo, tmo_task;
vtim_real deadline;
stream_close_t sc;
int i, j;
......@@ -141,6 +143,10 @@ V1P_Process(const struct req *req, int fd, struct v1p_acct *v1a)
fds[1].fd = req->sp->fd;
fds[1].events = POLLIN;
deadline = cache_param->pipe_task_deadline;
if (deadline > 0.)
deadline += req->sp->t_idle;
sc = SC_TX_PIPE;
while (fds[0].fd > -1 || fds[1].fd > -1) {
fds[0].revents = 0;
......@@ -148,6 +154,11 @@ V1P_Process(const struct req *req, int fd, struct v1p_acct *v1a)
tmo = cache_param->pipe_timeout;
if (tmo == 0.)
tmo = -1.;
if (deadline > 0.) {
tmo_task = deadline - VTIM_real();
tmo = (tmo > 0.) ? vmin(tmo, tmo_task) : tmo_task;
tmo = vmax(tmo, 0.);
}
i = poll(fds, 2, (int)(tmo * 1e3));
if (i == 0)
sc = SC_RX_TIMEOUT;
......
......@@ -10,13 +10,31 @@ server s1 {
rxreq
txresp -hdr "transfer-encoding: chunked"
expect_close
accept
rxreq
txresp -hdr "transfer-encoding: chunked"
expect_close
accept
non_fatal
rxreq
txresp -hdr "transfer-encoding: chunked"
loop 20 {
chunkedlen 1
delay 0.1
}
} -start
varnish v1 -cliok "param.set pipe_timeout 0s"
varnish v1 -cliok "param.set pipe_task_deadline 0s"
varnish v1 -vcl+backend "" -start
logexpect l1 -v v1 -q "Timestamp:PipeSess[2] > 1.0" {
expect 1001 * ReqMethod PIPE
logexpect l1 -v v1 -g raw -q SessClose {
expect 1000 * SessClose {^TX_PIPE 1\.}
expect 1003 * SessClose {^RX_TIMEOUT 0\.}
expect 1006 * SessClose {^RX_TIMEOUT 1\.}
expect 1009 * SessClose {^RX_TIMEOUT 1\.}
} -start
client c1 {
......@@ -25,11 +43,20 @@ client c1 {
rxresp
} -run
logexpect l1 -wait
varnish v1 -cliok "param.set pipe_timeout 500ms"
varnish v1 -cliok "param.set pipe_task_deadline 0s"
client c1 -run
varnish v1 -cliok "param.set pipe_timeout 0s"
varnish v1 -cliok "param.set pipe_task_deadline 1.1s"
client c1 -run
varnish v1 -cliok "param.set pipe_timeout 500ms"
varnish v1 -cliok "param.set pipe_task_deadline 1.1s"
client c1 -run
varnish v1 -expect MAIN.s_pipe == 2
logexpect l1 -wait
varnish v1 -expect MAIN.s_pipe == 4
varnish v1 -expect MAIN.sc_tx_pipe == 1
varnish v1 -expect MAIN.sc_rx_timeout == 1
varnish v1 -expect MAIN.sc_rx_timeout == 3
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment