From: krw Date: Sun, 18 Jun 2017 17:01:46 +0000 (+0000) Subject: Convert last set_timeout() use to set_timeout_interval() and X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=ed58d33a498447ce0aebc89af7e3311567e31f8b;p=openbsd Convert last set_timeout() use to set_timeout_interval() and then remove set_timeout() and rename set_timeout_interval() to set_timeout(). --- diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c index 2048fa3962a..468fdfd256c 100644 --- a/sbin/dhclient/dhclient.c +++ b/sbin/dhclient/dhclient.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhclient.c,v 1.435 2017/06/18 16:37:19 krw Exp $ */ +/* $OpenBSD: dhclient.c,v 1.436 2017/06/18 17:01:46 krw Exp $ */ /* * Copyright 2004 Henning Brauer @@ -734,12 +734,12 @@ state_preboot(struct interface_info *ifi) if (ifi->linkstat) { ifi->state = S_REBOOTING; - set_timeout_interval(1, state_reboot, ifi); + set_timeout(1, state_reboot, ifi); } else { if (interval > config->link_timeout) go_daemon(); ifi->state = S_PREBOOT; - set_timeout_interval(1, state_preboot, ifi); + set_timeout(1, state_preboot, ifi); } } @@ -1128,7 +1128,7 @@ newlease: ifi->state = S_BOUND; /* Set timeout to start the renewal process. */ - set_timeout(ifi->active->renewal, state_bound, ifi); + set_timeout(ifi->active->renewal - cur_time, state_bound, ifi); } /* @@ -1394,7 +1394,7 @@ send_discover(struct interface_info *ifi) log_warnx("dhclient cannot be used on %s", ifi->name); quit = INTERNALSIG; } else - set_timeout_interval(ifi->interval, send_discover, ifi); + set_timeout(ifi->interval, send_discover, ifi); } /* @@ -1418,7 +1418,7 @@ state_panic(struct interface_info *ifi) */ log_info("No working leases in persistent database - sleeping."); ifi->state = S_INIT; - set_timeout_interval(config->retry_interval, state_init, ifi); + set_timeout(config->retry_interval, state_init, ifi); go_daemon(); } @@ -1524,7 +1524,7 @@ send_request(struct interface_info *ifi) send_packet(ifi, from, destination.sin_addr); - set_timeout_interval(ifi->interval, send_request, ifi); + set_timeout(ifi->interval, send_request, ifi); } void diff --git a/sbin/dhclient/dhcpd.h b/sbin/dhclient/dhcpd.h index 633691d9601..0cdcd566661 100644 --- a/sbin/dhclient/dhcpd.h +++ b/sbin/dhclient/dhcpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dhcpd.h,v 1.187 2017/06/18 11:21:39 krw Exp $ */ +/* $OpenBSD: dhcpd.h,v 1.188 2017/06/18 17:01:46 krw Exp $ */ /* * Copyright (c) 2004 Henning Brauer @@ -215,8 +215,6 @@ ssize_t receive_packet(struct interface_info *, struct sockaddr_in *, void dispatch(struct interface_info *); void set_timeout(time_t, void (*)(struct interface_info *), struct interface_info *); -void set_timeout_interval(time_t, void (*)(struct interface_info *), - struct interface_info *); void cancel_timeout(void); void interface_link_forceup(char *); int interface_status(struct interface_info *); diff --git a/sbin/dhclient/dispatch.c b/sbin/dhclient/dispatch.c index 4138f703f92..62308ec073c 100644 --- a/sbin/dhclient/dispatch.c +++ b/sbin/dhclient/dispatch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dispatch.c,v 1.122 2017/06/14 20:27:08 krw Exp $ */ +/* $OpenBSD: dispatch.c,v 1.123 2017/06/18 17:01:46 krw Exp $ */ /* * Copyright 2004 Henning Brauer @@ -280,16 +280,7 @@ interface_status(struct interface_info *ifi) } void -set_timeout(time_t when, void (*where)(struct interface_info *), - struct interface_info *ifi) -{ - timeout.when = when; - timeout.func = where; - timeout.ifi = ifi; -} - -void -set_timeout_interval(time_t secs, void (*where)(struct interface_info *), +set_timeout(time_t secs, void (*where)(struct interface_info *), struct interface_info *ifi) { timeout.when = time(NULL) + secs;