Skip to content

Commit 0e5f034

Browse files
zondclaude
andcommitted
fix: make tokio signal/rt-multi-thread optional via "tokio-full" feature
The "full" tokio feature includes signal handling and multi-threaded runtime which are not available on all platforms (notably ESP-IDF). This change: - Uses minimal tokio features by default (rt, net, io-util, sync, time, macros) - Adds "tokio-full" feature for rt-multi-thread and signal support - Includes "tokio-full" in default features for backward compatibility - Marks all examples as requiring "tokio-full" since they use #[tokio::main] and/or tokio::signal For ESP32/embedded builds, use: cargo build --no-default-features --features alloc Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent 0cb2fe1 commit 0e5f034

File tree

2 files changed

+16
-53
lines changed

2 files changed

+16
-53
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ sha2 = "0.10.8"
3939
rand_core = { version = "0.6.4", features = ["getrandom"] }
4040

4141
# Async IO
42-
tokio = { version = "1.44.2", features = ["full"] }
42+
tokio = { version = "1.44.2", features = ["rt", "net", "io-util", "sync", "time", "macros"] }
4343
tokio-stream = "0.1.17"
4444
tokio-util = "0.7.15"
4545

@@ -51,45 +51,56 @@ log = "0.4.27"
5151
env_logger = "0.10"
5252

5353
[features]
54-
default = ["alloc"]
54+
default = ["alloc", "tokio-full"]
5555
alloc = []
5656
fernet-aes128 = []
57+
# Full tokio features for desktop platforms. Disable for ESP32/embedded.
58+
tokio-full = ["tokio/rt-multi-thread", "tokio/signal"]
5759

5860
[build-dependencies]
5961
tonic-build = "0.13.0"
6062

6163
[[example]]
6264
name = "tcp_server"
6365
path = "examples/tcp_server.rs"
66+
required-features = ["tokio-full"]
6467

6568
[[example]]
6669
name = "tcp_client"
6770
path = "examples/tcp_client.rs"
71+
required-features = ["tokio-full"]
6872

6973
[[example]]
7074
name = "udp_link"
7175
path = "examples/udp_link.rs"
76+
required-features = ["tokio-full"]
7277

7378
[[example]]
7479
name = "link_client"
7580
path = "examples/link_client.rs"
81+
required-features = ["tokio-full"]
7682

7783
[[example]]
7884
name = "kaonic_client"
7985
path = "examples/kaonic_client.rs"
86+
required-features = ["tokio-full"]
8087

8188
[[example]]
8289
name = "testnet_client"
8390
path = "examples/testnet_client.rs"
91+
required-features = ["tokio-full"]
8492

8593
[[example]]
8694
name = "kaonic_tcp_mesh"
8795
path = "examples/kaonic_tcp_mesh.rs"
96+
required-features = ["tokio-full"]
8897

8998
[[example]]
9099
name = "kaonic_mesh"
91100
path = "examples/kaonic_mesh.rs"
101+
required-features = ["tokio-full"]
92102

93103
[[example]]
94104
name = "multihop"
95105
path = "examples/multihop.rs"
106+
required-features = ["tokio-full"]

0 commit comments

Comments
 (0)