Open kext opened 7 months ago
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
.
Right now
ble::l2cap::Channel
isClone
and therx
,tx
andtry_tx
methods takeself
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.