diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2015-03-22 00:57:16 +0100 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2015-03-22 00:57:16 +0100 |
commit | df387f268f8d30d0a21731406bf6031cd6ba9588 (patch) | |
tree | 1f1465524c01826a61f7c5f7631c43cce41e6b62 /src/async.c | |
parent | 5266f01d3295e7ac79cf25674167382b86817019 (diff) | |
download | fastd-df387f268f8d30d0a21731406bf6031cd6ba9588.tar fastd-df387f268f8d30d0a21731406bf6031cd6ba9588.zip |
Refactor poll API
Diffstat (limited to 'src/async.c')
-rw-r--r-- | src/async.c | 8 |
1 files changed, 5 insertions, 3 deletions
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) { |