Browse code

usrloc: set last keepalive value to current time on new records

- do not rely on last modified value, can be loaded from db and be too
old

(cherry picked from commit 60f04b6d6f51b55294d22722df3f351a76cbfb9b)

Daniel-Constantin Mierla authored on 25/09/2020 07:38:39
Showing 1 changed files
... ...
@@ -26,8 +26,8 @@
26 26
  * - Module: \ref usrloc
27 27
  */
28 28
 
29
-#include "ucontact.h"
30
-#include <string.h>             /* memcpy */
29
+#include <string.h>
30
+#include <time.h>
31 31
 #include "../../core/mem/shm_mem.h"
32 32
 #include "../../core/ut.h"
33 33
 #include "../../core/ip_addr.h"
... ...
@@ -129,7 +129,7 @@ ucontact_t* new_ucontact(str* _dom, str* _aor, str* _contact, ucontact_info_t* _
129 129
 	c->methods = _ci->methods;
130 130
 	c->reg_id = _ci->reg_id;
131 131
 	c->last_modified = _ci->last_modified;
132
-	c->last_keepalive = _ci->last_modified;
132
+	c->last_keepalive = time(NULL);
133 133
 	c->tcpconn_id = _ci->tcpconn_id;
134 134
 	c->server_id = _ci->server_id;
135 135
 	c->keepalive = (_ci->cflags & ul_nat_bflag)?1:0;
... ...
@@ -295,7 +295,7 @@ int mem_update_ucontact(ucontact_t* _c, ucontact_info_t* _ci)
295 295
 	_c->cseq = _ci->cseq;
296 296
 	_c->methods = _ci->methods;
297 297
 	_c->last_modified = _ci->last_modified;
298
-	_c->last_keepalive = _ci->last_modified;
298
+	_c->last_keepalive = time(NULL);
299 299
 	_c->flags = _ci->flags;
300 300
 	_c->cflags = _ci->cflags;
301 301
 	_c->server_id = _ci->server_id;