diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2009-11-04 23:12:44 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2009-11-04 23:12:44 +0000 |
commit | 948d8365576ad37dbb34cd3630c5d60eeb7e270f (patch) | |
tree | 70009e10a9025cb6b5b43614621cc5503a677d33 /usr.bin/tmux/server-fn.c | |
parent | 52dd67fa64f919338f816fe41b47e9afb8e14657 (diff) |
Don't reenlist the client imsg event every loop, instead have a small function
to it and call it after the event triggers or after a imsg is added.
Diffstat (limited to 'usr.bin/tmux/server-fn.c')
-rw-r--r-- | usr.bin/tmux/server-fn.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/usr.bin/tmux/server-fn.c b/usr.bin/tmux/server-fn.c index bfcc8111b1d..4c026b6df0b 100644 --- a/usr.bin/tmux/server-fn.c +++ b/usr.bin/tmux/server-fn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server-fn.c,v 1.26 2009/10/11 10:39:27 nicm Exp $ */ +/* $OpenBSD: server-fn.c,v 1.27 2009/11/04 23:12:43 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -59,6 +59,7 @@ server_write_client( return; log_debug("writing %d to client %d", type, c->ibuf.fd); imsg_compose(ibuf, type, PROTOCOL_VERSION, -1, -1, (void *) buf, len); + server_update_event(c); } void @@ -371,3 +372,18 @@ server_clear_identify(struct client *c) server_redraw_client(c); } } + +void +server_update_event(struct client *c) +{ + short events; + + events = 0; + if (!(c->flags & CLIENT_BAD)) + events |= EV_READ; + if (c->ibuf.w.queued > 0) + events |= EV_WRITE; + event_del(&c->event); + event_set(&c->event, c->ibuf.fd, events, server_client_callback, c); + event_add(&c->event, NULL); +} |