diff options
author | nicm <nicm> | 2020-06-01 09:43:00 +0000 |
---|---|---|
committer | nicm <nicm> | 2020-06-01 09:43:00 +0000 |
commit | a54a88edd6fd893d4370feb9f9136e13096b891c (patch) | |
tree | 1e42bf42d42c31e1ef3c059aaf1ae25ae6ef3bd5 /cmd-capture-pane.c | |
parent | 175e45005f4572b19a4aa34094f9a8c69ced5475 (diff) | |
download | rtmux-a54a88edd6fd893d4370feb9f9136e13096b891c.tar.gz rtmux-a54a88edd6fd893d4370feb9f9136e13096b891c.tar.bz2 rtmux-a54a88edd6fd893d4370feb9f9136e13096b891c.zip |
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.
Diffstat (limited to 'cmd-capture-pane.c')
-rw-r--r-- | cmd-capture-pane.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/cmd-capture-pane.c b/cmd-capture-pane.c index 588b0fd5..6f37bc8f 100644 --- a/cmd-capture-pane.c +++ b/cmd-capture-pane.c @@ -214,15 +214,20 @@ cmd_capture_pane_exec(struct cmd *self, struct cmdq_item *item) return (CMD_RETURN_ERROR); if (args_has(args, 'p')) { - if (!file_can_print(c)) { - cmdq_error(item, "can't write output to client"); + if (len > 0 && buf[len - 1] == '\n') + len--; + if (c->flags & CLIENT_CONTROL) + control_write(c, "%.*s", (int)len, buf); + else { + if (!file_can_print(c)) { + cmdq_error(item, "can't write to client"); + free(buf); + return (CMD_RETURN_ERROR); + } + file_print_buffer(c, buf, len); + file_print(c, "\n"); free(buf); - return (CMD_RETURN_ERROR); } - file_print_buffer(c, buf, len); - if (args_has(args, 'P') && len > 0) - file_print(c, "\n"); - free(buf); } else { bufname = NULL; if (args_has(args, 'b')) |