mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-22 22:45:27 +01:00
commando: limit to 16 partially-received incoming commands at a time.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
4cada557ba
commit
05a666e424
1 changed files with 4 additions and 0 deletions
|
@ -463,6 +463,10 @@ static void handle_incmd(struct node_id *peer,
|
||||||
incmd->contents = tal_arr(incmd, u8, 0);
|
incmd->contents = tal_arr(incmd, u8, 0);
|
||||||
tal_arr_expand(&incoming_commands, incmd);
|
tal_arr_expand(&incoming_commands, incmd);
|
||||||
tal_add_destructor2(incmd, destroy_commando, &incoming_commands);
|
tal_add_destructor2(incmd, destroy_commando, &incoming_commands);
|
||||||
|
|
||||||
|
/* More than 16 partial commands at once? Free oldest */
|
||||||
|
if (tal_count(incoming_commands) > 16)
|
||||||
|
tal_free(incoming_commands[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 1MB should be enough for anybody! */
|
/* 1MB should be enough for anybody! */
|
||||||
|
|
Loading…
Add table
Reference in a new issue