From df387f268f8d30d0a21731406bf6031cd6ba9588 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 22 Mar 2015 00:57:16 +0100 Subject: Refactor poll API --- src/async.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/async.c') diff --git a/src/async.c b/src/async.c index d05b8c5..50efeac 100644 --- a/src/async.c +++ b/src/async.c @@ -56,8 +56,10 @@ void fastd_async_init(void) { fastd_setnonblock(fds[1]); #endif - ctx.async_rfd = fds[0]; + ctx.async_rfd = FASTD_POLL_FD(POLL_TYPE_ASYNC, fds[0]); ctx.async_wfd = fds[1]; + + fastd_poll_fd_register(&ctx.async_rfd); } /** Handles a DNS resolver response */ @@ -104,7 +106,7 @@ void fastd_async_handle(void) { .msg_iovlen = 1, }; - if (recvmsg(ctx.async_rfd, &msg, MSG_PEEK) < 0) + if (recvmsg(ctx.async_rfd.fd, &msg, MSG_PEEK) < 0) exit_errno("fastd_async_handle: recvmsg"); uint8_t buf[header.len] __attribute__((aligned(8))); @@ -112,7 +114,7 @@ void fastd_async_handle(void) { vec[1].iov_len = sizeof(buf); msg.msg_iovlen = 2; - if (recvmsg(ctx.async_rfd, &msg, 0) < 0) + if (recvmsg(ctx.async_rfd.fd, &msg, 0) < 0) exit_errno("fastd_async_handle: recvmsg"); switch (header.type) { -- cgit v1.2.3