Skip to content

Commit 387ae75

Browse files
committed
f return earlier
1 parent 78c73b0 commit 387ae75

File tree

1 file changed

+4
-2
lines changed
  • lightning-block-sync/src

1 file changed

+4
-2
lines changed

lightning-block-sync/src/rpc.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,10 @@ impl RpcClient {
7474

7575
let mut client = if let Some(client) = self.client.lock().unwrap().take() { client }
7676
else { HttpClient::connect(&self.endpoint)? };
77-
let mut response = match client.post::<JsonResponse>(&uri, &host, &self.basic_auth, content).await {
77+
let http_response = client.post::<JsonResponse>(&uri, &host, &self.basic_auth, content).await;
78+
*self.client.lock().unwrap() = Some(client);
79+
80+
let mut response = match http_response {
7881
Ok(JsonResponse(response)) => response,
7982
Err(e) if e.kind() == std::io::ErrorKind::Other => {
8083
match e.get_ref().unwrap().downcast_ref::<HttpError>() {
@@ -107,7 +110,6 @@ impl RpcClient {
107110
return Err(std::io::Error::new(std::io::ErrorKind::InvalidData, "expected JSON result"));
108111
}
109112

110-
*self.client.lock().unwrap() = Some(client);
111113
JsonResponse(result.take()).try_into()
112114
}
113115
}

0 commit comments

Comments
 (0)