feat(client): allow constructing without connecting#214
Open
reez wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Attempts to address #166
Allows
Clientto be constructed without opening a network connection, addsClient::connect()for explicit connection and protocol negotiation, and defers automatic connection until the first Electrum API call.Notes to Reviewers
I kept the patch intentionally small so I left out things like:
from_config_connectedfor callers who want the previous construct-and-connect behavior in one step.ssl://no-TLS check into a small helper if that feels cleaner.Related Issues
This started for me from bdk-dart#91, where constructing an FFI backed
ElectrumClientcan block the Android UI thread during TCP connection and cause ANRs.I opened bdk-ffi#1037 to address it on bdk-ffi, trying to make that blocking boundary clearer in the bindings, but I think a bdk-ffi only change still falls a bit short without an upstream change from
rust-electrum-client.So this PR is for that upstream client layer change, and is closely related to rust-electrum-client#166 where tnull asked for a way to construct an Electrum client without directly establishing a connection.