diff options
author | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2016-07-20 14:17:41 +0200 |
---|---|---|
committer | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2016-07-20 14:17:41 +0200 |
commit | 6d1adde7f4d51ec8d29d98920f2d22401a7a0e12 (patch) | |
tree | b99d567369273bb788c16118a05dc7781eca4747 /mcastseed | |
parent | f9f37bc67f13c315629ef83fe34d113d635df3f8 (diff) | |
download | eficast-6d1adde7f4d51ec8d29d98920f2d22401a7a0e12.tar.gz eficast-6d1adde7f4d51ec8d29d98920f2d22401a7a0e12.tar.bz2 eficast-6d1adde7f4d51ec8d29d98920f2d22401a7a0e12.zip |
Dummy stop condition to have gmon output for now (^C dont output gmon.out)
Diffstat (limited to 'mcastseed')
-rw-r--r-- | mcastseed/src/mcastleech.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/mcastseed/src/mcastleech.c b/mcastseed/src/mcastleech.c index 263bac4..bbdcf20 100644 --- a/mcastseed/src/mcastleech.c +++ b/mcastseed/src/mcastleech.c @@ -203,6 +203,7 @@ int wait_start_and_start_job() { int receive_data() { int info_r, info_w, res; ssize_t nread, nwrite; + static int noop_calls_count = 0; /* Read (blocking, timeout = 1 sec) */ nread = dgrambuf_recvmmsg(dgrambuf, mcast_sock, 1, &info_r); @@ -218,6 +219,16 @@ int receive_data() { fprintf(stderr, "receive_data(): nread == %zi, nwrite == %zi\n", nread, nwrite); + /* XXX Crapy dead state detection */ + if ( nread == 0 && nwrite == 0 ) { + if ( noop_calls_count > 10 ) { + return 0; + } + noop_calls_count++; + } else { + noop_calls_count = 0; + } + /* Consider sending status back to seeder */ res = send_status(1, info_r, info_w); if ( res < 0 ) { @@ -227,7 +238,6 @@ int receive_data() { if ( dgrambuf_everything_was_received(dgrambuf) ) { return 0; } - return 1; } |