From 2dc97e2b5c06f8fafcefe413592de3251a57d923 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Fri, 2 Jan 2015 15:28:30 +0000 Subject: Add skaclient_syncify for easier async/sync handling --- src/libunixonacid/skaclient_send.c | 2 +- src/libunixonacid/skaclient_sendmsg.c | 10 +++------- src/libunixonacid/skaclient_sendmsgv.c | 10 +++------- 3 files changed, 7 insertions(+), 15 deletions(-) (limited to 'src/libunixonacid') diff --git a/src/libunixonacid/skaclient_send.c b/src/libunixonacid/skaclient_send.c index 8bd31ab..38dcddb 100644 --- a/src/libunixonacid/skaclient_send.c +++ b/src/libunixonacid/skaclient_send.c @@ -1,8 +1,8 @@ /* ISC license. */ -#include #include #include +#include int skaclient_send (skaclient_t *a, char const *s, unsigned int len, unixmessage_handler_func_t *cb, void *result, tain_t const *deadline, tain_t *stamp) { diff --git a/src/libunixonacid/skaclient_sendmsg.c b/src/libunixonacid/skaclient_sendmsg.c index 3f88ec7..49cfbea 100644 --- a/src/libunixonacid/skaclient_sendmsg.c +++ b/src/libunixonacid/skaclient_sendmsg.c @@ -1,15 +1,11 @@ /* ISC license. */ -#include -#include #include #include +#include int skaclient_sendmsg_and_close (skaclient_t *a, unixmessage_t const *m, unsigned char const *bits, unixmessage_handler_func_t *cb, void *result, tain_t const *deadline, tain_t *stamp) { - register int r ; - if (!skaclient_putmsg_and_close(a, m, bits, cb, result)) return 0 ; - if (!skaclient_timed_flush(a, deadline, stamp)) return 0 ; - r = skaclient_timed_supdate(a, deadline, stamp) ; - return r < 0 ? 0 : !r ? (errno = EPIPE, 0) : 1 ; + return skaclient_putmsg_and_close(a, m, bits, cb, result) + && skaclient_syncify(a, deadline, stamp) ; } diff --git a/src/libunixonacid/skaclient_sendmsgv.c b/src/libunixonacid/skaclient_sendmsgv.c index ac4bcdb..6584173 100644 --- a/src/libunixonacid/skaclient_sendmsgv.c +++ b/src/libunixonacid/skaclient_sendmsgv.c @@ -1,15 +1,11 @@ /* ISC license. */ -#include -#include #include #include +#include int skaclient_sendmsgv_and_close (skaclient_t *a, unixmessage_v_t const *m, unsigned char const *bits, unixmessage_handler_func_t *cb, void *result, tain_t const *deadline, tain_t *stamp) { - register int r ; - if (!skaclient_putmsgv_and_close(a, m, bits, cb, result)) return 0 ; - if (!skaclient_timed_flush(a, deadline, stamp)) return 0 ; - r = skaclient_timed_supdate(a, deadline, stamp) ; - return r < 0 ? 0 : !r ? (errno = EPIPE, 0) : 1 ; + return skaclient_putmsgv_and_close(a, m, bits, cb, result) + && skaclient_syncify(a, deadline, stamp) ; } -- cgit v1.2.3