Skip to content

Commit 5d8296a

Browse files
committed
CP: Fix bug in trasmit time accounting comparison
Commit 810d33d ("Better calculate the transmit timeout for packets") introduced a way to account for the trasmit time in when waiting for responsed by pre-computing an absolute time when the response is expected but then compared it with a duration returned by osdp_millis_since(). This patch fixes the issue by adjusting the comparison to the current tick value. Related-to: #292 Fixes: 810d33d Signed-off-by: Siddharth Chandrasekaran <sidcha.dev@gmail.com>
1 parent 7764466 commit 5d8296a

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/osdp_cp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -870,7 +870,7 @@ static int cp_phy_state_update(struct osdp_pd *pd)
870870
cp_phy_state_wait(pd, OSDP_CMD_RETRY_WAIT_MS);
871871
return OSDP_CP_ERR_DEFER;
872872
}
873-
if (osdp_millis_since(pd->phy_tstamp) > pd->resp_expected) {
873+
if (osdp_millis_now() > pd->resp_expected) {
874874
if (pd->phy_retry_count < OSDP_CMD_MAX_RETRIES) {
875875
pd->phy_retry_count += 1;
876876
LOG_WRN("No response in 200ms; probing (%d)",

0 commit comments

Comments
 (0)