mirror of
https://github.com/obgm/libcoap.git
synced 2026-11-28 01:27:09 +03:00
coap_net.c: Avoid divsion by zero if COAP_TICKS_PER_SECOND < 1000
This commit is contained in:
1 parent
bf7323d9a2
commit
eafc0230f5
1 file changed
+2
-2
+2
-2
@@ -2133,8 +2133,8 @@ coap_send_internal(coap_session_t *session, coap_pdu_t *pdu, coap_pdu_t *request
|
||||
if (now - session->last_tx >= session->rl_ticks_per_packet) {
|
||||
break;
|
||||
}
|
||||
timeout_ms = (uint32_t)((session->rl_ticks_per_packet - (now - session->last_tx)) /
|
||||
(COAP_TICKS_PER_SECOND / 1000));
|
||||
timeout_ms = (uint32_t)(((session->rl_ticks_per_packet - (now - session->last_tx)) *
|
||||
1000) / COAP_TICKS_PER_SECOND);
|
||||
|
||||
if (timeout_ms == 0) {
|
||||
timeout_ms = COAP_IO_NO_WAIT;
|
||||
|
||||
Reference in new issue
Block a user