[sr-dev] git:5.4:a6cb7427: usrloc: set last keepalive value to current time on new records

Daniel-Constantin Mierla miconda at gmail.com
Fri Sep 25 09:42:05 CEST 2020


Module: kamailio
Branch: 5.4
Commit: a6cb7427ea8d98ba10d51e1fde3648bb1aca53b6
URL: https://github.com/kamailio/kamailio/commit/a6cb7427ea8d98ba10d51e1fde3648bb1aca53b6

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2020-09-25T09:41:38+02:00

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)

---

Modified: src/modules/usrloc/ucontact.c

---

Diff:  https://github.com/kamailio/kamailio/commit/a6cb7427ea8d98ba10d51e1fde3648bb1aca53b6.diff
Patch: https://github.com/kamailio/kamailio/commit/a6cb7427ea8d98ba10d51e1fde3648bb1aca53b6.patch

---

diff --git a/src/modules/usrloc/ucontact.c b/src/modules/usrloc/ucontact.c
index 256d9530c2..95ed8d530c 100644
--- a/src/modules/usrloc/ucontact.c
+++ b/src/modules/usrloc/ucontact.c
@@ -26,8 +26,8 @@
  * - Module: \ref usrloc
  */
 
-#include "ucontact.h"
-#include <string.h>             /* memcpy */
+#include <string.h>
+#include <time.h>
 #include "../../core/mem/shm_mem.h"
 #include "../../core/ut.h"
 #include "../../core/ip_addr.h"
@@ -129,7 +129,7 @@ ucontact_t* new_ucontact(str* _dom, str* _aor, str* _contact, ucontact_info_t* _
 	c->methods = _ci->methods;
 	c->reg_id = _ci->reg_id;
 	c->last_modified = _ci->last_modified;
-	c->last_keepalive = _ci->last_modified;
+	c->last_keepalive = time(NULL);
 	c->tcpconn_id = _ci->tcpconn_id;
 	c->server_id = _ci->server_id;
 	c->keepalive = (_ci->cflags & ul_nat_bflag)?1:0;
@@ -295,7 +295,7 @@ int mem_update_ucontact(ucontact_t* _c, ucontact_info_t* _ci)
 	_c->cseq = _ci->cseq;
 	_c->methods = _ci->methods;
 	_c->last_modified = _ci->last_modified;
-	_c->last_keepalive = _ci->last_modified;
+	_c->last_keepalive = time(NULL);
 	_c->flags = _ci->flags;
 	_c->cflags = _ci->cflags;
 	_c->server_id = _ci->server_id;




More information about the sr-dev mailing list