| 88 | |
| 89 | |
| 90 | void start_refresh_timer(ucontact_t *ct) |
| 91 | { |
| 92 | struct list_head *el, *_; |
| 93 | ucontact_t *c; |
| 94 | |
| 95 | if (!have_mem_storage()) |
| 96 | return; |
| 97 | |
| 98 | lock_get(ul_refresh_lock); |
| 99 | if (!list_empty(&ct->refresh_list)) |
| 100 | list_del(&ct->refresh_list); |
| 101 | |
| 102 | /* insert into sorted list (ascending) */ |
| 103 | list_for_each_safe (el, _, pending_refreshes) { |
| 104 | c = list_entry(el, ucontact_t, refresh_list); |
| 105 | if (ct->refresh_time < c->refresh_time) { |
| 106 | list_add_tail(&ct->refresh_list, &c->refresh_list); |
| 107 | goto done; |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | list_add_tail(&ct->refresh_list, pending_refreshes); |
| 112 | |
| 113 | done: |
| 114 | lock_release(ul_refresh_lock); |
| 115 | } |
| 116 | |
| 117 | |
| 118 | void stop_refresh_timer(ucontact_t *ct) |
no test coverage detected