aboutsummaryrefslogtreecommitdiffstats
path: root/wg-dynamic-client.c
diff options
context:
space:
mode:
authorThomas Gschwantner <tharre3@gmail.com>2019-06-14 20:12:25 +0200
committerThomas Gschwantner <tharre3@gmail.com>2019-06-14 20:14:47 +0200
commit5b14f8e69f5bfa85708b190c34479bd539297bfe (patch)
tree6c0d7263d80b7229ffd071ca96262d73dc343df1 /wg-dynamic-client.c
parentRemove CLOCK_MONOTONIC comment (diff)
downloadwg-dynamic-5b14f8e69f5bfa85708b190c34479bd539297bfe.tar.xz
wg-dynamic-5b14f8e69f5bfa85708b190c34479bd539297bfe.zip
Use epoll() instead of poll()
This enables us to later use the timeout parameter of epoll_wait() to timely remove expired leases.
Diffstat (limited to 'wg-dynamic-client.c')
-rw-r--r--wg-dynamic-client.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/wg-dynamic-client.c b/wg-dynamic-client.c
index 2224a22..8dcbd80 100644
--- a/wg-dynamic-client.c
+++ b/wg-dynamic-client.c
@@ -390,13 +390,6 @@ static bool handle_response(int fd, struct wg_dynamic_request *req)
return true;
}
-static bool read_response(int fd, struct wg_dynamic_request *req,
- bool (*success)(int, struct wg_dynamic_request *),
- bool (*error)(int, int))
-{
- return handle_request(fd, req, success, error);
-}
-
int main(int argc __attribute__((unused)), char *argv[] __attribute__((unused)))
{
int *fd = &our_fd;
@@ -446,9 +439,9 @@ int main(int argc __attribute__((unused)), char *argv[] __attribute__((unused)))
request_ip(*fd, &our_lease);
- while (!read_response(*fd, &req, handle_response, handle_error))
+ while (!handle_request(&req, handle_response, handle_error))
;
- close_connection(fd, &req);
+ close_connection(&req);
}
return 0;