diff options
author | Tiago Cunha <tcunha@gmx.com> | 2009-11-08 23:09:36 +0000 |
---|---|---|
committer | Tiago Cunha <tcunha@gmx.com> | 2009-11-08 23:09:36 +0000 |
commit | bee17719d8212fa3ff87b4059727849bd3c807b2 (patch) | |
tree | f39a9402a6d1d3d89e2bca3eda02d3e6f84b31b8 /server-client.c | |
parent | 0cd4f4e321476a1e5e437241a9ed394474de3aee (diff) |
Sync OpenBSD patchset 503:
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 'server-client.c')
-rw-r--r-- | server-client.c | 30 |
1 files changed, 4 insertions, 26 deletions
diff --git a/server-client.c b/server-client.c index cc88d95b..67af5700 100644 --- a/server-client.c +++ b/server-client.c @@ -1,4 +1,4 @@ -/* $Id: server-client.c,v 1.14 2009-11-08 22:58:37 tcunha Exp $ */ +/* $Id: server-client.c,v 1.15 2009-11-08 23:09:36 tcunha Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -60,6 +60,7 @@ server_client_create(int fd) c = xcalloc(1, sizeof *c); c->references = 0; imsg_init(&c->ibuf, fd); + server_update_event(c); if (gettimeofday(&c->creation_time, NULL) != 0) fatal("gettimeofday failed"); @@ -149,30 +150,6 @@ server_client_lost(struct client *c) recalculate_sizes(); } -/* Register clients for poll. */ -void -server_client_prepare(void) -{ - struct client *c; - u_int i; - int events; - - for (i = 0; i < ARRAY_LENGTH(&clients); i++) { - if ((c = ARRAY_ITEM(&clients, i)) == NULL) - continue; - - 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); - } -} - /* Process a single client event. */ void server_client_callback(int fd, short events, void *data) @@ -195,7 +172,8 @@ server_client_callback(int fd, short events, void *data) if (events & EV_READ && server_client_msg_dispatch(c) != 0) goto client_lost; } - + + server_update_event(c); return; client_lost: |