Commit 0bfa602
committed
changes: switch to bitreq from chunked_transfer
we changed the http layer from the manual tcpstream client
implementation to bitreq, this change lets us rely on bitreq for
http request formatting, sockets, HTTP parsing, chunked bodies,
pooling, and async support instead of having to manually implement
them.
cargo.toml: we added bitreq 0.3 and updates the rest-client and
rpc-client feature wiring to depend on bitreq. A tokio feature is
also enabled to allow bitreq async support and pipelining.
http.rs: The old HttpEndpoint builder and all manual TCP/socket
timeout logic are dropped along with the manual GET/POST
construction and response parsing. The client API now uses base_url
and get/post return Result with a typed HttpClientError instead of
std::io::Result. HttpClientError splits transport failures
(bitreq::Error), non-2xx HTTP responses (HttpError), and response
decoding issues (std::io::Error).
rest.rs and rpc.rs: HttpEndpoint and the Mutex<Option<HttpClient>>
caching pattern are removed and both clients now own an HttpClient
directly using base_url. rpc.rs also adds RpcClientError so we can
represent HTTP failures, JSON-RPC errors from the server, and
malformed responses instead of just giving out std::io::Error.
convert.rs: it maps HttpClientError and RpcClientError into
BlockSourceError with this retry classification: transport errors
and HTTP 5xx are transient, HTTP 4xx and invalid data are
persistent, and RPC errors are treated as transient.1 parent 0b45bfd commit 0bfa602
File tree
5 files changed
+345
-762
lines changed- lightning-block-sync
- src
5 files changed
+345
-762
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
27 | | - | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
2 | 4 | | |
3 | 5 | | |
4 | 6 | | |
| |||
35 | 37 | | |
36 | 38 | | |
37 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
38 | 98 | | |
39 | 99 | | |
40 | 100 | | |
| |||
0 commit comments