summaryrefslogtreecommitdiff
path: root/usr.sbin/ldpd/neighbor.c
diff options
context:
space:
mode:
authorRenato Westphal <renato@cvs.openbsd.org>2016-05-23 15:57:51 +0000
committerRenato Westphal <renato@cvs.openbsd.org>2016-05-23 15:57:51 +0000
commita91920932b73637e1e04370c2f94e9b7d86f6792 (patch)
treeb59c27be905ea51112c237f39a95a3de9cc17346 /usr.sbin/ldpd/neighbor.c
parent42abb432d9a0bf14357bb96f409eb021c9e27447 (diff)
Remove duplicated code in timer functions.
Diffstat (limited to 'usr.sbin/ldpd/neighbor.c')
-rw-r--r--usr.sbin/ldpd/neighbor.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/usr.sbin/ldpd/neighbor.c b/usr.sbin/ldpd/neighbor.c
index d031f5de3bb..566cefc57bb 100644
--- a/usr.sbin/ldpd/neighbor.c
+++ b/usr.sbin/ldpd/neighbor.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: neighbor.c,v 1.57 2016/05/23 15:49:31 renato Exp $ */
+/* $OpenBSD: neighbor.c,v 1.58 2016/05/23 15:57:50 renato Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
@@ -320,26 +320,19 @@ void
nbr_ktimer(int fd, short event, void *arg)
{
struct nbr *nbr = arg;
- struct timeval tv;
send_keepalive(nbr);
-
- timerclear(&tv);
- tv.tv_sec = (time_t)(nbr->keepalive / KEEPALIVE_PER_PERIOD);
- if (evtimer_add(&nbr->keepalive_timer, &tv) == -1)
- fatal(__func__);
+ nbr_start_ktimer(nbr);
}
void
nbr_start_ktimer(struct nbr *nbr)
{
- struct timeval tv;
+ struct timeval tv;
+ /* send three keepalives per period */
timerclear(&tv);
-
- /* XXX: just to be sure it will send three keepalives per period */
tv.tv_sec = (time_t)(nbr->keepalive / KEEPALIVE_PER_PERIOD);
-
if (evtimer_add(&nbr->keepalive_timer, &tv) == -1)
fatal(__func__);
}