MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / set_1timer

Function set_1timer

modules/tm/timer.c:979–1012  ·  view source on GitHub ↗

similar to set_timer, except it allows only one-time * timer setting and all later attempts are ignored * Returned values: * 0 if the linker was actually added to the list * -1 if the linker was not added as it was already found in the list; * do not consider this an error, but a NOP. */

Source from the content-addressed store, hash-verified

977 * do not consider this an error, but a NOP.
978 */
979int set_1timer( struct timer_link *new_tl, enum lists list_id,
980 utime_t* ext_timeout )
981{
982 utime_t timeout;
983 struct timer* list;
984 int ret = -1;
985
986
987 if (list_id>=NR_OF_TIMER_LISTS) {
988 LM_CRIT("unknown list: %d\n", list_id);
989#ifdef EXTRA_DEBUG
990 abort();
991#endif
992 return ret;
993 }
994
995 if (!ext_timeout) {
996 timeout = timer_id2timeout[ list_id ];
997 } else {
998 timeout = *ext_timeout;
999 }
1000
1001 list= &(timertable[new_tl->set].timers[ list_id ]);
1002
1003 lock(list->mutex);
1004 if (!new_tl->time_out) {
1005 insert_timer_unsafe( list, new_tl, timeout +
1006 ((timer_id2type[list_id]==UTIME_TYPE)?get_uticks():get_ticks()));
1007 ret = 0;
1008 }
1009 unlock(list->mutex);
1010
1011 return ret;
1012}
1013
1014
1015

Callers 3

put_on_waitFunction · 0.85
add_phony_uacFunction · 0.85
_set_fr_retrFunction · 0.85

Calls 3

insert_timer_unsafeFunction · 0.85
get_uticksFunction · 0.85
get_ticksFunction · 0.85

Tested by

no test coverage detected