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 /client.c | |
parent | 175e45005f4572b19a4aa34094f9a8c69ced5475 (diff) |
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 'client.c')
-rw-r--r-- | client.c | 16 |
1 files changed, 10 insertions, 6 deletions
@@ -384,6 +384,11 @@ client_main(struct event_base *base, int argc, char **argv, int flags, int feat) client_exec(client_execshell, client_execcmd); } + /* Restore streams to blocking. */ + setblocking(STDIN_FILENO, 1); + setblocking(STDOUT_FILENO, 1); + setblocking(STDERR_FILENO, 1); + /* Print the exit message, if any, and exit. */ if (client_attached) { if (client_exitreason != CLIENT_EXIT_NONE) @@ -392,18 +397,17 @@ client_main(struct event_base *base, int argc, char **argv, int flags, int feat) ppid = getppid(); if (client_exittype == MSG_DETACHKILL && ppid > 1) kill(ppid, SIGHUP); - } else if (client_flags & CLIENT_CONTROLCONTROL) { + } else if (client_flags & CLIENT_CONTROL) { if (client_exitreason != CLIENT_EXIT_NONE) printf("%%exit %s\n", client_exit_message()); else printf("%%exit\n"); - printf("\033\\"); - tcsetattr(STDOUT_FILENO, TCSAFLUSH, &saved_tio); + if (client_flags & CLIENT_CONTROLCONTROL) { + printf("\033\\"); + tcsetattr(STDOUT_FILENO, TCSAFLUSH, &saved_tio); + } } else if (client_exitreason != CLIENT_EXIT_NONE) fprintf(stderr, "%s\n", client_exit_message()); - setblocking(STDIN_FILENO, 1); - setblocking(STDOUT_FILENO, 1); - setblocking(STDERR_FILENO, 1); return (client_exitval); } |