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
|
// Timeout for pooled (idle) connections
|
||||||
mod_config()->downstream_idle_read_timeout.tv_sec = 60;
|
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_host = "localhost";
|
||||||
mod_config()->downstream_port = 80;
|
mod_config()->downstream_port = 80;
|
||||||
|
|
||||||
|
@ -378,6 +382,11 @@ void print_help(std::ostream& out)
|
||||||
<< " connection. Default: "
|
<< " connection. Default: "
|
||||||
<< get_config()->downstream_idle_read_timeout.tv_sec << "\n"
|
<< get_config()->downstream_idle_read_timeout.tv_sec << "\n"
|
||||||
<< " --accesslog Print simple accesslog to stderr.\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"
|
<< " -h, --help Print this help.\n"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
|
@ -412,6 +421,7 @@ int main(int argc, char **argv)
|
||||||
{"backend-write-timeout", required_argument, &flag, 6 },
|
{"backend-write-timeout", required_argument, &flag, 6 },
|
||||||
{"accesslog", no_argument, &flag, 7 },
|
{"accesslog", no_argument, &flag, 7 },
|
||||||
{"backend-keep-alive-timeout", required_argument, &flag, 8 },
|
{"backend-keep-alive-timeout", required_argument, &flag, 8 },
|
||||||
|
{"frontend-spdy-window-bits", required_argument, &flag, 9 },
|
||||||
{"help", no_argument, 0, 'h' },
|
{"help", no_argument, 0, 'h' },
|
||||||
{0, 0, 0, 0 }
|
{0, 0, 0, 0 }
|
||||||
};
|
};
|
||||||
|
@ -508,6 +518,19 @@ int main(int argc, char **argv)
|
||||||
mod_config()->downstream_idle_read_timeout = tv;
|
mod_config()->downstream_idle_read_timeout = tv;
|
||||||
break;
|
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:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,8 @@ Config::Config()
|
||||||
spdy_max_concurrent_streams(0),
|
spdy_max_concurrent_streams(0),
|
||||||
spdy_proxy(false),
|
spdy_proxy(false),
|
||||||
add_x_forwarded_for(false),
|
add_x_forwarded_for(false),
|
||||||
accesslog(false)
|
accesslog(false),
|
||||||
|
spdy_upstream_window_bits(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
|
@ -69,6 +69,7 @@ struct Config {
|
||||||
bool spdy_proxy;
|
bool spdy_proxy;
|
||||||
bool add_x_forwarded_for;
|
bool add_x_forwarded_for;
|
||||||
bool accesslog;
|
bool accesslog;
|
||||||
|
size_t spdy_upstream_window_bits;
|
||||||
Config();
|
Config();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -297,7 +297,7 @@ SpdyUpstream::SpdyUpstream(uint16_t version, ClientHandler *handler)
|
||||||
if(version == SPDYLAY_PROTO_SPDY3) {
|
if(version == SPDYLAY_PROTO_SPDY3) {
|
||||||
int val = 1;
|
int val = 1;
|
||||||
flow_control_ = true;
|
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_,
|
rv = spdylay_session_set_option(session_,
|
||||||
SPDYLAY_OPT_NO_AUTO_WINDOW_UPDATE, &val,
|
SPDYLAY_OPT_NO_AUTO_WINDOW_UPDATE, &val,
|
||||||
sizeof(val));
|
sizeof(val));
|
||||||
|
|
Loading…
Reference in New Issue