summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/tty.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2015-05-12 22:40:38 +0000
committernicm <nicm@openbsd.org>2015-05-12 22:40:38 +0000
commit6da7fc1e67d79643bde2b2054007e6363348b252 (patch)
tree96bb2e5cda048a13cefe577d25f14e30845d89a9 /usr.bin/tmux/tty.c
parentRevert rev 1.3. While that change appears to make the behaviour similar to (diff)
downloadwireguard-openbsd-6da7fc1e67d79643bde2b2054007e6363348b252.tar.xz
wireguard-openbsd-6da7fc1e67d79643bde2b2054007e6363348b252.zip
To replace c0-*, add a high watermark to the pty event, and also backoff
when the any of the ttys the pane is going to write to has buffered enough data.
Diffstat (limited to 'usr.bin/tmux/tty.c')
-rw-r--r--usr.bin/tmux/tty.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/usr.bin/tmux/tty.c b/usr.bin/tmux/tty.c
index cb04de997ac..4418d0c4f47 100644
--- a/usr.bin/tmux/tty.c
+++ b/usr.bin/tmux/tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty.c,v 1.181 2015/05/06 07:52:06 nicm Exp $ */
+/* $OpenBSD: tty.c,v 1.182 2015/05/12 22:40:38 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -723,9 +723,23 @@ tty_draw_line(struct tty *tty, const struct window_pane *wp,
tty_update_mode(tty, tty->mode, s);
}
+int
+tty_client_ready(struct client *c, struct window_pane *wp)
+{
+ if (c->session == NULL || c->tty.term == NULL)
+ return (0);
+ if (c->flags & CLIENT_SUSPENDED)
+ return (0);
+ if (c->tty.flags & TTY_FREEZE)
+ return (0);
+ if (c->session->curw->window != wp->window)
+ return (0);
+ return (1);
+}
+
void
-tty_write(
- void (*cmdfn)(struct tty *, const struct tty_ctx *), struct tty_ctx *ctx)
+tty_write(void (*cmdfn)(struct tty *, const struct tty_ctx *),
+ struct tty_ctx *ctx)
{
struct window_pane *wp = ctx->wp;
struct client *c;
@@ -740,13 +754,7 @@ tty_write(
return;
TAILQ_FOREACH(c, &clients, entry) {
- if (c->session == NULL || c->tty.term == NULL)
- continue;
- if (c->flags & CLIENT_SUSPENDED)
- continue;
- if (c->tty.flags & TTY_FREEZE)
- continue;
- if (c->session->curw->window != wp->window)
+ if (!tty_client_ready(c, wp))
continue;
ctx->xoff = wp->xoff;