Skip to content

Commit 7633ea1

Browse files
committed
electrum: add support for Happy Eyeballs (RFC 8305)
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
1 parent 9e2e688 commit 7633ea1

3 files changed

Lines changed: 13 additions & 2 deletions

File tree

Cargo.lock

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tokio-electrum/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ bitcoin = "0.32"
2020
electrum_streaming_client = { git = "https://github.com/yukibtc/electrum_streaming_client", branch = "missing-features-req-patch", features = ["tokio"] }
2121
futures-util.workspace = true
2222
tokio = { workspace = true, features = ["macros", "net", "rt-multi-thread", "sync", "time"] }
23+
tokio-happy-eyeballs = "0.1"
2324
tokio-rustls = { version = "0.26", default-features = false, features = ["ring", "tls12"] }
2425
tokio-socks = { version = "0.5", optional = true }
2526
tracing.workspace = true

tokio-electrum/src/client.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1170,7 +1170,7 @@ async fn connect_tcp(
11701170

11711171
async fn connect_direct_tcp(addr: &HostAndPort) -> Result<(BoxReadStream, BoxWriteStream), Error> {
11721172
// Connect
1173-
let stream: TcpStream = TcpStream::connect(addr.to_string()).await?;
1173+
let stream: TcpStream = tokio_happy_eyeballs::connect(addr.to_string()).await?;
11741174

11751175
// Split stream
11761176
Ok(split_stream(stream))
@@ -1202,7 +1202,7 @@ async fn connect_ssl(
12021202

12031203
async fn connect_direct_ssl(addr: &HostAndPort) -> Result<(BoxReadStream, BoxWriteStream), Error> {
12041204
// Connect to the server
1205-
let tcp_stream: TcpStream = TcpStream::connect(addr.to_string()).await?;
1205+
let tcp_stream: TcpStream = tokio_happy_eyeballs::connect(addr.to_string()).await?;
12061206

12071207
// Create TLS configuration
12081208
ssl_connector(addr, tcp_stream).await

0 commit comments

Comments
 (0)