Browse Source

[core] expose chunkqueue_remove_empty_chunks()

expose chunkqueue_remove_empty_chunks() for use in error recovery
when aborting a chunkqueue_append_buffer_open*()
master
Glenn Strauss 3 months ago
parent
commit
71544129f9
  1. 5
      src/chunk.c
  2. 3
      src/chunk.h
  3. 2
      src/h2.c

5
src/chunk.c

@ -506,9 +506,6 @@ void chunkqueue_append_buffer_commit(chunkqueue *cq) {
}
static void chunkqueue_remove_empty_chunks(chunkqueue *cq);
char * chunkqueue_get_memory(chunkqueue * const restrict cq, size_t * const restrict len) {
size_t sz = *len ? *len : (chunk_buf_sz >> 1);
buffer *b;
@ -1082,7 +1079,7 @@ void chunkqueue_remove_finished_chunks(chunkqueue *cq) {
}
}
static void chunkqueue_remove_empty_chunks(chunkqueue *cq) {
void chunkqueue_remove_empty_chunks(chunkqueue *cq) {
chunk *c;
chunkqueue_remove_finished_chunks(cq);

3
src/chunk.h

@ -141,6 +141,9 @@ void chunkqueue_mark_written(chunkqueue *cq, off_t len);
void chunkqueue_remove_finished_chunks(chunkqueue *cq);
__attribute_cold__
void chunkqueue_remove_empty_chunks(chunkqueue *cq);
void chunkqueue_steal(chunkqueue * restrict dest, chunkqueue * restrict src, off_t len);
int chunkqueue_steal_with_tempfiles(chunkqueue * restrict dest, chunkqueue * restrict src, off_t len, struct log_error_st * const restrict errh);
void chunkqueue_append_cq_range (chunkqueue *dst, const chunkqueue *src, off_t offset, off_t len);

2
src/h2.c

@ -2464,7 +2464,7 @@ h2_send_cqdata (request_st * const r, connection * const con, chunkqueue * const
}
/*(else remove empty last chunk and fall through to below)*/
chunkqueue_remove_finished_chunks(cq);
chunkqueue_remove_empty_chunks(cq);
}
const uint32_t len = dlen < fsize ? dlen : fsize;

Loading…
Cancel
Save