refactor(core): add Connection::from_source public constructor (ADR-070 gap)
The BidiStreamSource trait (ADR-070) made Connection hold Box<dyn BidiStreamSource> so downstream crates can add connection shapes without editing core — but the public constructor for that path was missing. The source field is private; the channels crate (or any future crate) had no way to build a Connection from its own BidiStreamSource impl. The trait was unusable from outside core. Add Connection::from_source(source: impl BidiStreamSource, alpn: Vec<u8>) -> Self: the extension point. Takes impl BidiStreamSource (not Box<dyn>) to match the ergonomic style of from_stream / from_bidi; boxes the source internally. No feature gate (always available, like from_stream). Initializes alpn and identity: OnceLock::new() the same as the other constructors. Test: a custom RecordingSource BidiStreamSource impl (not a built-in) constructed via from_source, verifying remote_alpn / remote_addr / accept_bi (round-trips real bytes via tokio::io::duplex) / open_bi (StreamClosed) / close (records code+reason) all delegate to the custom impl. Verified: cargo test + clippy clean across default, --no-default-features, --features iroh, --all-features; cargo check -p alknet-call succeeds unchanged; cargo fmt --check passes.
This commit is contained in:
1 parent
02c5b9e039
commit
e8bbc7465f
2 files changed
+124
-1
No files matched your search
@@ -1,7 +1,7 @@
|
||||
---
|
||||
id: core/connection-from-source-constructor
|
||||
name: "Add Connection::from_source constructor (ADR-070 gap — the public extension point)"
|
||||
status: pending
|
||||
status: completed
|
||||
depends_on: []
|
||||
scope: narrow
|
||||
risk: low
|
||||
|
||||
Reference in new issue
Block a user