From d658f3ed913affe96511309c6bf3d37aaec2910f Mon Sep 17 00:00:00 2001 From: "/C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org" Date: Wed, 23 Jan 2008 12:15:25 +0000 Subject: Max Kellermann : introduce alarm_pending() --- src/alarm.c | 8 ++++++++ src/cache_timer.c | 3 +++ 2 files changed, 11 insertions(+) (limited to 'src') diff --git a/src/alarm.c b/src/alarm.c index 7352ccb..4b23bd1 100644 --- a/src/alarm.c +++ b/src/alarm.c @@ -70,6 +70,14 @@ void del_alarm(struct alarm_list *alarm) list_del_init(&alarm->head); } +int alarm_pending(struct alarm_list *alarm) +{ + if (list_empty(&alarm->head)) + return 0; + + return 1; +} + static struct timeval * calculate_next_run(struct timeval *cand, struct timeval *tv, diff --git a/src/cache_timer.c b/src/cache_timer.c index 86bb8fc..fe997ec 100644 --- a/src/cache_timer.c +++ b/src/cache_timer.c @@ -60,6 +60,9 @@ static int timer_dump(struct us_conntrack *u, void *data, char *buf, int type) if (type == NFCT_O_XML) return 0; + if (!alarm_pending(alarm)) + return 0; + gettimeofday(&tv, NULL); timersub(&tv, &alarm->tv, &tmp); return sprintf(buf, " [expires in %lds]", tmp.tv_sec); -- cgit v1.2.3