|
|
|
|
@ -91,6 +91,8 @@ timer* sip_trans::get_timer(unsigned int timer_type)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
char _timer_name_lookup[] = {'0','A','B','D','E','F','K','G','H','I','J','L'};
|
|
|
|
|
#define timer_name(type) \
|
|
|
|
|
(_timer_name_lookup[(type) & 0xFFFF])
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Resets a specific timer
|
|
|
|
|
@ -104,7 +106,7 @@ void sip_trans::reset_timer(timer* t, unsigned int timer_type)
|
|
|
|
|
|
|
|
|
|
if(*tp != NULL){
|
|
|
|
|
|
|
|
|
|
DBG("Clearing old timer of type %c\n",_timer_name_lookup[(*tp)->type]);
|
|
|
|
|
DBG("Clearing old timer of type %c\n",timer_name((*tp)->type));
|
|
|
|
|
wheeltimer::instance()->remove_timer(*tp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -121,12 +123,12 @@ void trans_timer_cb(timer* t, unsigned int bucket_id, sip_trans* tr)
|
|
|
|
|
bucket->lock();
|
|
|
|
|
if(bucket->exist(tr)){
|
|
|
|
|
DBG("Transaction timer expired: type=%c, trans=%p, eta=%i, t=%i\n",
|
|
|
|
|
_timer_name_lookup[t->type],tr,t->expires,wheeltimer::instance()->wall_clock);
|
|
|
|
|
timer_name(t->type),tr,t->expires,wheeltimer::instance()->wall_clock);
|
|
|
|
|
trans_layer::instance()->timer_expired(t,bucket,tr);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
WARN("Transaction %p does not exist anymore\n",tr);
|
|
|
|
|
WARN("Timer type=%c will be deleted without further processing\n",_timer_name_lookup[t->type]);
|
|
|
|
|
WARN("Timer type=%c will be deleted without further processing\n",timer_name(t->type));
|
|
|
|
|
}
|
|
|
|
|
bucket->unlock();
|
|
|
|
|
}
|
|
|
|
|
@ -144,16 +146,13 @@ void trans_timer_cb(timer* t, unsigned int bucket_id, sip_trans* tr)
|
|
|
|
|
void sip_trans::reset_timer(unsigned int timer_type, unsigned int expire_delay /* ms */,
|
|
|
|
|
unsigned int bucket_id)
|
|
|
|
|
{
|
|
|
|
|
timer_type &= 0xFFFF;
|
|
|
|
|
assert(timer_type < sizeof(_timer_name_lookup));
|
|
|
|
|
|
|
|
|
|
wheeltimer* wt = wheeltimer::instance();
|
|
|
|
|
|
|
|
|
|
unsigned int expires = expire_delay / (TIMER_RESOLUTION/1000);
|
|
|
|
|
expires += wt->wall_clock;
|
|
|
|
|
|
|
|
|
|
DBG("New timer of type %c at time=%i\n",
|
|
|
|
|
_timer_name_lookup[timer_type],expires);
|
|
|
|
|
DBG("New timer of type %c at time=%i (repeated=%i)\n",
|
|
|
|
|
timer_name(timer_type),expires,timer_type>>16);
|
|
|
|
|
|
|
|
|
|
timer* t = new timer(timer_type,expires,
|
|
|
|
|
(timer_cb)trans_timer_cb,
|
|
|
|
|
|