Module: sip-router
Branch: master
Commit: cc33486a8c17ae2cb4cbb5fce42f7a73646cd3c1
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=cc33486…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Tue Nov 22 11:30:02 2011 +0100
pv: use msg pid to check the integrity of cached time
- safer when dealing with async or failure processing
---
modules_k/pv/pv_time.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/modules_k/pv/pv_time.c b/modules_k/pv/pv_time.c
index 72f1134..ad7dd2c 100644
--- a/modules_k/pv/pv_time.c
+++ b/modules_k/pv/pv_time.c
@@ -36,13 +36,16 @@
#include "pv_time.h"
static unsigned int _pv_msg_id = 0;
+static int _pv_msg_pid = 0;
static time_t _pv_msg_tm = 0;
+
static int pv_update_time(struct sip_msg *msg, time_t *t)
{
- if(_pv_msg_id != msg->id || _pv_msg_tm==0)
+ if(_pv_msg_id != msg->id || _pv_msg_pid != msg->pid || _pv_msg_tm==0)
{
_pv_msg_tm = time(NULL);
_pv_msg_id = msg->id;
+ _pv_msg_pid = msg->pid;
if(t!=NULL)
*t=_pv_msg_tm;