diff options
author | harti <harti@FreeBSD.org> | 2005-04-29 11:02:18 +0000 |
---|---|---|
committer | harti <harti@FreeBSD.org> | 2005-04-29 11:02:18 +0000 |
commit | 8bf5d359a297f85eced632d52abdb72d334412c5 (patch) | |
tree | 1fc08d5676bf753cb94100e74447700671b22830 /contrib/bsnmp/snmpd | |
parent | f3155bccfa09ac6972f928ee53020c5eb12fec99 (diff) | |
download | FreeBSD-src-8bf5d359a297f85eced632d52abdb72d334412c5.zip FreeBSD-src-8bf5d359a297f85eced632d52abdb72d334412c5.tar.gz |
Vendor patch: fix a bug that was introduced when moving from libisc to
libbegemot: the rpoll_start_timer function needs the timeout value in
milli-seconds, not the absolute time when the timer should tick.
Diffstat (limited to 'contrib/bsnmp/snmpd')
-rw-r--r-- | contrib/bsnmp/snmpd/main.c | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/contrib/bsnmp/snmpd/main.c b/contrib/bsnmp/snmpd/main.c index 7cb1aa3..9c73620 100644 --- a/contrib/bsnmp/snmpd/main.c +++ b/contrib/bsnmp/snmpd/main.c @@ -1634,9 +1634,7 @@ void * timer_start(u_int ticks, void (*func)(void *), void *udata, struct lmodule *mod) { struct timer *tp; -#ifdef USE_LIBBEGEMOT - struct timeval due; -#else +#ifndef USE_LIBBEGEMOT struct timespec due; #endif @@ -1644,15 +1642,8 @@ timer_start(u_int ticks, void (*func)(void *), void *udata, struct lmodule *mod) syslog(LOG_CRIT, "out of memory for timer"); exit(1); } -#ifdef USE_LIBBEGEMOT - (void)gettimeofday(&due, NULL); - due.tv_sec += ticks / 100; - due.tv_usec += (ticks % 100) * 10000; - if (due.tv_usec >= 1000000) { - due.tv_sec++; - due.tv_usec -= 1000000; - } -#else + +#ifndef USE_LIBBEGEMOT due = evAddTime(evNowTime(), evConsTime(ticks / 100, (ticks % 100) * 10000)); #endif @@ -1664,8 +1655,7 @@ timer_start(u_int ticks, void (*func)(void *), void *udata, struct lmodule *mod) LIST_INSERT_HEAD(&timer_list, tp, link); #ifdef USE_LIBBEGEMOT - if ((tp->id = poll_start_timer(due.tv_sec * 1000 + due.tv_usec / 1000, - 0, tfunc, tp)) < 0) { + if ((tp->id = poll_start_timer(ticks * 10, 0, tfunc, tp)) < 0) { syslog(LOG_ERR, "cannot set timer: %m"); exit(1); } |