Merge branch 't/udp_robustness'
authorAndre Noll <maan@systemlinux.org>
Mon, 12 Apr 2010 16:21:23 +0000 (18:21 +0200)
committerAndre Noll <maan@systemlinux.org>
Mon, 12 Apr 2010 16:21:23 +0000 (18:21 +0200)
chunk_queue.c
udp_send.c

index 5b102f286641d7b93418f3ae92e7dcdf6f71d0f6..3f5ac1d929262c116f6c7822f67f0ceb8cf1e7f6 100644 (file)
@@ -82,12 +82,14 @@ struct queued_chunk *cq_peek(struct chunk_queue *cq)
 /**
  * Remove the current chunk from the queue.
  *
- * \param cq The chunk to remove.
+ * \param cq The queue to remove from.
  */
 void cq_dequeue(struct chunk_queue *cq)
 {
        struct queued_chunk *qc = cq_peek(cq);
        assert(qc);
+       assert(cq->num_pending >= qc->num_bytes);
+       cq->num_pending -= qc->num_bytes;
        list_del(&qc->node);
        free(qc);
 }
index c84f416a31ed3e5071c28969b6bd5057d9da0534..fc3bb2f5c5f657a45112cf2db3856407c8c0c611 100644 (file)
@@ -232,8 +232,11 @@ static int udp_com_delete(struct sender_command_data *scd)
 static int udp_send_fec(char *buf, size_t len, void *private_data)
 {
        struct udp_target *ut = private_data;
-       int ret = udp_init_session(ut);
+       int ret;
 
+       if (sender_status == SENDER_OFF)
+               return 0;
+       ret = udp_init_session(ut);
        if (ret < 0)
                goto fail;
        ret = send_queued_chunks(ut->fd, ut->cq, 0);