goToMain / libosdp

Implementation of IEC 60839-11-5 OSDP (Open Supervised Device Protocol); provides a C library with support for C++, Rust and Python3
https://libosdp.sidcha.dev
Apache License 2.0
128 stars 69 forks source link

cp_refresh not handling shared PDs correctly #155

Closed dmercer-google closed 6 months ago

dmercer-google commented 6 months ago

I am not sure if this is a bug but it sure looks like it.

In the case of shared PDs, the CP attempts to acquire a lock on the PD prior to refreshing it. This is done here. The result of cp_channel_acquire here is never checked and, in the case of shared channels, cp_refresh will always return 0.

Is this check doing something I dont understand?

dmercer-google commented 6 months ago

NVM. I was reading the code wrong.