]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - vss.c
vss: Handle errors in setup_next_fec_group() properly.
[paraslash.git] / vss.c
diff --git a/vss.c b/vss.c
index 1dd24664970e2a1a73768f696411889f12c3f0c9..aa76ca2e852a8314667e67ce39192203fc6a69ce 100644 (file)
--- a/vss.c
+++ b/vss.c
@@ -340,8 +340,9 @@ static int compute_next_fec_slice(struct fec_client *fc, struct vss_task *vsst)
 {
        if (fc->first_stream_chunk < 0 || fc->current_slice_num
                        == fc->fcp->slices_per_group + fc->num_extra_slices) {
-               if (!setup_next_fec_group(fc, vsst))
-                       return 0;
+               int ret = setup_next_fec_group(fc, vsst);
+               if (ret <= 0)
+                       return ret;
        }
        write_fec_header(fc, vsst);
        fec_encode(fc->parms, fc->src_data, fc->enc_buf + FEC_HEADER_SIZE,
@@ -708,9 +709,9 @@ static int recv_afs_msg(int afs_socket, int *fd, uint32_t *code, uint32_t *data)
        for (cmsg = CMSG_FIRSTHDR(&msg); cmsg; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
                if (cmsg->cmsg_level != SOL_SOCKET
                        || cmsg->cmsg_type != SCM_RIGHTS)
-               continue;
+                       continue;
                if ((cmsg->cmsg_len - CMSG_LEN(0)) / sizeof(int) != 1)
-               continue;
+                       continue;
                *fd = *(int *)CMSG_DATA(cmsg);
        }
        return 1;
@@ -827,7 +828,7 @@ static void vss_send(struct vss_task *vsst)
        list_for_each_entry_safe(fc, tmp_fc, &fec_client_list, node) {
                if (!next_slice_is_due(fc, NULL))
                        continue;
-               if (!compute_next_fec_slice(fc, vsst))
+               if (compute_next_fec_slice(fc, vsst) <= 0)
                        continue;
                PARA_DEBUG_LOG("sending %d:%d (%u bytes)\n", fc->group.num,
                        fc->current_slice_num, fc->fcp->max_slice_bytes);