Module: kamailio
Branch: master
Commit: 944dc1dc1e6261a3c179ff11bf3531e379eb9f35
URL:
https://github.com/kamailio/kamailio/commit/944dc1dc1e6261a3c179ff11bf3531e…
Author: Konstantin Poliakov <k.polyakov(a)mightycall.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2018-05-02T08:19:10+02:00
usrloc: use UL_DB_EXPIRES_SET() inside get_all_db_ucontacts()
- fix matching date field for some backends, such as mongodb, as well as
obey ul_expires_type value
---
Modified: src/modules/usrloc/dlist.c
---
Diff:
https://github.com/kamailio/kamailio/commit/944dc1dc1e6261a3c179ff11bf3531e…
Patch:
https://github.com/kamailio/kamailio/commit/944dc1dc1e6261a3c179ff11bf3531e…
---
diff --git a/src/modules/usrloc/dlist.c b/src/modules/usrloc/dlist.c
index f649130a98..c2b3e15791 100644
--- a/src/modules/usrloc/dlist.c
+++ b/src/modules/usrloc/dlist.c
@@ -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;
@@ -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 */
@@ -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;