From: Andre Noll Date: Sat, 12 Sep 2009 16:13:36 +0000 (+0200) Subject: vss_send(): Fix EOF-check for FEC clients. X-Git-Tag: v0.3.5~2^2~1 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=745667ae4887ebe0e25a4b9085556ac6ed56b246 vss_send(): Fix EOF-check for FEC clients. If the last chunk has been sent to all http/dccp clients we have to wait until the last FEC group has been sent before setting the NEXT flag that causes all senders to shut down its clients. The old code tested if a slice was sent to any FEC client during vss_send() and set the NEXT flag if nothing was sent. However, this is not sufficient as there may be still slices available which have to be sent at some future time. This patch teaches vss_send() to detect this condition. It also renames the boolean variable sent_something to fec_active, which is more to the point. --- diff --git a/vss.c b/vss.c index ccdd1f7c..400df846 100644 --- a/vss.c +++ b/vss.c @@ -825,7 +825,7 @@ err: */ static void vss_send(struct vss_task *vsst) { - int i, sent_something = 0; + int i, fec_active = 0; struct timeval due; struct fec_client *fc, *tmp_fc; @@ -839,8 +839,10 @@ static void vss_send(struct vss_task *vsst) list_for_each_entry_safe(fc, tmp_fc, &fec_client_list, node) { if (fc->error < 0) continue; - if (!next_slice_is_due(fc, NULL)) + if (!next_slice_is_due(fc, NULL)) { + fec_active = 1; continue; + } if (compute_next_fec_slice(fc, vsst) <= 0) continue; PARA_DEBUG_LOG("sending %d:%d (%u bytes)\n", fc->group.num, @@ -849,10 +851,10 @@ static void vss_send(struct vss_task *vsst) fc->fcp->max_slice_bytes, fc->fcp->private_data); fc->current_slice_num++; - sent_something = 1; + fec_active = 1; } if (mmd->current_chunk >= mmd->afd.afhi.chunks_total) { /* eof */ - if (!sent_something) + if (!fec_active) mmd->new_vss_status_flags |= VSS_NEXT; return; }