| 167 | |
| 168 | |
| 169 | static inline void dm_update_unreplied_req(struct msg *req) |
| 170 | { |
| 171 | struct list_head *it, *aux; |
| 172 | struct fd_msg_list *rit, *ml; |
| 173 | unsigned int now = get_ticks(); |
| 174 | |
| 175 | lock_get(&dm_unreplied_req_lk); |
| 176 | |
| 177 | list_for_each_safe (it, aux, &dm_unreplied_req) { |
| 178 | rit = list_entry(it, struct fd_msg_list, list); |
| 179 | |
| 180 | if (rit->timeout_jf <= now) { |
| 181 | LM_DBG("Diameter request timeout (unhandled), cleaning up\n"); |
| 182 | list_del(&rit->list); |
| 183 | fd_msg_free(rit->req); |
| 184 | pkg_free(rit); |
| 185 | } else { |
| 186 | break; |
| 187 | } |
| 188 | } |
| 189 | |
| 190 | lock_release(&dm_unreplied_req_lk); |
| 191 | |
| 192 | ml = pkg_malloc(sizeof *ml); |
| 193 | if (!ml) { |
| 194 | LM_ERR("oom\n"); |
| 195 | return; |
| 196 | } |
| 197 | memset(ml, 0, sizeof *ml); |
| 198 | |
| 199 | ml->req = req; |
| 200 | ml->timeout_jf = get_ticks() + dm_unreplied_req_timeout; |
| 201 | |
| 202 | lock_get(&dm_unreplied_req_lk); |
| 203 | list_add_tail(&ml->list, &dm_unreplied_req); |
| 204 | lock_release(&dm_unreplied_req_lk); |
| 205 | } |
| 206 | |
| 207 | |
| 208 | int dm_remove_unreplied_req(struct msg *req) |
no test coverage detected