Allow customization of max WS connections. (#8257)

* Allow customization of max WS connections.

* remove superflous line.

* Add test for CLI argument parsing.
This commit is contained in:
Tomasz Drwięga
2018-04-02 12:33:09 +02:00
committed by André Silva
parent 5ea4c22868
commit c1cced3662
5 changed files with 27 additions and 1 deletions

View File

@@ -499,6 +499,10 @@ usage! {
"--ws-hosts=[HOSTS]",
"List of allowed Host header values. This option will validate the Host header sent by the browser, it is additional security against some attack vectors. Special options: \"all\", \"none\".",
ARG arg_ws_max_connections: (usize) = 100usize, or |c: &Config| c.websockets.as_ref()?.max_connections,
"--ws-max-connections=[CONN]",
"Maximal number of allowed concurrent WS connections.",
["API and console options IPC"]
FLAG flag_no_ipc: (bool) = false, or |c: &Config| c.ipc.as_ref()?.disable.clone(),
"--no-ipc",
@@ -1087,6 +1091,7 @@ struct Ws {
apis: Option<Vec<String>>,
origins: Option<Vec<String>>,
hosts: Option<Vec<String>>,
max_connections: Option<usize>,
}
#[derive(Default, Debug, PartialEq, Deserialize)]
@@ -1520,6 +1525,7 @@ mod tests {
arg_ws_apis: "web3,eth,net,parity,traces,rpc,secretstore".into(),
arg_ws_origins: "none".into(),
arg_ws_hosts: "none".into(),
arg_ws_max_connections: 100,
// IPC
flag_no_ipc: false,
@@ -1759,6 +1765,7 @@ mod tests {
apis: None,
origins: Some(vec!["none".into()]),
hosts: None,
max_connections: None,
}),
rpc: Some(Rpc {
disable: Some(true),