client: add helper function to reset last client command information

just a preparation, no functional changes are intended.
master
OpenGnSys Support Team 2024-10-31 00:34:38 +01:00
parent 16cc22df3e
commit 83b1be6589
1 changed files with 8 additions and 4 deletions

View File

@ -1330,6 +1330,12 @@ static int og_clear_image_placeholder()
return 0;
}
static void og_client_reset_cmd(struct og_client *cli)
{
cli->last_cmd.id = 0;
cli->last_cmd.type = OG_CMD_UNSPEC;
}
int og_agent_state_process_response(struct og_client *cli)
{
enum og_cmd_type cmd_type = cli->last_cmd.type;
@ -1392,8 +1398,7 @@ int og_agent_state_process_response(struct og_client *cli)
}
if (!cli->content_length) {
cli->last_cmd.id = 0;
cli->last_cmd.type = OG_CMD_UNSPEC;
og_client_reset_cmd(cli);
return 0;
}
@ -1456,8 +1461,7 @@ int og_agent_state_process_response(struct og_client *cli)
/* ... cancel pending actions related to this task for this client here */
}
cli->last_cmd.id = 0;
cli->last_cmd.type = OG_CMD_UNSPEC;
og_client_reset_cmd(cli);
return err;
}