| 397 | } |
| 398 | |
| 399 | void 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 | |
| 439 | int insert_reinvite_ping_timer(struct dlg_cell* dlg) |
| 440 | { |
no test coverage detected