diff options
author | Mattias Andrée <maandree@kth.se> | 2016-08-04 21:47:42 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2016-08-04 21:47:42 +0200 |
commit | 129a85b1552666012749e07f29a2c65c92b6defa (patch) | |
tree | 8ed5372fc7b4abc252fc682f028eb951d643d47a /src | |
parent | Add libcoopgamma_skip_message (diff) | |
download | libcoopgamma-129a85b1552666012749e07f29a2c65c92b6defa.tar.gz libcoopgamma-129a85b1552666012749e07f29a2c65c92b6defa.tar.bz2 libcoopgamma-129a85b1552666012749e07f29a2c65c92b6defa.tar.xz |
Add debug output (socket communication) if -DDEBUG_MODE is used
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'src')
-rw-r--r-- | src/libcoopgamma.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/libcoopgamma.c b/src/libcoopgamma.c index c4f13ab..b72e856 100644 --- a/src/libcoopgamma.c +++ b/src/libcoopgamma.c @@ -1484,6 +1484,14 @@ int libcoopgamma_flush(libcoopgamma_context_t* restrict ctx) return -1; continue; } + +#ifdef DEBUG_MODE + fprintf(stderr, "\033[31m"); + fwrite(ctx->outbound + ctx->outbound_tail, (size_t)sent, 1, stderr); + fprintf(stderr, "\033[m"); + fflush(stderr); +#endif + ctx->outbound_tail += (size_t)sent; } @@ -1551,6 +1559,14 @@ int libcoopgamma_synchronise(libcoopgamma_context_t* restrict ctx, errno = ECONNRESET; return -1; } + +#ifdef DEBUG_MODE + fprintf(stderr, "\033[32m"); + fwrite(ctx->inbound + ctx->inbound_head, (size_t)got, 1, stderr); + fprintf(stderr, "\033[m"); + fflush(stderr); +#endif + ctx->inbound_head += (size_t)got; skip_recv: |