Skip to content

Commit 7b4e99e

Browse files
committed
Revert "Move to async I/O with Tokio"
This reverts commit e1dbfd7.
1 parent 2a92788 commit 7b4e99e

File tree

12 files changed

+278
-467
lines changed

12 files changed

+278
-467
lines changed

.travis.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@ before_script:
88
script:
99
- cargo fmt -- --check --verbose
1010
- cargo test --verbose --all
11+
- cargo check --verbose --features=use-openssl
1112
- cargo check --verbose --no-default-features --features=proxy
12-
- cargo check --verbose --no-default-features --features=tls
1313
- cargo check --verbose --no-default-features --features=minimal
1414
- cargo check --verbose --no-default-features --features=minimal,debug-calls
15-
- cargo check --verbose --no-default-features --features=minimal,no-sync
15+
- cargo check --verbose --no-default-features --features=proxy,use-openssl
16+
- cargo check --verbose --no-default-features --features=proxy,use-rustls
1617

1718
before_cache:
1819
- rm -rf "$TRAVIS_HOME/.cargo/registry/src"

Cargo.toml

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
[package]
2-
edition = "2018"
32
name = "electrum-client"
43
version = "0.1.0-beta.6"
54
authors = ["Alekos Filini <[email protected]>"]
@@ -23,23 +22,20 @@ path = "src/lib.rs"
2322
[dependencies]
2423
log = "^0.4"
2524
bitcoin = { version = "0.23", features = ["use-serde"] }
26-
tokio = { version = "0.2", features = ["net", "io-util"] }
27-
futures = "0.3"
2825
serde = { version = "^1.0", features = ["derive"] }
2926
serde_json = { version = "^1.0" }
3027

3128
# Optional dependencies
32-
tokio-tls = { version = "0.3", optional = true }
33-
native-tls = { version = "0.2.4", optional = true }
34-
tokio-socks = { version = "0.2", optional = true }
35-
36-
[dev-dependencies]
37-
tokio = { version = "0.2", features = ["net", "io-util", "macros"] }
29+
socks = { version = "^0.3", optional = true }
30+
openssl = { version = "^0.10", optional = true }
31+
rustls = { version = "0.16.0", optional = true, features = ["dangerous_configuration"] }
32+
webpki = { version = "0.21.0", optional = true }
33+
webpki-roots = { version = "^0.19", optional = true }
3834

3935
[features]
40-
default = ["tokio-tls", "native-tls", "tokio-socks"]
41-
no-sync = []
36+
default = ["socks", "webpki", "webpki-roots", "rustls"]
4237
minimal = []
4338
debug-calls = []
44-
proxy = ["tokio-socks"]
45-
tls = ["tokio-tls", "native-tls"]
39+
proxy = ["socks"]
40+
use-rustls = ["webpki", "webpki-roots", "rustls"]
41+
use-openssl = ["openssl"]

examples/plaintext.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ extern crate electrum_client;
22

33
use electrum_client::Client;
44

5-
#[tokio::main]
6-
async fn main() {
7-
let mut client = Client::new("kirsche.emzy.de:50001").await.unwrap();
8-
let res = client.server_features().await;
5+
fn main() {
6+
let mut client = Client::new("kirsche.emzy.de:50001").unwrap();
7+
let res = client.server_features();
98
println!("{:#?}", res);
109
}

examples/ssl.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
extern crate electrum_client;
2+
3+
use electrum_client::Client;
4+
5+
fn main() {
6+
let mut client = Client::new_ssl("electrum2.hodlister.co:50002", true).unwrap();
7+
let res = client.server_features();
8+
println!("{:#?}", res);
9+
}

examples/tls.rs

Lines changed: 0 additions & 12 deletions
This file was deleted.

examples/tor.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,20 @@ extern crate electrum_client;
22

33
use electrum_client::Client;
44

5-
#[tokio::main]
6-
async fn main() {
5+
fn main() {
76
// NOTE: This assumes Tor is running localy, with an unauthenticated Socks5 listening at
87
// localhost:9050
98

10-
let mut client = Client::new_proxy("ozahtqwp25chjdjd.onion:50001", "127.0.0.1:9050")
11-
.await
12-
.unwrap();
13-
let res = client.server_features().await;
9+
let mut client = Client::new_proxy("ozahtqwp25chjdjd.onion:50001", "127.0.0.1:9050").unwrap();
10+
let res = client.server_features();
1411
println!("{:#?}", res);
1512

1613
// works both with onion v2/v3 (if your Tor supports them)
1714
let mut client = Client::new_proxy(
1815
"v7gtzf7nua6hdmb2wtqaqioqmesdb4xrlly4zwr7bvayxv2bpg665pqd.onion:50001",
1916
"127.0.0.1:9050",
2017
)
21-
.await
2218
.unwrap();
23-
let res = client.server_features().await;
19+
let res = client.server_features();
2420
println!("{:#?}", res);
2521
}

src/batch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use bitcoin::hashes::hex::ToHex;
66
use bitcoin::{Script, Txid};
77

8-
use crate::types::{Param, ToElectrumScriptHash};
8+
use types::{Param, ToElectrumScriptHash};
99

1010
/// Helper structure that caches all the requests before they are actually sent to the server.
1111
///

0 commit comments

Comments
 (0)