1# test that a slow (in this case sleeping) client causes relayd to slow down
2# reading from the server (instead of balooning its buffers)
3
4use strict;
5use warnings;
6use Errno ':POSIX';
7
8my @errors = (EWOULDBLOCK);
9my $errors = "(". join("|", map { $! = $_ } @errors). ")";
10
11my $size = 2**21;
12
13our %args = (
14    client => {
15	fast => 1,
16	max => 100,
17	func => sub {
18	    my $self = shift;
19	    http_request($self , $size, "1.0", "");
20	    http_response($self , $size);
21	    print STDERR "going to sleep\n";
22	    ${$self->{server}}->loggrep(qr/blocked write/, 8)
23		or die "no blocked write in server.log";
24	    read_char($self, $size);
25	    return;
26	},
27	rcvbuf => 2**12,
28	nocheck => 1,
29    },
30    relayd => {
31	protocol => [ "http",
32	    "tcp socket buffer 1024",
33	    "match request header log",
34	    "match request path log",
35	],
36    },
37    server => {
38	fast => 1,
39	func => \&http_server,
40	sndbuf => 2**12,
41	sndtimeo => 2,
42	loggrep => qr/blocked write .*: $errors/,
43
44    },
45    lengths => [$size],
46);
47
481;
49