Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

L2CAP Channel API Design Flaws #206

Open
kext opened this issue Dec 3, 2023 · 1 comment
Open

L2CAP Channel API Design Flaws #206

kext opened this issue Dec 3, 2023 · 1 comment

Comments

@kext
Copy link
Contributor

kext commented Dec 3, 2023

Right now ble::l2cap::Channel is Clone and the rx, tx and try_tx methods take self as shared reference.

I think this should be changed to mutable references and removing Clone because it is not possible to use a channel in two different tasks without triggering a panic in the long run. Doing that results in "Multiple tasks waiting on same portal". I tried having one task read from the channel and the other write to it.

To support that use case maybe we should implement a split method to split the channel into a reading and a writing half.

In my case I worked around that issue by using two different channels, one for reading and one for writing, but this requires more resources for the softdevice.

@kext
Copy link
Contributor Author

kext commented Dec 8, 2023

Turns out this doesn't help at all. Since the portal is associated with the connection instead of the channel the current API design does not allow using even multiple independent channels at the same time.

Right now only the following works: Waiting for data on only one channel at a time with rx and only using try_tx or ensuring that tx never overlaps with rx.

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

No branches or pull requests

1 participant