Skip to content

Commit

Permalink
rest_client: Improve previous commit (async timeouts)
Browse files Browse the repository at this point in the history
* fix corner-case causing module timeout to be discarded
* change logging level on transfer timeout from INFO -> ERR

(cherry picked from commit 1ecb324)
  • Loading branch information
liviuchircu committed Dec 14, 2023
1 parent 51c76af commit 638e746
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion modules/rest_client/rest_methods.c
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,7 @@ static enum async_ret_code _resume_async_http_req(int fd, struct sip_msg *msg,
if (timed_out) {
char *url = NULL;
curl_easy_getinfo(param->handle, CURLINFO_EFFECTIVE_URL, &url);
LM_INFO("async %s timed out, URL: %s\n",
LM_ERR("async %s timed out, URL: %s\n",
rest_client_method_str(param->method), url);
goto cleanup;
}
Expand Down
7 changes: 4 additions & 3 deletions modules/tm/async.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,11 +336,12 @@ int t_handle_async(struct sip_msg *msg, struct action* a , int resume_route,
timeout = 0;
LM_ERR("this async function has no support for timeouts -- "
"still using an infinite timeout!\n");
} else if (ctx->async.timeout_f && ctx->async.timeout_s
&& ctx->async.timeout_s < timeout) {
timeout = ctx->async.timeout_s;
}

if (ctx->async.timeout_f && ctx->async.timeout_s
&& (!timeout || ctx->async.timeout_s < timeout))
timeout = ctx->async.timeout_s;

/* place the FD + resume function (as param) into reactor */
if (reactor_add_reader_with_timeout( fd, F_SCRIPT_ASYNC,
RCT_PRIO_ASYNC, timeout, (void*)ctx)<0) {
Expand Down

0 comments on commit 638e746

Please sign in to comment.