From a54a88edd6fd893d4370feb9f9136e13096b891c Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 1 Jun 2020 09:43:00 +0000 Subject: Instead of sending all data to control mode clients as fast as possible, add a limit of how much data will be sent to the client and try to use it for panes with some degree of fairness. GitHub issue 2217, with George Nachman. --- cmd-queue.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'cmd-queue.c') diff --git a/cmd-queue.c b/cmd-queue.c index b0c70428..693f7d90 100644 --- a/cmd-queue.c +++ b/cmd-queue.c @@ -780,7 +780,7 @@ cmdq_guard(struct cmdq_item *item, const char *guard, int flags) u_int number = item->number; if (c != NULL && (c->flags & CLIENT_CONTROL)) - file_print(c, "%%%s %ld %u %d\n", guard, t, number, flags); + control_write(c, "%%%s %ld %u %d", guard, t, number, flags); } /* Show message from command. */ @@ -807,7 +807,10 @@ cmdq_print(struct cmdq_item *item, const char *fmt, ...) msg = utf8_sanitize(tmp); free(tmp); } - file_print(c, "%s\n", msg); + if (c->flags & CLIENT_CONTROL) + control_write(c, "%s", msg); + else + file_print(c, "%s\n", msg); } else { wp = server_client_get_pane(c); wme = TAILQ_FIRST(&wp->modes); @@ -849,7 +852,7 @@ cmdq_error(struct cmdq_item *item, const char *fmt, ...) free(tmp); } if (c->flags & CLIENT_CONTROL) - file_print(c, "%s\n", msg); + control_write(c, "%s", msg); else file_error(c, "%s\n", msg); c->retval = 1; -- cgit v1.2.3