shrpx: Added --frontend-spdy-window-bits option
This commit is contained in:
parent
f89112b5e9
commit
51c4f4f5b0
|
@ -265,6 +265,10 @@ void fill_default_config()
|
|||
// Timeout for pooled (idle) connections
|
||||
mod_config()->downstream_idle_read_timeout.tv_sec = 60;
|
||||
|
||||
// window bits for SPDY upstream connection
|
||||
// 2**16 = 64KiB, which is SPDY/3 default.
|
||||
mod_config()->spdy_upstream_window_bits = 16;
|
||||
|
||||
mod_config()->downstream_host = "localhost";
|
||||
mod_config()->downstream_port = 80;
|
||||
|
||||
|
@ -378,6 +382,11 @@ void print_help(std::ostream& out)
|
|||
<< " connection. Default: "
|
||||
<< get_config()->downstream_idle_read_timeout.tv_sec << "\n"
|
||||
<< " --accesslog Print simple accesslog to stderr.\n"
|
||||
<< " --frontend-spdy-window-bits=<N>\n"
|
||||
<< " Sets the initial window size of SPDY\n"
|
||||
<< " frontend connection to 2**<N>.\n"
|
||||
<< " Default: "
|
||||
<< get_config()->spdy_upstream_window_bits << "\n"
|
||||
<< " -h, --help Print this help.\n"
|
||||
<< std::endl;
|
||||
}
|
||||
|
@ -412,6 +421,7 @@ int main(int argc, char **argv)
|
|||
{"backend-write-timeout", required_argument, &flag, 6 },
|
||||
{"accesslog", no_argument, &flag, 7 },
|
||||
{"backend-keep-alive-timeout", required_argument, &flag, 8 },
|
||||
{"frontend-spdy-window-bits", required_argument, &flag, 9 },
|
||||
{"help", no_argument, 0, 'h' },
|
||||
{0, 0, 0, 0 }
|
||||
};
|
||||
|
@ -508,6 +518,19 @@ int main(int argc, char **argv)
|
|||
mod_config()->downstream_idle_read_timeout = tv;
|
||||
break;
|
||||
}
|
||||
case 9: {
|
||||
// --frontend-spdy-window-bits
|
||||
errno = 0;
|
||||
unsigned long int n = strtoul(optarg, 0, 10);
|
||||
if(errno == 0 && n < 31) {
|
||||
mod_config()->spdy_upstream_window_bits = n;
|
||||
} else {
|
||||
std::cerr << "-w: specify the integer in the range [0, 30], inclusive"
|
||||
<< std::endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -43,7 +43,8 @@ Config::Config()
|
|||
spdy_max_concurrent_streams(0),
|
||||
spdy_proxy(false),
|
||||
add_x_forwarded_for(false),
|
||||
accesslog(false)
|
||||
accesslog(false),
|
||||
spdy_upstream_window_bits(0)
|
||||
{}
|
||||
|
||||
namespace {
|
||||
|
|
|
@ -69,6 +69,7 @@ struct Config {
|
|||
bool spdy_proxy;
|
||||
bool add_x_forwarded_for;
|
||||
bool accesslog;
|
||||
size_t spdy_upstream_window_bits;
|
||||
Config();
|
||||
};
|
||||
|
||||
|
|
|
@ -297,7 +297,7 @@ SpdyUpstream::SpdyUpstream(uint16_t version, ClientHandler *handler)
|
|||
if(version == SPDYLAY_PROTO_SPDY3) {
|
||||
int val = 1;
|
||||
flow_control_ = true;
|
||||
initial_window_size_ = 64*1024; // specified by SPDY/3 spec.
|
||||
initial_window_size_ = 1 << get_config()->spdy_upstream_window_bits;
|
||||
rv = spdylay_session_set_option(session_,
|
||||
SPDYLAY_OPT_NO_AUTO_WINDOW_UPDATE, &val,
|
||||
sizeof(val));
|
||||
|
|
Loading…
Reference in New Issue