2
0
Эх сурвалжийг харах

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
Konstantin Poliakov 7 жил өмнө
parent
commit
944dc1dc1e

+ 1 - 10
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;