aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordberg.se>2019-04-26 00:32:38 +0200
committerLinus Nordberg <linus@nordberg.se>2019-04-26 00:32:38 +0200
commitcff9a57e5576d0a2a32200cdec6d95f8888eb1e4 (patch)
treee054bad9219862a514bbcee445ea7aeaf8422711
parentUse blocking I/O in client (diff)
downloadwg-dynamic-cff9a57e5576d0a2a32200cdec6d95f8888eb1e4.tar.xz
wg-dynamic-cff9a57e5576d0a2a32200cdec6d95f8888eb1e4.zip
Remove 'now'
There's no need for a variable for the current time at this point.
-rw-r--r--wg-dynamic-client.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/wg-dynamic-client.c b/wg-dynamic-client.c
index 4e78c31..e561d44 100644
--- a/wg-dynamic-client.c
+++ b/wg-dynamic-client.c
@@ -425,7 +425,7 @@ int main(int argc __attribute__((unused)), char *argv[] __attribute__((unused)))
{
int *fd = &our_fd;
struct wg_dynamic_request req = { 0 };
- uint32_t now = current_time(), naptime;
+ uint32_t naptime;
progname = argv[0];
if (argc != 2)
@@ -451,7 +451,7 @@ int main(int argc __attribute__((unused)), char *argv[] __attribute__((unused)))
if (our_gaddr4.ip.ip4.s_addr ||
!IN6_IS_ADDR_UNSPECIFIED(&our_gaddr6.ip.ip6)) {
- our_lease.start = now;
+ our_lease.start = current_time();
our_lease.leasetime = 15;
memcpy(&our_lease.ip4, &our_gaddr4,
sizeof(struct wg_combined_ip));
@@ -460,8 +460,7 @@ int main(int argc __attribute__((unused)), char *argv[] __attribute__((unused)))
}
while (1) {
- now = current_time();
- naptime = time_until_refresh(now, &our_lease);
+ naptime = time_until_refresh(current_time(), &our_lease);
sleep(MAX(1, naptime));
if (*fd == -1 && try_connect(fd))