]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
vss_send(): Fix EOF-check for FEC clients.
authorAndre Noll <maan@systemlinux.org>
Sat, 12 Sep 2009 16:13:36 +0000 (18:13 +0200)
committerAndre Noll <maan@systemlinux.org>
Sat, 12 Sep 2009 16:13:36 +0000 (18:13 +0200)
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

diff --git a/vss.c b/vss.c
index ccdd1f7c96323b0158892beb984e34ab33d4c8b1..400df846c453756bfe5e8e938fe9d7b1c81e1df3 100644 (file)
--- 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;
        }