X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=chunk_queue.c;h=84f4a4a88ebfcb5acb4b0cfaf9dc861b87f82947;hp=0b1e300026c94d60d7d55e6172ed8f338cf0b069;hb=054c845e9ac8ee3ab920d91e468eedb7cb1105ba;hpb=2ecabb05dbeb0948e514cdad1bb811d9edf97e2e diff --git a/chunk_queue.c b/chunk_queue.c index 0b1e3000..84f4a4a8 100644 --- a/chunk_queue.c +++ b/chunk_queue.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007 Andre Noll + * Copyright (C) 2007-2008 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ @@ -8,6 +8,7 @@ #include "para.h" #include "list.h" +#include "afh.h" #include "vss.h" #include "string.h" #include "error.h" @@ -17,14 +18,14 @@ * allows them to enqueue chunks if they can not be sent out immediately. * * Chunk queues are "cheap" in the sense that only reference to the audio file - * data is stored, but not the data itsself. + * data is stored, but not the data itself. */ struct chunk_queue { /** The list of pending chunks for this client. */ struct list_head q; /** The number of pending bytes for this client. */ unsigned long num_pending; - /** Enqueueing more than that many bytes is an error. */ + /** More than that many bytes in the queue is considered an error. */ unsigned long max_pending; }; @@ -61,7 +62,7 @@ int cq_enqueue(struct chunk_queue *cq, long unsigned chunk_num, if (ret < 0) return ret; } else - buf = vss_get_header(&len); + vss_get_header(&buf, &len); if (cq->num_pending + len > cq->max_pending) return -E_QUEUE; qc = para_malloc(sizeof(struct queued_chunk)); @@ -78,7 +79,7 @@ int cq_enqueue(struct chunk_queue *cq, long unsigned chunk_num, * * \param cq The chunk queue. * - * \return The next queued chunk, or \p NULL if there is no chunk awailable. + * \return The next queued chunk, or \p NULL if there is no chunk available. */ struct queued_chunk *cq_peek(struct chunk_queue *cq) { @@ -101,7 +102,7 @@ void cq_dequeue(struct chunk_queue *cq) } /** - * Change the number of bytes send for the current queued chunk. + * Change the number of bytes sent for the current queued chunk. * * \param cq The chunk queue. * \param sent Number of bytes successfully sent. @@ -132,7 +133,7 @@ int cq_get(struct queued_chunk *qc, char **buf, size_t *len) if (ret < 0) return ret; } else - *buf = vss_get_header(len); + vss_get_header(buf, len); assert(*len > qc->sent); *buf += qc->sent; *len -= qc->sent;