diff options
author | 2009-10-10 18:42:14 +0000 | |
---|---|---|
committer | 2009-10-10 18:42:14 +0000 | |
commit | 3ddd7bd6ae3863738b69f2880667caff06a2d09b (patch) | |
tree | 6418d375952d77833526c6122c26bbfb15896e09 /usr.bin/tmux/server.c | |
parent | Fix a quoting typo in comments (diff) | |
download | wireguard-openbsd-3ddd7bd6ae3863738b69f2880667caff06a2d09b.tar.xz wireguard-openbsd-3ddd7bd6ae3863738b69f2880667caff06a2d09b.zip |
Put all jobs on a global all_jobs list and use that in server.c instead of
running through all the clients.
Diffstat (limited to 'usr.bin/tmux/server.c')
-rw-r--r-- | usr.bin/tmux/server.c | 40 |
1 files changed, 4 insertions, 36 deletions
diff --git a/usr.bin/tmux/server.c b/usr.bin/tmux/server.c index eaa3bf34a20..27bee8b9450 100644 --- a/usr.bin/tmux/server.c +++ b/usr.bin/tmux/server.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server.c,v 1.49 2009/10/10 15:03:01 nicm Exp $ */ +/* $OpenBSD: server.c,v 1.50 2009/10/10 18:42:14 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -73,9 +73,7 @@ void server_handle_windows(void); void server_fill_clients(void); void server_handle_clients(void); void server_fill_jobs(void); -void server_fill_jobs1(struct jobs *); void server_handle_jobs(void); -void server_handle_jobs1(struct jobs *); void server_accept_client(int); void server_handle_client(struct client *); void server_handle_window(struct window *, struct window_pane *); @@ -414,11 +412,7 @@ server_main(int srv_fd) /* Set window names. */ set_window_names(); - /* - * Handle window and client sockets. Clients can create - * windows, so windows must come first to avoid messing up by - * increasing the array size. - */ + /* Handle window and client sockets. */ server_handle_jobs(); server_handle_windows(); server_handle_clients(); @@ -764,22 +758,9 @@ server_fill_clients(void) void server_fill_jobs(void) { - struct client *c; - u_int i; - - for (i = 0; i < ARRAY_LENGTH(&clients); i++) { - c = ARRAY_ITEM(&clients, i); - if (c != NULL) - server_fill_jobs1(&c->status_jobs); - } -} - -void -server_fill_jobs1(struct jobs *jobs) -{ struct job *job; - RB_FOREACH(job, jobs, jobs) { + SLIST_FOREACH(job, &all_jobs, lentry) { if (job->fd == -1) continue; server_poll_add(job->fd, POLLIN); @@ -790,23 +771,10 @@ server_fill_jobs1(struct jobs *jobs) void server_handle_jobs(void) { - struct client *c; - u_int i; - - for (i = 0; i < ARRAY_LENGTH(&clients); i++) { - c = ARRAY_ITEM(&clients, i); - if (c != NULL) - server_handle_jobs1(&c->status_jobs); - } -} - -void -server_handle_jobs1(struct jobs *jobs) -{ struct job *job; struct pollfd *pfd; - RB_FOREACH(job, jobs, jobs) { + SLIST_FOREACH(job, &all_jobs, lentry) { if (job->fd == -1) continue; if ((pfd = server_poll_lookup(job->fd)) == NULL) |