depolymerization

wire gateway for Bitcoin/Ethereum
Log | Files | Refs | Submodules | README | LICENSE

commit 95fa92cf1fd0a9f25f1036e77ad6b5859ba5f250
parent 7e7e391dd80ac43e49cd25998e46a6012b1767d4
Author: Antoine A <>
Date:   Wed,  9 Mar 2022 16:10:16 +0100

btc-wire: less broken pipe

Diffstat:
Mbtc-wire/src/rpc.rs | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/btc-wire/src/rpc.rs b/btc-wire/src/rpc.rs @@ -164,7 +164,7 @@ impl Rpc { T: serde::de::DeserializeOwned + Debug, { // Handle bitcoind RPC client timeout - if self.last_call.elapsed() > Duration::from_secs(60) { + if self.last_call.elapsed() > Duration::from_secs(30) { // Create new connection let sock = TcpStream::connect_timeout(&self.addr, Duration::from_secs(5))?; self.conn = BufReader::new(sock); @@ -207,6 +207,7 @@ impl Rpc { if sep { break; } + self.last_call = Instant::now(); } // Read body let amount = sock.read_until(b'\n', buf)?; @@ -229,7 +230,6 @@ impl Rpc { } RpcResponse::Error(msg) => Err(Error::Bitcoin(msg)), }; - self.last_call = Instant::now(); return result; }