Limit telegram squashing to 5s total
Before, only the time between adjacent telegrams was limited, not the total time.
This commit is contained in:
parent
4d046738fd
commit
5acdcfec63
1 changed files with 8 additions and 14 deletions
|
@ -51,9 +51,7 @@ static struct telstr last_tel[MAXNOC];
|
||||||
void
|
void
|
||||||
clear_telegram_is_new(natid to)
|
clear_telegram_is_new(natid to)
|
||||||
{
|
{
|
||||||
last_tel[to].tel_type = 0;
|
|
||||||
last_tel[to].tel_from = NATID_BAD;
|
last_tel[to].tel_from = NATID_BAD;
|
||||||
last_tel[to].tel_date = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -64,18 +62,14 @@ clear_telegram_is_new(natid to)
|
||||||
static int
|
static int
|
||||||
telegram_is_new(natid to, struct telstr *tel)
|
telegram_is_new(natid to, struct telstr *tel)
|
||||||
{
|
{
|
||||||
int is_new = 0;
|
if (tel->tel_from != last_tel[to].tel_from
|
||||||
|
|| tel->tel_type != last_tel[to].tel_type
|
||||||
is_new |= tel->tel_type != last_tel[to].tel_type;
|
|| (tel->tel_type != TEL_UPDATE
|
||||||
is_new |= tel->tel_from != last_tel[to].tel_from;
|
&& abs(tel->tel_date - last_tel[to].tel_date) > TEL_SECONDS)) {
|
||||||
is_new |= tel->tel_type != TEL_UPDATE &&
|
last_tel[to] = *tel;
|
||||||
abs(tel->tel_date - last_tel[to].tel_date) > TEL_SECONDS;
|
return 1;
|
||||||
|
}
|
||||||
last_tel[to].tel_type = tel->tel_type;
|
return 0;
|
||||||
last_tel[to].tel_from = tel->tel_from;
|
|
||||||
last_tel[to].tel_date = tel->tel_date;
|
|
||||||
|
|
||||||
return is_new;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue