Skip to content

Commit

Permalink
Add use-quic flag to allow for using quic in program deploy (#27319)
Browse files Browse the repository at this point in the history
  • Loading branch information
sakridge authored Aug 25, 2022
1 parent 8c81ed0 commit 5a100ab
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
6 changes: 6 additions & 0 deletions cli/src/clap_app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ pub fn get_clap_app<'ab, 'v>(name: &str, about: &'ab str, version: &'v str) -> A
.global(true)
.help("Show additional information"),
)
.arg(
Arg::with_name("use_quic")
.long("use-quic")
.global(true)
.help("Use QUIC when sending transactions."),
)
.arg(
Arg::with_name("no_address_labels")
.long("no-address-labels")
Expand Down
2 changes: 2 additions & 0 deletions cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,7 @@ pub struct CliConfig<'a> {
pub send_transaction_config: RpcSendTransactionConfig,
pub confirm_transaction_initial_timeout: Duration,
pub address_labels: HashMap<String, String>,
pub use_quic: bool,
}

impl CliConfig<'_> {
Expand Down Expand Up @@ -549,6 +550,7 @@ impl Default for CliConfig<'_> {
u64::from_str(DEFAULT_CONFIRM_TX_TIMEOUT_SECONDS).unwrap(),
),
address_labels: HashMap::new(),
use_quic: false,
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@ pub fn parse_args<'a>(
config.address_labels
};

let use_quic = matches.is_present("use_quic");

Ok((
CliConfig {
command,
Expand All @@ -220,6 +222,7 @@ pub fn parse_args<'a>(
},
confirm_transaction_initial_timeout,
address_labels,
use_quic,
},
signers,
))
Expand Down
6 changes: 5 additions & 1 deletion cli/src/program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2226,7 +2226,11 @@ fn send_deploy_messages(
if let Some(write_messages) = write_messages {
if let Some(write_signer) = write_signer {
trace!("Writing program data");
let connection_cache = Arc::new(ConnectionCache::default());
let connection_cache = if config.use_quic {
Arc::new(ConnectionCache::new(1))
} else {
Arc::new(ConnectionCache::with_udp(1))
};
let tpu_client = TpuClient::new_with_connection_cache(
rpc_client.clone(),
&config.websocket_url,
Expand Down

0 comments on commit 5a100ab

Please sign in to comment.