aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/client.c
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2023-06-11 12:47:21 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2023-06-11 12:58:07 +0200
commit04547fe158fe05f97ccf584332319da3e6b344d8 (patch)
tree904a8716d3261c53c199a967fbc651b33430db2b /src/client.c
parentworker_queue: fix worker_queue_add_last (diff)
downloadcimple-04547fe158fe05f97ccf584332319da3e6b344d8.tar.gz
cimple-04547fe158fe05f97ccf584332319da3e6b344d8.zip
msg: rework some APIs
Diffstat (limited to 'src/client.c')
-rw-r--r--src/client.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/client.c b/src/client.c
index 8cfb1d1..d7c1b58 100644
--- a/src/client.c
+++ b/src/client.c
@@ -39,17 +39,13 @@ void client_destroy(struct client *client)
int client_main(UNUSED const struct client *client, const struct settings *settings,
const char **argv)
{
- struct msg *request = NULL, *response = NULL;
+ struct msg *response = NULL;
int ret = 0;
- ret = msg_from_argv(&request, argv);
+ ret = msg_connect_and_talk_argv(settings->host, settings->port, argv, &response);
if (ret < 0)
return ret;
- ret = msg_connect_and_communicate(settings->host, settings->port, request, &response);
- if (ret < 0)
- goto free_request;
-
if (!msg_is_success(response)) {
log_err("Server failed to process the request\n");
msg_dump(response);
@@ -60,8 +56,5 @@ int client_main(UNUSED const struct client *client, const struct settings *setti
free_response:
msg_free(response);
-free_request:
- msg_free(request);
-
return ret;
}