diff --git a/include/common/hpack-tbl.h b/include/common/hpack-tbl.h index 824c40018e..ffa866bb5a 100644 --- a/include/common/hpack-tbl.h +++ b/include/common/hpack-tbl.h @@ -216,8 +216,10 @@ static inline struct ist hpack_idx_to_value(const struct hpack_dht *dht, int idx */ static inline int hpack_dht_make_room(struct hpack_dht *dht, unsigned int needed) { - if (!dht->used || dht->used * 32 + dht->total + needed + 32 <= dht->size) + if (dht->used * 32 + dht->total + needed + 32 <= dht->size) return 1; + else if (!dht->used) + return 0; return __hpack_dht_make_room(dht, needed); } diff --git a/src/hpack-tbl.c b/src/hpack-tbl.c index 4ca6796422..06798dc51a 100644 --- a/src/hpack-tbl.c +++ b/src/hpack-tbl.c @@ -259,7 +259,7 @@ int hpack_dht_insert(struct hpack_dht *dht, struct ist name, struct ist value) uint32_t headroom, tailroom; if (!hpack_dht_make_room(dht, name.len + value.len)) - return -1; + return 0; used = dht->used; prev = head = dht->head;