return oldest;
}
+/* returns 1 if the group was found, 0 if not, negative on errors */
static int get_group(struct fec_header *h, struct private_fecdec_data *pfd,
struct fecdec_group **result)
{
if (fg)
goto success;
fg = free_oldest_group(pfd);
+ ret = 0;
success:
fg->h = *h;
*result = fg;
- return 1;
+ return ret;
}
+/*
+ * returns 1 if slice was added, zero otherwise (because the group was already
+ * complete). In any case the number of received slices is being increased by
+ * one.
+ */
static int add_slice(char *buf, struct fecdec_group *fg)
{
int r, slice_num;
- if (group_complete(fg))
+ if (group_complete(fg)) {
+ fg->num_received_slices++;
return 0;
+ }
slice_num = fg->h.slice_num;
if (fg->num_slices == 0) {
fg->num_slices = fg->h.slices_per_group;
return 1;
}
+/* returns 1 if we used the buffer, 0 if we didn't, negative on errors */
static int dispatch_slice(char *buf, size_t len, struct fec_header *h,
struct filter_node *fn)
{