File tree 1 file changed +4
-2
lines changed
1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -74,7 +74,10 @@ impl RpcClient {
74
74
75
75
let mut client = if let Some ( client) = self . client . lock ( ) . unwrap ( ) . take ( ) { client }
76
76
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 {
78
81
Ok ( JsonResponse ( response) ) => response,
79
82
Err ( e) if e. kind ( ) == std:: io:: ErrorKind :: Other => {
80
83
match e. get_ref ( ) . unwrap ( ) . downcast_ref :: < HttpError > ( ) {
@@ -107,7 +110,6 @@ impl RpcClient {
107
110
return Err ( std:: io:: Error :: new ( std:: io:: ErrorKind :: InvalidData , "expected JSON result" ) ) ;
108
111
}
109
112
110
- * self . client . lock ( ) . unwrap ( ) = Some ( client) ;
111
113
JsonResponse ( result. take ( ) ) . try_into ( )
112
114
}
113
115
}
You can’t perform that action at this time.
0 commit comments