send notify at timeout only when expires is 0
This commit is contained in:
parent
25dcee759c
commit
91b33112e9
3 changed files with 10 additions and 6 deletions
|
@ -279,9 +279,7 @@ static void subscribe_handler(struct sipevent_sock *sock,
|
|||
|
||||
(void)sipnot_reply(not, msg, 200, "OK");
|
||||
|
||||
if (expires > 0) {
|
||||
(void)sipnot_notify(not);
|
||||
}
|
||||
(void)sipnot_notify(not);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -110,11 +110,11 @@ static void tmr_handler(void *arg)
|
|||
|
||||
void sipnot_refresh(struct sipnot *not, uint32_t expires)
|
||||
{
|
||||
expires = min(expires, not->expires_max);
|
||||
not->expires = min(expires, not->expires_max);
|
||||
|
||||
re_printf("will expire in %u secs\n", expires);
|
||||
re_printf("will expire in %u secs\n", not->expires);
|
||||
|
||||
tmr_start(¬->tmr, expires * 1000, tmr_handler, not);
|
||||
tmr_start(¬->tmr, not->expires * 1000, tmr_handler, not);
|
||||
}
|
||||
|
||||
|
||||
|
@ -276,6 +276,11 @@ static int notify_request(struct sipnot *not, bool reset_ls)
|
|||
|
||||
int sipnot_notify(struct sipnot *not)
|
||||
{
|
||||
if (not->expires == 0) {
|
||||
re_printf("NOTIFY will be sent at timeout\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (not->req) {
|
||||
re_printf("waiting for previous request to complete\n");
|
||||
not->notify_pending = true;
|
||||
|
|
|
@ -35,6 +35,7 @@ struct sipnot {
|
|||
char *ctype;
|
||||
sipevent_close_h *closeh;
|
||||
void *arg;
|
||||
uint32_t expires;
|
||||
uint32_t expires_min;
|
||||
uint32_t expires_dfl;
|
||||
uint32_t expires_max;
|
||||
|
|
Loading…
Add table
Reference in a new issue