Option to disable keep alive for JSON-RPC http transport (#9848)

* Keep alive jsonrpc CLI option.

* Update to latest json-rpc.

* Keep alive flag.
This commit is contained in:
Tomasz Drwięga
2018-11-05 15:39:51 +01:00
committed by Wei Tang
parent 3a6e04ba15
commit 59daf95859
8 changed files with 27 additions and 9 deletions

View File

@@ -467,6 +467,10 @@ usage! {
"--no-jsonrpc",
"Disable the HTTP JSON-RPC API server.",
FLAG flag_jsonrpc_no_keep_alive: (bool) = false, or |c: &Config| c.rpc.as_ref()?.keep_alive,
"--jsonrpc-no-keep-alive",
"Disable HTTP/1.1 keep alive header. Disabling keep alive will prevent re-using the same TCP connection to fire multiple requests, recommended when using one request per connection.",
ARG arg_jsonrpc_port: (u16) = 8545u16, or |c: &Config| c.rpc.as_ref()?.port.clone(),
"--jsonrpc-port=[PORT]",
"Specify the port portion of the HTTP JSON-RPC API server.",
@@ -1219,6 +1223,7 @@ struct Rpc {
server_threads: Option<usize>,
processing_threads: Option<usize>,
max_payload: Option<usize>,
keep_alive: Option<bool>,
}
#[derive(Default, Debug, PartialEq, Deserialize)]
@@ -1676,6 +1681,7 @@ mod tests {
// -- API and Console Options
// RPC
flag_no_jsonrpc: false,
flag_jsonrpc_no_keep_alive: false,
arg_jsonrpc_port: 8545u16,
arg_jsonrpc_interface: "local".into(),
arg_jsonrpc_cors: "null".into(),
@@ -1958,6 +1964,7 @@ mod tests {
server_threads: None,
processing_threads: None,
max_payload: None,
keep_alive: None,
}),
ipc: Some(Ipc {
disable: None,