Skip to content

fix(client): allow shared channel access - #191

Merged
jadamcrain merged 1 commit into
stepfunc:mainfrom
mdmzfzl:fix/shared-channel-access
Aug 8, 2026
Merged

fix(client): allow shared channel access#191
jadamcrain merged 1 commit into
stepfunc:mainfrom
mdmzfzl:fix/shared-channel-access

Conversation

@mdmzfzl

@mdmzfzl mdmzfzl commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Channel's read/write methods and set_decode_level now take &self rather than &mut self. These methods only build a command and send it on the internal mpsc::Sender, so there is nothing to mutate. The existing enable and disable methods in the same impl already take &self.

The deprecated CallbackSession is left unchanged.

Motivation

The exclusive borrow never actually enforced exclusivity. Channel is Clone, so callers that wanted concurrent requests could simply clone the handle. That behavior is safe by design: each request carries its own oneshot, and the client task serializes commands from the shared channel.

What the &mut self requirement did enforce was unnecessary friction for shared ownership patterns. In particular, Arc<Channel> is awkward to use because Arc<T> only provides &T. As a result, callers have to clone the channel handle for every operation just to satisfy a borrow requirement that does not reflect the implementation.

Compatibility

This is source-compatible for normal callers. Existing calls using mutable bindings continue to compile, potentially with an unused_mut warning.

The deprecated CallbackSession and FFI-facing APIs are unchanged.

cargo-semver-checks reports:

223 checks: 223 pass, 31 skip
Summary: no semver update required

@jadamcrain
jadamcrain self-requested a review August 8, 2026 00:40

@jadamcrain jadamcrain left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I will do a milestone release with this change.

@jadamcrain
jadamcrain merged commit 48909cf into stepfunc:main Aug 8, 2026
30 checks passed
jadamcrain added a commit that referenced this pull request Aug 8, 2026
Milestone to publish only the `rodbus` crate to crates.io for the shared
client channel access change (#191). There are no FFI changes, so this
milestone is not pushed to Maven/NuGet/docs.

Full lockstep version bump 1.6.0-M1 -> 1.6.0-M2 across all crates, FFI
binding build files, and the guide. The lockstep bump is required even
for a crates.io-only publish: the FFI layer asserts the generated
bindings' expected version (rodbus-schema, ffi/rodbus-schema/src/lib.rs)
against the native library's runtime version (rodbus::VERSION, via
ffi/rodbus-ffi/src/lib.rs), so bumping rodbus alone fails the binding
tests in CI.

Release process: this does NOT use the tag-driven pipeline (a tag fires
all release jobs across every ecosystem). After merge, publish manually
from main with `cargo publish -p rodbus`; no git tag is pushed. Binding
versions therefore read 1.6.0-M2 in source but stay published at 1.5.0
until the 1.6.0 final re-syncs everything.
@mdmzfzl
mdmzfzl deleted the fix/shared-channel-access branch August 9, 2026 01:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants