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

Function unsafe_insert_reinvite_ping_timer

modules/dialog/dlg_timer.c:399–437  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

397}
398
399void unsafe_insert_reinvite_ping_timer(struct dlg_ping_list *node,int new_timeout)
400{
401 struct dlg_ping_list *it;
402
403 node->timeout = get_ticks() + new_timeout;
404
405 if (reinvite_ping_timer->first == 0) {
406 reinvite_ping_timer->first = node;
407 reinvite_ping_timer->last = node;
408 } else {
409 /* quick optimisation, always check if our timeout is bigger than last
410 if not, lookup our position, might be useful in the future if we want
411 to set different ping intervals per dialog */
412 if (node->timeout >= reinvite_ping_timer->last->timeout) {
413 node->prev = reinvite_ping_timer->last;
414 reinvite_ping_timer->last->next = node;
415 reinvite_ping_timer->last = node;
416 } else {
417 for (it=reinvite_ping_timer->first;it;it=it->next) {
418 if (it->timeout >= node->timeout)
419 break;
420 }
421
422 /* we need to insert ourselves before the found node */
423 if (it == NULL) {
424 /* we're going to be the last node
425 should never get here due to the above optimisation ... paranoia */
426 node->prev = reinvite_ping_timer->last;
427 reinvite_ping_timer->last->next = node;
428 reinvite_ping_timer->last = node;
429 } else {
430 it->prev->next=node;
431 node->prev = it->prev;
432 node->next = it;
433 it->prev = node;
434 }
435 }
436 }
437}
438
439int insert_reinvite_ping_timer(struct dlg_cell* dlg)
440{

Callers 2

dlg_reinvite_routineFunction · 0.85

Calls 1

get_ticksFunction · 0.85

Tested by

no test coverage detected