X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=vss.c;h=3ace49e9e90e8fb27144964a0f61f1fae267e843;hp=4a8aafa8d6e0c2ae239d09342ac10f3b08263828;hb=d1e6b28f66e243516d01916f9125baee75dd98d6;hpb=08be831b7b7e3e55d862eb988a604ccbde603403 diff --git a/vss.c b/vss.c index 4a8aafa8..3ace49e9 100644 --- a/vss.c +++ b/vss.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2011 Andre Noll + * Copyright (C) 1997-2014 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ @@ -11,8 +11,14 @@ * senders. */ +#include +#include #include #include +#include +#include +#include +#include #include "para.h" #include "error.h" @@ -26,10 +32,10 @@ #include "server.cmdline.h" #include "list.h" #include "send.h" +#include "sched.h" #include "vss.h" #include "ipc.h" #include "fd.h" -#include "sched.h" extern struct misc_meta_data *mmd; @@ -565,8 +571,14 @@ static int setup_next_fec_group(struct fec_client *fc, struct vss_task *vsst) if (payload_size < g->slice_bytes) memset(fc->extra_header_buf + payload_size, 0, g->slice_bytes - payload_size); - fc->src_data[i] = fc->extra_header_buf; - assert(i == g->num_header_slices - 1); + /* + * There might be more than one header slice to fill although + * only the first one will be used. Set all header slices to + * our extra buffer. + */ + while (i < g->num_header_slices) + fc->src_data[i++] = fc->extra_header_buf; + break; /* we don't want i to be increased. */ } /* @@ -1114,12 +1126,11 @@ static void vss_send(struct vss_task *vsst) } } -static void vss_post_select(struct sched *s, struct task *t) +static int vss_post_select(struct sched *s, struct task *t) { int ret, i; struct vss_task *vsst = container_of(t, struct vss_task, task); - if (mmd->sender_cmd_data.cmd_num >= 0) { int num = mmd->sender_cmd_data.cmd_num, sender_num = mmd->sender_cmd_data.sender_num; @@ -1136,7 +1147,7 @@ static void vss_post_select(struct sched *s, struct task *t) recv_afs_result(vsst, &s->rfds); else if (FD_ISSET(vsst->afs_socket, &s->wfds)) { PARA_NOTICE_LOG("requesting new fd from afs\n"); - ret = send_buffer(vsst->afs_socket, "new"); + ret = write_buffer(vsst->afs_socket, "new"); if (ret < 0) PARA_CRIT_LOG("%s\n", para_strerror(-ret)); else @@ -1151,17 +1162,19 @@ static void vss_post_select(struct sched *s, struct task *t) (vss_next() && vss_playing())) tv_add(now, &vsst->announce_tv, &vsst->data_send_barrier); vss_send(vsst); + return 0; } /** * Initialize the virtual streaming system task. * * \param afs_socket The fd for communication with afs. + * \param s The scheduler to register the vss task to. * * This also initializes all supported senders and starts streaming * if the --autoplay command line flag was given. */ -void init_vss_task(int afs_socket) +void init_vss_task(int afs_socket, struct sched *s) { static struct vss_task vss_task_struct, *vsst = &vss_task_struct; int i; @@ -1194,5 +1207,5 @@ void init_vss_task(int afs_socket) &vsst->data_send_barrier); } sprintf(vsst->task.status, "vss task"); - register_task(&vsst->task); + register_task(s, &vsst->task); }