sim/rptun: Trigger the callback only the sequnece number change

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2021-07-14 01:50:22 +08:00 committed by Gustavo Henrique Nihei
parent 12b2b7c240
commit 1efc9fbac6
1 changed files with 5 additions and 1 deletions

View File

@ -224,16 +224,20 @@ void up_rptun_loop(void)
{
if (dev->shmem != NULL)
{
bool should_notify = false;
if (dev->master && dev->seq != dev->shmem->seqs)
{
dev->seq = dev->shmem->seqs;
should_notify = true;
}
else if (!dev->master && dev->seq != dev->shmem->seqm)
{
dev->seq = dev->shmem->seqm;
should_notify = true;
}
if (dev->callback != NULL)
if (should_notify && dev->callback != NULL)
{
dev->callback(dev->arg, RPTUN_NOTIFY_ALL);
}