summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Pouzenc <ludovic@pouzenc.fr>2016-08-15 22:00:39 +0200
committerLudovic Pouzenc <ludovic@pouzenc.fr>2016-08-15 22:00:39 +0200
commit482441939d9b5d06306d90e2617d9f3dca450e87 (patch)
tree7a55c64de35cbdf102449f95c68f89f72d58b3b3
parent817200db90268ad1e80db0a4971776504489fcc8 (diff)
downloadeficast-482441939d9b5d06306d90e2617d9f3dca450e87.tar.gz
eficast-482441939d9b5d06306d90e2617d9f3dca450e87.tar.bz2
eficast-482441939d9b5d06306d90e2617d9f3dca450e87.zip
dgrambuf_stats(): don't compute dgram_missing if last_seq is unknown
-rw-r--r--mcastseed/src/dgrambuf.c5
1 files changed, 4 insertions, 1 deletions
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 "