This repository was archived by the owner on Aug 27, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -54,15 +54,25 @@ let ipcclient_exn_wrapper thunk =
5454 | e ->
5555 let e = Exn. to_string e in
5656 DebugMessage. plog (Printf. sprintf " error making JSON-RPC call: %s" e);
57- fail0 ~kind: " StateIPCClient: Unexpected error making JSON-RPC call"
57+ fail0 ~kind: ( Printf. sprintf " StateIPCClient: Unexpected error making JSON-RPC call: %s " e)
5858 ?inst:None
5959
60+ type state = { mutable client : Ezcurl .t option };;
61+ let current_state = { client = None };;
62+
6063let http_rpc ~socket_addr (call : Rpc.call ) : Rpc.response M.t =
64+ let client = match current_state.client with
65+ | Some c -> c
66+ | None ->
67+ let c = Ezcurl. make () in
68+ current_state.client < - Some c;
69+ c
70+ in
6171 let msg_buf = Jsonrpc. string_of_call ~version: Jsonrpc. V2 call in
6272 DebugMessage. plog (Printf. sprintf " Sending: %s\n " msg_buf);
6373 let exception Http_error of string in
6474 let response =
65- match Ezcurl. post ~headers: [" content-type" , " application/json" ] ~content: (`String msg_buf) ~params: [] ~url: socket_addr () with
75+ match Ezcurl. post ~client ~ headers: [" content-type" , " application/json" ] ~content: (`String msg_buf) ~params: [] ~url: socket_addr () with
6676 | Ok response -> response
6777 | Error (_ , err ) -> (
6878 DebugMessage. plog (Printf. sprintf " error calling RPC: %s" err);
You can’t perform that action at this time.
0 commit comments