Skip to content

Cache socket address in HttpClient for reconnect #931

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

jkczyz
Copy link
Contributor

@jkczyz jkczyz commented May 27, 2021

If the HttpClient attempts to reconnect to bitcoind that is no longer running, the client fails to get the address from the stream. Cache the address when connecting to prevent this.

Fixes #930

If the HttpClient attempts to reconnect to bitcoind that is no longer
running, the client fails to get the address from the stream. Cache the
address when connecting to prevent this.
@codecov
Copy link

codecov bot commented May 27, 2021

Codecov Report

Merging #931 (4a12d76) into main (8e7b590) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #931      +/-   ##
==========================================
- Coverage   90.46%   90.45%   -0.01%     
==========================================
  Files          60       60              
  Lines       30592    30591       -1     
==========================================
- Hits        27674    27672       -2     
- Misses       2918     2919       +1     
Impacted Files Coverage Δ
lightning-block-sync/src/http.rs 93.70% <100.00%> (-0.02%) ⬇️
lightning/src/ln/functional_tests.rs 96.80% <0.00%> (-0.04%) ⬇️
lightning/src/ln/channelmanager.rs 83.19% <0.00%> (+0.04%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8e7b590...4a12d76. Read the comment docs.

@TheBlueMatt TheBlueMatt merged commit 58a4f6c into lightningdevkit:main May 31, 2021
@devrandom
Copy link
Member

İ'm not sure this is a good idea, since it effectively caches DNS lookups indefinitely.

@jkczyz
Copy link
Contributor Author

jkczyz commented May 31, 2021

İ'm not sure this is a good idea, since it effectively caches DNS lookups indefinitely.

Technically, this isn't any different behavior from before when using TcpStream::peer_addr. We'd have to parameterize HttpClient (rather than connect) by ToSocketAddrs to avoid any caching.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

lightning-block-sync::HttpClient::send_request_with_retry panics if bitcoind crashes
4 participants