diff options
Diffstat (limited to 'src/libs6/ftrigr_ack.c')
| -rw-r--r-- | src/libs6/ftrigr_ack.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/libs6/ftrigr_ack.c b/src/libs6/ftrigr_ack.c index 5c9a9f3..ac5ee7c 100644 --- a/src/libs6/ftrigr_ack.c +++ b/src/libs6/ftrigr_ack.c @@ -1,17 +1,16 @@ /* ISC license. */ -#include <stdint.h> +#include <errno.h> + #include <skalibs/genalloc.h> + #include <s6/ftrigr.h> +#include "ftrigr-internal.h" -void ftrigr_ack (ftrigr_t *a, size_t n) +int ftrigr_ack (ftrigr *a, uint32_t id) { - size_t len = genalloc_len(uint16_t, &a->list) ; - a->head += n ; - if (a->head > len) a->head = len ; - if (a->head == len) - { - a->head = 0 ; - genalloc_setlen(uint16_t, &a->list, 0) ; - } + ftrigr_data *p = genalloc_s(ftrigr_data, &a->data) + id ; + if (p->status && p->status != EAGAIN) return (errno = p->status, 0) ; + p->sa.len = 0 ; + return 1 ; } |
