From bece8cfbc2264fd3ff99d772dea9f9e727262914 Mon Sep 17 00:00:00 2001 From: Trent Nelson Date: Thu, 23 Jul 2020 09:18:46 -0600 Subject: [PATCH] Add RpcClient constructor with timeout --- client/src/rpc_client.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/client/src/rpc_client.rs b/client/src/rpc_client.rs index decc1de834..b931d9d10d 100644 --- a/client/src/rpc_client.rs +++ b/client/src/rpc_client.rs @@ -52,6 +52,10 @@ impl RpcClient { Self::new_sender(HttpSender::new(url)) } + pub fn new_with_timeout(url: String, timeout: Duration) -> Self { + Self::new_sender(HttpSender::new_with_timeout(url, timeout)) + } + pub fn new_mock(url: String) -> Self { Self::new_sender(MockSender::new(url)) } @@ -66,7 +70,7 @@ impl RpcClient { pub fn new_socket_with_timeout(addr: SocketAddr, timeout: Duration) -> Self { let url = get_rpc_request_str(addr, false); - Self::new_sender(HttpSender::new_with_timeout(url, timeout)) + Self::new_with_timeout(url, timeout) } pub fn confirm_transaction(&self, signature: &Signature) -> ClientResult {