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

fix: Making ButtplugClient use ConcurrentDictionary #665

Conversation

blackspherefollower
Copy link
Contributor

This fixes #664 by switching the dictionary implementaion used
for _devices to ConcurrentDictionary.

This fixes buttplugio#664 by switching the dictionary implementaion used
for _devices to ConcurrentDictionary.
@sippeangelo
Copy link

Can confirm that this prevents the crash! Unclear if it's causing other device management issues however, since sometimes I'm getting cryptic logs like these. Also, sometimes the server won't reconnect to a device after it's been disconnected, but still seems to be aware of it existing since when powering the device off it produces the last few lines in this log:

[10:16:35.016] Device "Lovense Hush" connected
[10:16:35.019] Device "Lovense Hush" connected
[10:25:35.663] Device "Lovense Hush" disconnected
[10:25:35.686] [Warning] Device error recieved: Got device removed message for unknown device.
�[2mDec 13 10:25:40.929�[0m �[31mERROR�[0m buttplug::server::comm_managers::btleplug::btleplug_device_impl: Cannot subscribe: ButtplugDeviceError(InvalidEndpoint(Rx))
�[2mDec 13 10:25:40.929�[0m �[31mERROR�[0m buttplug::server::device_manager: Device errored while trying to connect: Device communication error: Cannot subscribe: ButtplugDeviceError(InvalidEndpoint(Rx))
�[2mDec 13 10:26:47.751�[0m �[31mERROR�[0m buttplug::server::comm_managers::btleplug::btleplug_internal: Trying to send disconnect event to unbound device!
�[2mDec 13 10:26:51.410�[0m �[31mERROR�[0m buttplug::server::comm_managers::btleplug::btleplug_device_impl: Cannot subscribe: ButtplugDeviceError(InvalidEndpoint(Rx))
�[2mDec 13 10:26:51.410�[0m �[31mERROR�[0m buttplug::server::device_manager: Device errored while trying to connect: Device communication error: Cannot subscribe: ButtplugDeviceError(InvalidEndpoint(Rx))

@blackspherefollower
Copy link
Contributor Author

Huh, that looks like an issue over on buttplug-rs (since you're only using c# as a client and that's all down in the device management layer).

I'd open a new issue on buttplug-rs for that one.

@sippeangelo
Copy link

Huh, that looks like an issue over on buttplug-rs (since you're only using c# as a client and that's all down in the device management layer).

I'd open a new issue on buttplug-rs for that one.

Yeah you're right. But it's still kinda weird that we're getting doubles of connect/disconnect messages, so maybe this entire issue is the server misbehaving? Maybe caused by buttplugio/buttplug#215?

@qdot
Copy link
Member

qdot commented Dec 27, 2022

No idea why but this won't merge correctly, brought it in by hand.

@qdot qdot closed this Dec 27, 2022
qdot added a commit that referenced this pull request Dec 27, 2022
Fix in #665 that won't merge right for some reason.
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.

Concurrent access exception thrown by ButtplugClient
3 participants