Skip to content

Commit

Permalink
usrloc: use UL_DB_EXPIRES_SET() inside get_all_db_ucontacts()
Browse files Browse the repository at this point in the history
- fix matching date field for some backends, such as mongodb, as well as
obey ul_expires_type value

(cherry picked from commit 944dc1d)
  • Loading branch information
Konstantin Poliakov authored and miconda committed May 9, 2018
1 parent d75068d commit e0c84fc
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions src/modules/usrloc/dlist.c
Expand Up @@ -97,8 +97,6 @@ static inline int get_all_db_ucontacts(void *buf, int len, unsigned int flags,
db1_res_t* res = NULL;
db_row_t *row;
dlist_t *dom;
str now;
char now_s[25];
int port, proto;
char *p;
str addr;
Expand All @@ -121,13 +119,6 @@ static inline int get_all_db_ucontacts(void *buf, int len, unsigned int flags,
/* Reserve space for terminating 0000 */
len -= sizeof(addr.len);

/* get the current time in DB format */
now.len = 25;
now.s = now_s;
if (db_time2str_ex( time(0), now.s, &now.len, 0)!=0) {
LM_ERR("failed to print now time\n");
return -1;
}
aorhash = 0;

/* select fields */
Expand All @@ -143,7 +134,7 @@ static inline int get_all_db_ucontacts(void *buf, int len, unsigned int flags,
ops1[0] = OP_GT;
vals1[0].type = DB1_STR;
vals1[0].nul = 0;
vals1[0].val.str_val = now;
UL_DB_EXPIRES_SET(&vals1[0], time(0));

keys1[1] = &partition_col;
ops1[1] = OP_EQ;
Expand Down

0 comments on commit e0c84fc

Please sign in to comment.