| 635 | } |
| 636 | |
| 637 | static void mi_script_async_start_job(int sender, void *param) |
| 638 | { |
| 639 | struct mi_script_async_job *job = (struct mi_script_async_job *)param; |
| 640 | struct mi_handler *hdl = NULL; |
| 641 | mi_response_t *resp = NULL; |
| 642 | mi_request_t *req; |
| 643 | |
| 644 | if (job->cmd->flags & MI_ASYNC_RPL_FLAG) { |
| 645 | hdl = shm_malloc(sizeof *hdl); |
| 646 | if (hdl) { |
| 647 | hdl->handler_f = mi_script_notify_async_job; |
| 648 | hdl->param = job; |
| 649 | } else { |
| 650 | LM_ERR("could not create async handler!\n"); |
| 651 | } |
| 652 | } |
| 653 | |
| 654 | /* backup @req now, before exposing @job to other procs */ |
| 655 | req = job->req; |
| 656 | job->req = NULL; |
| 657 | |
| 658 | resp = handle_mi_request(req, job->cmd, hdl); |
| 659 | if (resp != MI_ASYNC_RPL) { |
| 660 | mi_script_async_job(resp, job); |
| 661 | free_mi_response(resp); |
| 662 | } |
| 663 | |
| 664 | mi_script_free_request(req, 1); |
| 665 | } |
| 666 | |
| 667 | /* we use this just for notifying that the request is terminated */ |
| 668 | static int mi_script_async_resume(int fd, |
nothing calls this directly
no test coverage detected