From 482441939d9b5d06306d90e2617d9f3dca450e87 Mon Sep 17 00:00:00 2001 From: Ludovic Pouzenc Date: Mon, 15 Aug 2016 22:00:39 +0200 Subject: dgrambuf_stats(): don't compute dgram_missing if last_seq is unknown --- mcastseed/src/dgrambuf.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mcastseed/src/dgrambuf.c b/mcastseed/src/dgrambuf.c index 03f9ea0..a59f84f 100644 --- a/mcastseed/src/dgrambuf.c +++ b/mcastseed/src/dgrambuf.c @@ -414,7 +414,10 @@ ssize_t dgrambuf_write(dgrambuf_t dbuf, int fd, int *info) { int dgrambuf_stats(dgrambuf_t dbuf, char **allocated_string) { uint64_t dgram_pending = dgrambuf_get_used_count(dbuf); - uint64_t dgram_missing = dbuf->dgram_seq_last - (dbuf->dgram_seq_base - 1) - dgram_pending; + uint64_t dgram_missing = 0; + if ( dbuf->dgram_seq_last ) { + dgram_missing = dbuf->dgram_seq_last - (dbuf->dgram_seq_base - 1) - dgram_pending; + } return asprintf(allocated_string, "dgrambuf_read_on_full==%d " -- cgit v1.2.3