mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-11 09:37:20 +02:00
MINOR: quic: quic_update_ack_ranges_list() code factorization
Very minor modification to avoid repeating the same code section in this function when allocation new ack range.
This commit is contained in:
parent
baea284c3c
commit
9ef64cd078
@ -2260,17 +2260,24 @@ static void quic_arngs_set_enc_sz(struct quic_arngs *arngs)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Insert in <root> ebtree <node> node with <ar> as range value.
|
/* Insert <ar> ack range into <argns> tree of ack ranges.
|
||||||
* Returns the ebtree node which has been inserted.
|
* Returns the ack range node which has been inserted if succeeded, NULL if not.
|
||||||
*/
|
*/
|
||||||
static inline
|
static inline
|
||||||
struct eb64_node *quic_insert_new_range(struct eb_root *root,
|
struct quic_arng_node *quic_insert_new_range(struct quic_arngs *arngs,
|
||||||
struct quic_arng_node *node,
|
struct quic_arng *ar)
|
||||||
struct quic_arng *ar)
|
|
||||||
{
|
{
|
||||||
node->first.key = ar->first;
|
struct quic_arng_node *new_ar;
|
||||||
node->last = ar->last;
|
|
||||||
return eb64_insert(root, &node->first);
|
new_ar = pool_alloc(pool_head_quic_arng);
|
||||||
|
if (new_ar) {
|
||||||
|
new_ar->first.key = ar->first;
|
||||||
|
new_ar->last = ar->last;
|
||||||
|
eb64_insert(&arngs->root, &new_ar->first);
|
||||||
|
arngs->sz++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new_ar;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update <arngs> tree of ACK ranges with <ar> as new ACK range value.
|
/* Update <arngs> tree of ACK ranges with <ar> as new ACK range value.
|
||||||
@ -2304,27 +2311,18 @@ int quic_update_ack_ranges_list(struct quic_arngs *arngs,
|
|||||||
|
|
||||||
new = NULL;
|
new = NULL;
|
||||||
if (eb_is_empty(&arngs->root)) {
|
if (eb_is_empty(&arngs->root)) {
|
||||||
/* First range insertion. */
|
new_node = quic_insert_new_range(arngs, ar);
|
||||||
new_node = pool_alloc(pool_head_quic_arng);
|
|
||||||
if (!new_node)
|
if (!new_node)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
quic_insert_new_range(&arngs->root, new_node, ar);
|
|
||||||
/* Increment the size of these ranges. */
|
|
||||||
arngs->sz++;
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
le = eb64_lookup_le(&arngs->root, ar->first);
|
le = eb64_lookup_le(&arngs->root, ar->first);
|
||||||
if (!le) {
|
if (!le) {
|
||||||
/* New insertion */
|
new_node = quic_insert_new_range(arngs, ar);
|
||||||
new_node = pool_alloc(pool_head_quic_arng);
|
|
||||||
if (!new_node)
|
if (!new_node)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
new = quic_insert_new_range(&arngs->root, new_node, ar);
|
|
||||||
/* Increment the size of these ranges. */
|
|
||||||
arngs->sz++;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
struct quic_arng_node *le_ar =
|
struct quic_arng_node *le_ar =
|
||||||
@ -2340,14 +2338,9 @@ int quic_update_ack_ranges_list(struct quic_arngs *arngs,
|
|||||||
new_node = le_ar;
|
new_node = le_ar;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* New insertion */
|
new_node = quic_insert_new_range(arngs, ar);
|
||||||
new_node = pool_alloc(pool_head_quic_arng);
|
|
||||||
if (!new_node)
|
if (!new_node)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
new = quic_insert_new_range(&arngs->root, new_node, ar);
|
|
||||||
/* Increment the size of these ranges. */
|
|
||||||
arngs->sz++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user