From: Andre Noll Date: Mon, 12 Apr 2010 16:21:23 +0000 (+0200) Subject: Merge branch 't/udp_robustness' X-Git-Tag: v0.4.2~11 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=ce20ee3c755b47f753f122b0fb58a481a0a9d7b9;hp=5667dca4697c3bbbe4830699ee91df800bf2efd3 Merge branch 't/udp_robustness' --- diff --git a/chunk_queue.c b/chunk_queue.c index 5b102f28..3f5ac1d9 100644 --- a/chunk_queue.c +++ b/chunk_queue.c @@ -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); } diff --git a/udp_send.c b/udp_send.c index c84f416a..fc3bb2f5 100644 --- a/udp_send.c +++ b/udp_send.c @@ -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);