Skip to content

Commit

Permalink
ruxc: groupped setting request params in a function
Browse files Browse the repository at this point in the history
  • Loading branch information
miconda committed Aug 24, 2021
1 parent 5ad81a4 commit e979508
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions src/modules/ruxc/ruxc_mod.c
Expand Up @@ -131,6 +131,22 @@ static void mod_destroy(void)
return;
}

/**
*
*/
static void ruxc_request_params_init(RuxcHTTPRequest *v_http_request)
{
v_http_request->timeout = _ruxc_http_timeout;
v_http_request->timeout_connect = _ruxc_http_timeout;
v_http_request->timeout_read = _ruxc_http_timeout;
v_http_request->timeout_write = _ruxc_http_timeout;
v_http_request->tlsmode = _ruxc_http_tlsmode;
v_http_request->reuse = _ruxc_http_reuse;
v_http_request->retry = _ruxc_http_retry;
v_http_request->logtype = _ruxc_http_logtype;
v_http_request->debug = _ruxc_http_debug;
}

/**
*
*/
Expand All @@ -142,15 +158,7 @@ static int ki_ruxc_http_get_helper(sip_msg_t *_msg, str *url, str *hdrs,
pv_value_t val = {0};
int ret;

v_http_request.timeout = _ruxc_http_timeout;
v_http_request.timeout_connect = _ruxc_http_timeout;
v_http_request.timeout_read = _ruxc_http_timeout;
v_http_request.timeout_write = _ruxc_http_timeout;
v_http_request.tlsmode = _ruxc_http_tlsmode;
v_http_request.reuse = _ruxc_http_reuse;
v_http_request.retry = _ruxc_http_retry;
v_http_request.logtype = _ruxc_http_logtype;
v_http_request.debug = _ruxc_http_debug;
ruxc_request_params_init(&v_http_request);

v_http_request.url = url->s;
v_http_request.url_len = url->len;
Expand Down Expand Up @@ -243,15 +251,7 @@ static int ki_ruxc_http_post_helper(sip_msg_t *_msg, str *url, str *body, str *h
pv_value_t val = {0};
int ret;

v_http_request.timeout = _ruxc_http_timeout;
v_http_request.timeout_connect = _ruxc_http_timeout;
v_http_request.timeout_read = _ruxc_http_timeout;
v_http_request.timeout_write = _ruxc_http_timeout;
v_http_request.tlsmode = _ruxc_http_tlsmode;
v_http_request.reuse = _ruxc_http_reuse;
v_http_request.retry = _ruxc_http_retry;
v_http_request.logtype = _ruxc_http_logtype;
v_http_request.debug = _ruxc_http_debug;
ruxc_request_params_init(&v_http_request);

v_http_request.url = url->s;
v_http_request.url_len = url->len;
Expand Down

0 comments on commit e979508

Please sign in to comment.