Skip to content

Commit

Permalink
pua: use parameter default_expires instead of 3600 constant
Browse files Browse the repository at this point in the history
- GH #2994
  • Loading branch information
miconda committed Jan 5, 2022
1 parent 6ce9c3c commit 50a976f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions src/modules/pua/pua.c
Expand Up @@ -58,7 +58,7 @@ htable_t* HashT= NULL;
int HASH_SIZE= -1;
extern int bind_pua(pua_api_t* api);
int min_expires= 0;
int default_expires=3600;
int pua_default_expires=3600;
static str db_url = str_init(DEFAULT_DB_URL);
str db_table= str_init("pua");
int update_period= 100;
Expand Down Expand Up @@ -126,7 +126,7 @@ static param_export_t params[]={
{"db_url", PARAM_STR, &db_url},
{"db_table", PARAM_STR, &db_table},
{"min_expires", INT_PARAM, &min_expires},
{"default_expires", INT_PARAM, &default_expires},
{"default_expires", INT_PARAM, &pua_default_expires},
{"update_period", INT_PARAM, &update_period},
{"outbound_proxy", PARAM_STR, &outbound_proxy},
{"dlginfo_increase_version", INT_PARAM, &dlginfo_increase_version},
Expand Down Expand Up @@ -162,8 +162,8 @@ static int mod_init(void)
if(min_expires< 0)
min_expires= 0;

if(default_expires< 600)
default_expires= 3600;
if(pua_default_expires< 600)
pua_default_expires= 3600;

if(pua_rpc_init()<0) {
LM_ERR("failed to register RPC commands\n");
Expand Down Expand Up @@ -702,7 +702,7 @@ int update_pua(ua_pres_t* p)
dlg_t* td = NULL;

if(p->desired_expires== 0)
expires= 3600;
expires= pua_default_expires;
else
expires= p->desired_expires- (int)time(NULL);

Expand Down Expand Up @@ -1255,4 +1255,4 @@ int mod_register(char *path, int *dlflags, void *p1, void *p2)
{
sr_kemi_modules_add(sr_kemi_pua_exports);
return 0;
}
}
2 changes: 1 addition & 1 deletion src/modules/pua/pua.h
Expand Up @@ -43,7 +43,7 @@ extern htable_t* HashT;
extern int HASH_SIZE;
extern int min_expires;
extern int pua_ul_publish;
extern int default_expires;
extern int pua_default_expires;
extern str outbound_proxy;
extern int check_remote_contact;
extern int dbmode;
Expand Down
2 changes: 1 addition & 1 deletion src/modules/pua/send_publish.c
Expand Up @@ -668,7 +668,7 @@ int send_publish( publ_info_t* publ )

if(publ->flag & UPDATE_TYPE)
LM_DBG("etag:%.*s\n", etag.len, etag.s);
str_hdr = publ_build_hdr((publ->expires< 0)?3600:publ->expires, ev, &publ->content_type,
str_hdr = publ_build_hdr((publ->expires< 0)?pua_default_expires:publ->expires, ev, &publ->content_type,
(publ->flag & UPDATE_TYPE)?&etag:NULL, publ->extra_headers, (body)?1:0);

if(str_hdr == NULL)
Expand Down
2 changes: 1 addition & 1 deletion src/modules/pua/send_subscribe.c
Expand Up @@ -971,7 +971,7 @@ int send_subscribe(subs_info_t* subs)
subs->source_flag= XMPP_SUBSCRIBE;

if(subs->expires< 0)
expires= 3600;
expires= pua_default_expires;
else
expires= subs->expires;

Expand Down

0 comments on commit 50a976f

Please sign in to comment.