Module: kamailio
Branch: master
Commit: bc544daea2ee4bb568cf0314f6d32b8aa0c81ecc
URL: 
https://github.com/kamailio/kamailio/commit/bc544daea2ee4bb568cf0314f6d32b8aa0c81ecc

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2023-05-31T11:53:14+02:00

async: use _async_timer_exec_last_slot = UINT_MAX for initial value

---

Modified: src/modules/async/async_sleep.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/bc544daea2ee4bb568cf0314f6d32b8aa0c81ecc.diff
Patch: 
https://github.com/kamailio/kamailio/commit/bc544daea2ee4bb568cf0314f6d32b8aa0c81ecc.patch

---

diff --git a/src/modules/async/async_sleep.c b/src/modules/async/async_sleep.c
index 42ada3b200c..605118be3da 100644
--- a/src/modules/async/async_sleep.c
+++ b/src/modules/async/async_sleep.c
@@ -24,6 +24,7 @@
 #include <unistd.h>
 #include <stdlib.h>
 #include <string.h>
+#include <limits.h>
 
 #include "../../core/dprint.h"
 #include "../../core/ut.h"
@@ -272,7 +273,7 @@ int async_sleep(sip_msg_t *msg, int seconds, cfg_action_t 
*act, str *cbname)
        return 0;
 }
 
-static unsigned int _async_timer_exec_last_slot = -1;
+static unsigned int _async_timer_exec_last_slot = UINT_MAX;
 
 void async_timer_exec(unsigned int ticks, void *param)
 {
@@ -293,7 +294,7 @@ void async_timer_exec(unsigned int ticks, void *param)
                return;
        }
 
-       if(_async_timer_exec_last_slot < 0) {
+       if(_async_timer_exec_last_slot == UINT_MAX) {
                _async_timer_exec_last_slot = idx;
        }
        slot = (_async_timer_exec_last_slot + 1) % ASYNC_RING_SIZE;

_______________________________________________
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to [email protected]

Reply via email to