diff options
author | Přemysl Eric Janouch <p@janouch.name> | 2022-09-08 01:48:15 +0200 |
---|---|---|
committer | Přemysl Eric Janouch <p@janouch.name> | 2022-09-08 01:48:46 +0200 |
commit | 3a165a595ba75958d360a61fdb173b19f71096dd (patch) | |
tree | a37a5e65b67d67b79641485f6199909eb12bfcdd /xC.c | |
parent | 4ba28c6ed3b952a06aba8ae96220c429d4d02365 (diff) | |
download | xK-3a165a595ba75958d360a61fdb173b19f71096dd.tar.gz xK-3a165a595ba75958d360a61fdb173b19f71096dd.tar.xz xK-3a165a595ba75958d360a61fdb173b19f71096dd.zip |
xC: use the relay protocol's RPC for pings
Diffstat (limited to 'xC.c')
-rw-r--r-- | xC.c | 24 |
1 files changed, 14 insertions, 10 deletions
@@ -3189,6 +3189,16 @@ relay_prepare_error (struct app_context *ctx, uint32_t seq, const char *message) e->error = str_from_cstr (message); } +static struct relay_event_data_response * +relay_prepare_response (struct app_context *ctx, uint32_t seq) +{ + struct relay_event_message *m = relay_prepare (ctx); + struct relay_event_data_response *e = &m->data.response; + e->event = RELAY_EVENT_RESPONSE; + e->command_seq = seq; + return e; +} + // --- Terminal output --------------------------------------------------------- /// Default colour pair @@ -15267,12 +15277,8 @@ client_process_buffer_complete (struct client *c, uint32_t seq, goto out_internal; } - struct relay_event_data_response *e = - &relay_prepare (c->ctx)->data.response; - e->event = RELAY_EVENT_RESPONSE; - e->command_seq = seq; + struct relay_event_data_response *e = relay_prepare_response (c->ctx, seq); e->data.command = RELAY_COMMAND_BUFFER_COMPLETE; - struct relay_response_data_buffer_complete *resp = &e->data.buffer_complete; resp->start = start; @@ -15291,10 +15297,7 @@ static void client_process_buffer_log (struct client *c, uint32_t seq, struct buffer *buffer) { - struct relay_event_data_response *e = - &relay_prepare (c->ctx)->data.response; - e->event = RELAY_EVENT_RESPONSE; - e->command_seq = seq; + struct relay_event_data_response *e = relay_prepare_response (c->ctx, seq); e->data.command = RELAY_COMMAND_BUFFER_LOG; char *path = buffer_get_log_path (buffer); @@ -15357,7 +15360,8 @@ client_process_message (struct client *c, client_resync (c); break; case RELAY_COMMAND_PING: - relay_prepare_ping (c->ctx); + relay_prepare_response (c->ctx, m->command_seq) + ->data.command = RELAY_COMMAND_PING; relay_send (c); break; case RELAY_COMMAND_ACTIVE: |