diff options
author | Mattias Andrée <maandree@kth.se> | 2016-07-20 22:26:34 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2016-07-20 22:26:34 +0200 |
commit | f91d550d1f99e37c8bccd958224702445efdeb29 (patch) | |
tree | 9ec45aa9ea7c62cfdd131e5a428cbf6ec2ab8d9b /src | |
parent | m (diff) | |
download | libcoopgamma-f91d550d1f99e37c8bccd958224702445efdeb29.tar.gz libcoopgamma-f91d550d1f99e37c8bccd958224702445efdeb29.tar.bz2 libcoopgamma-f91d550d1f99e37c8bccd958224702445efdeb29.tar.xz |
libcoopgamma_synchronise returns -1 and sets errno to 0 instead of returning -2
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r-- | src/libcoopgamma.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/src/libcoopgamma.c b/src/libcoopgamma.c index 4d11d4a..19ad280 100644 --- a/src/libcoopgamma.c +++ b/src/libcoopgamma.c @@ -143,15 +143,10 @@ const char* argv0 __attribute__((weak)) = "libcoopgamma"; goto reflush; \ } \ resync: \ - switch (libcoopgamma_synchronise(ctx, &async, (size_t)1, &_selected)) \ + if (libcoopgamma_synchronise(ctx, &async, (size_t)1, &_selected) < 0) \ { \ - default: \ - break; \ - case -1: \ - if (errno != EINTR) \ + if ((errno != EINTR) && (errno != 0)) \ return fail_return; \ - /* Fall through */ \ - case -2: \ goto resync; \ } \ return recv_call @@ -1482,11 +1477,12 @@ int libcoopgamma_flush(libcoopgamma_context_t* restrict ctx) * if the message is corrupt any of the listed requests can * be selected even if it is not for any of the requests. * Functions that parse the message will detect such corruption. - * @return Zero on success, -1 on error, -2 if the message is ignored + * @return Zero on success, -1 on error. If the the message is ignored, * which happens if corresponding `libcoopgamma_async_context_t` - * is not listed. If `-1` is returned, `errno` will be set, - * if it is set to `ENOTRECOVERABLE` you have receive a corrupt - * message and the context has been tainted beyond recover. + * is not listed, -1 is returned and `errno` is set to 0. If -1 + * is returned, `errno` is set to `ENOTRECOVERABLE` you have + * received a corrupt message and the context has been tainted + * beyond recover. */ int libcoopgamma_synchronise(libcoopgamma_context_t* restrict ctx, libcoopgamma_async_context_t* restrict pending, @@ -1581,7 +1577,8 @@ int libcoopgamma_synchronise(libcoopgamma_context_t* restrict ctx, ctx->have_all_headers = 0; ctx->length = 0; ctx->inbound_tail = ctx->curline; - return -2; + errno = 0; + return -1; } } |