buttplug-csharp icon indicating copy to clipboard operation
buttplug-csharp copied to clipboard

fix: Making ButtplugClient use ConcurrentDictionary

Open blackspherefollower opened this issue 4 years ago • 3 comments

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

blackspherefollower avatar Jun 24 '20 10:06 blackspherefollower

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))

sippeangelo avatar Dec 14 '20 06:12 sippeangelo

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.

blackspherefollower avatar Dec 14 '20 07:12 blackspherefollower

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 https://github.com/buttplugio/buttplug-rs/issues/215?

sippeangelo avatar Dec 14 '20 07:12 sippeangelo

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

qdot avatar Dec 27 '22 19:12 qdot