Add non-spawning master and outstation task APIs#433
Merged
Conversation
Adds MasterBuilder and UdpMasterBuilder types that separate protocol configuration from transport binding and task execution. Callers control which Tokio runtime or task set the master runs on instead of the library calling tokio::spawn internally. - MasterBuilder: stream transports (TCP, TLS, serial) - UdpMasterBuilder: UDP transport with required SocketAddr per association - Both produce a unified MasterTask with async fn run(self) - Synchronous enable() and add_association() for pre-run configuration - EndpointList::into_connect_handler() for easy ClientConnectionHandler creation - Existing spawn_* functions unchanged (parallel API) - Master example rewritten to use builder API
7 tasks
jadamcrain
marked this pull request as ready for review
July 20, 2026 17:42
Move the FFI TCP outstation server to the spawning add_outstation/bind methods, driven via block_on to enter the runtime context, so the library-defined dnp3-outstation-tcp and tcp-server spans are reused instead of being lost. This restores 1.6.0 FFI logging behavior. Document that the no-spawn APIs (add_outstation_no_spawn, bind_no_spawn) and the new unstable MasterTask intentionally attach no span so callers control instrumentation, and add a changelog note for the Rust-facing behavior change.
Add a 1.7.0-RC3 changelog section documenting the non-spawning master and outstation task APIs, the new EndpointList::into_connect_handler helpers, and the no-spawn tracing span behavior change. Bump all crate versions from 1.7.0-RC2 to 1.7.0-RC3.
The 1.7.0-RC3 version bump and changelog belong in a dedicated "prepare 1.7.0-RC3" PR per RELEASE.md (using bump-version.sh, which also updates the poms, csproj, CMakeLists, and sitedata.json). Revert them here so this PR contains only the feature work and the FFI tracing-span fix; the release prep will follow after this lands on main.
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.
Summary
Server::into_task(listener)for TCP outstations with an already-bound listenerSerialOutstation::new→open→SerialOutstationTask::rununstableand document their semver exemptionMotivation
The existing spawning APIs choose where tasks run by calling
tokio::spawninternally. These APIs let applications finish configuration and obtain concrete tasks or futures without spawning, so callers control the Tokio runtime and task set.The type structure prevents associations from being attached to the wrong master and prevents a serial outstation task from existing until its port has opened successfully.
Existing stable APIs such as
Server::bind_no_spawnandServer::add_outstation_no_spawnremain ungated. Stable examples continue to use the stable spawning API.Behavior fixes
DisabledstateMasterTask::runis first polled rather than during configurationValidation
cargo test -p dnp3cargo test --features unstablednp3,dnp3-ffi, anddnp3-ffi-javawith minimal unstable featurescargo fmt --allgit diff --checkcloses #414