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
137 stars 71 forks source link

PD offline is a little aggressive #140

Closed rm5248 closed 10 months ago

rm5248 commented 11 months ago

Describe the bug With the fix for #133, we are occasionally getting an indication on the PD side that the connection has dropped, when our CP side is not detecting a drop.

The default timeout is set to 200ms here. The 200ms is how long a single PD needs to respond within. Several options to fix:

  1. Increase the delay to at least 600ms. Note that in the OSDP spec version 2.2 and 2.1.7, the "off-line" time is set to 8 seconds, so that is probably the correct time to set it to.
  2. Add an option to make this configurable on the PD side(e.g. osdp_pd_set_max_offline_time)
sidcha commented 10 months ago

@rm5248, thanks for reporting this. I have added a new macro OSDP_ONLINE_TOUT_MS defined to 600 ms. 8 seconds seem too high a number for my preference :).