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

Function unsafe_insert_ping_timer

modules/dialog/dlg_timer.c:330–369  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

328}
329
330void unsafe_insert_ping_timer(struct dlg_ping_list *node,int new_timeout)
331{
332 struct dlg_ping_list *it;
333
334 node->timeout = get_ticks() + new_timeout;
335
336 if (ping_timer->first == 0) {
337 ping_timer->first = node;
338 ping_timer->last = node;
339 } else {
340 /* quick optimisation, always check if our timeout is bigger than last
341 if not, lookup our position, might be useful in the future if we want
342 to set different ping intervals per dialog */
343 if (node->timeout >= ping_timer->last->timeout) {
344 node->prev = ping_timer->last;
345 ping_timer->last->next = node;
346 ping_timer->last = node;
347 } else {
348 for (it=ping_timer->first;it;it=it->next) {
349 if (it->timeout >= node->timeout)
350 break;
351 }
352
353 /* we need to insert ourselves before the found node */
354 if (it == NULL) {
355 /* we're going to be the last node
356 should never get here due to the above optimisation ... paranoia */
357 node->prev = ping_timer->last;
358 ping_timer->last->next = node;
359 ping_timer->last = node;
360 } else {
361 it->prev->next=node;
362 node->prev = it->prev;
363 node->next = it;
364 it->prev = node;
365 }
366
367 }
368 }
369}
370
371int insert_ping_timer(struct dlg_cell* dlg)
372{

Callers 2

insert_ping_timerFunction · 0.85
dlg_options_routineFunction · 0.85

Calls 1

get_ticksFunction · 0.85

Tested by

no test coverage detected