diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2014-04-10 21:04:27 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2014-04-10 21:04:27 +0200 |
commit | e5a8f900352b242860ac3dd4e3b39c7297169480 (patch) | |
tree | 6044dfb9aea951575e63552f518c52399638d7eb /src/resolve.c | |
parent | 80f981c0521dc8d7202d27430f3a5280bbd8484d (diff) | |
download | fastd-e5a8f900352b242860ac3dd4e3b39c7297169480.tar fastd-e5a8f900352b242860ac3dd4e3b39c7297169480.zip |
Add support for multiple async message types
Diffstat (limited to 'src/resolve.c')
-rw-r--r-- | src/resolve.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/resolve.c b/src/resolve.c index 6267838..ead1985 100644 --- a/src/resolve.c +++ b/src/resolve.c @@ -26,6 +26,7 @@ #include "fastd.h" #include "peer.h" +#include "async.h" #include <netdb.h> #include <pthread.h> @@ -69,8 +70,8 @@ static void* resolve_peer(void *varg) { n_addr++; } - uint8_t retbuf[sizeof(fastd_resolve_return_t) + n_addr*sizeof(fastd_peer_address_t)] __attribute__((aligned(8))); - fastd_resolve_return_t *ret = (fastd_resolve_return_t*)retbuf; + uint8_t retbuf[sizeof(fastd_async_resolve_return_t) + n_addr*sizeof(fastd_peer_address_t)] __attribute__((aligned(8))); + fastd_async_resolve_return_t *ret = (fastd_async_resolve_return_t*)retbuf; ret->remote = arg->remote; if (n_addr) { @@ -94,8 +95,7 @@ static void* resolve_peer(void *varg) { ret->n_addr = n_addr; - if (write(arg->ctx->async_wfd, ret, sizeof(fastd_resolve_return_t) + n_addr*sizeof(fastd_peer_address_t)) < 0) - pr_error_errno(arg->ctx, "can't write resolve return"); + fastd_async_enqueue(arg->ctx, ASYNC_TYPE_RESOLVE_RETURN, ret, sizeof(fastd_async_resolve_return_t) + n_addr*sizeof(fastd_peer_address_t)); freeaddrinfo(res); free(arg->hostname); |