summaryrefslogtreecommitdiffstats
path: root/cmd-detach-client.c
diff options
context:
space:
mode:
authornicm <nicm>2015-10-27 13:23:24 +0000
committernicm <nicm>2015-10-27 13:23:24 +0000
commit07b0ea03c33893bd2b104db5ea4e1397f92e0477 (patch)
treec24ffdc1db106d5b81ce943c0567f186484ef5eb /cmd-detach-client.c
parent9952201ca72b42819d64a9174fa7b5b898215668 (diff)
Break the common process set up, event loop and imsg dispatch code
between server and client out into a separate internal API. This will make it easier to add another process.
Diffstat (limited to 'cmd-detach-client.c')
-rw-r--r--cmd-detach-client.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/cmd-detach-client.c b/cmd-detach-client.c
index 4bae9997..813ac032 100644
--- a/cmd-detach-client.c
+++ b/cmd-detach-client.c
@@ -57,7 +57,7 @@ cmd_detach_client_exec(struct cmd *self, struct cmd_q *cmdq)
return (CMD_RETURN_ERROR);
tty_stop_tty(&c->tty);
c->flags |= CLIENT_SUSPENDED;
- server_write_client(c, MSG_SUSPEND, NULL, 0);
+ proc_send(c->peer, MSG_SUSPEND, -1, NULL, 0);
return (CMD_RETURN_NORMAL);
}
@@ -74,9 +74,7 @@ cmd_detach_client_exec(struct cmd *self, struct cmd_q *cmdq)
TAILQ_FOREACH(cloop, &clients, entry) {
if (cloop->session != s)
continue;
- server_write_client(cloop, msgtype,
- cloop->session->name,
- strlen(cloop->session->name) + 1);
+ proc_send_s(cloop->peer, msgtype, cloop->session->name);
}
return (CMD_RETURN_STOP);
}
@@ -89,14 +87,11 @@ cmd_detach_client_exec(struct cmd *self, struct cmd_q *cmdq)
TAILQ_FOREACH(cloop, &clients, entry) {
if (cloop->session == NULL || cloop == c)
continue;
- server_write_client(cloop, msgtype,
- cloop->session->name,
- strlen(cloop->session->name) + 1);
+ proc_send_s(cloop->peer, msgtype, cloop->session->name);
}
return (CMD_RETURN_NORMAL);
}
- server_write_client(c, msgtype, c->session->name,
- strlen(c->session->name) + 1);
+ proc_send_s(c->peer, msgtype, c->session->name);
return (CMD_RETURN_STOP);
}