From 745667ae4887ebe0e25a4b9085556ac6ed56b246 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sat, 12 Sep 2009 18:13:36 +0200 Subject: [PATCH] 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. --- vss.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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; } -- 2.39.5