Skip to content

Commit db2d980

Browse files
committed
wip fix timeout
1 parent 2380612 commit db2d980

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

client/src/client.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use std::fs::File;
1313
use std::io::{BufRead, BufReader};
1414
use std::iter::FromIterator;
1515
use std::path::PathBuf;
16+
use std::time::Duration;
1617
use std::{fmt, result};
1718

1819
use crate::{bitcoin, deserialize_hex};
@@ -1288,7 +1289,16 @@ impl Client {
12881289
/// Can only return [Err] when using cookie authentication.
12891290
pub fn new(url: &str, auth: Auth) -> Result<Self> {
12901291
let (user, pass) = auth.get_user_pass()?;
1291-
jsonrpc::client::Client::simple_http(url, user, pass)
1292+
jsonrpc::client::Client::simple_http(url, user, pass, None)
1293+
.map(|client| Client {
1294+
client,
1295+
})
1296+
.map_err(|e| super::error::Error::JsonRpc(e.into()))
1297+
}
1298+
1299+
pub fn new_with_timeout(url: &str, auth: Auth, timeout: Duration) -> Result<Self> {
1300+
let (user, pass) = auth.get_user_pass()?;
1301+
jsonrpc::client::Client::simple_http(url, user, pass, Some(timeout))
12921302
.map(|client| Client {
12931303
client,
12941304
})

0 commit comments

Comments
 (0)