From 83b1be65897095cdc51b427ba3e42ae3d8756f32 Mon Sep 17 00:00:00 2001 From: OpenGnSys Support Team Date: Thu, 31 Oct 2024 00:34:38 +0100 Subject: client: add helper function to reset last client command information just a preparation, no functional changes are intended. --- src/client.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/client.c b/src/client.c index b634251..cdc7b6b 100644 --- a/src/client.c +++ b/src/client.c @@ -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; } -- cgit v1.2.3-18-g5258