Skip to content

Timeout commands

Description

Make it so that all commands properly timeout (instead of having to stop them with a CTRL+C)

Proposed solution

Timeout the receiver.await in command_res_match from commands.rs, using time.timeout.

As there is some tracking of state going on, there needs to be a way to clean it (for example clean pending_dial if we timeout a dial attempt). To do this, we can make a clean-data command (or a function) which receives the command that was timed out, and then matches on that to clear (a lot of commands don't need cleaning so they can just in a _ => {} arm of the match). All the information required to clean is included in the command in itself.

Alternative solution

Timeout on each of the match arm of the handle_command function in dragoon_network and eventually clean if needed. This will be very repetitive and could be much shorter and cleaner with the previous solution, but it doesn't require creating a new function / command (the number of lines actually written is probably higher though)