From d90d646ca8e7ff6f97e9d11a2d746e217c7a3dcc Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Sun, 29 Jun 2008 07:04:31 +0000 Subject: Zombie windows, requested by Will Maier. --- server.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'server.c') diff --git a/server.c b/server.c index 8e596299..ca14803c 100644 --- a/server.c +++ b/server.c @@ -1,4 +1,4 @@ -/* $Id: server.c,v 1.76 2008-06-23 07:41:21 nicm Exp $ */ +/* $Id: server.c,v 1.77 2008-06-29 07:04:30 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -263,7 +263,7 @@ server_fill_windows(struct pollfd **pfd) u_int i; for (i = 0; i < ARRAY_LENGTH(&windows); i++) { - if ((w = ARRAY_ITEM(&windows, i)) == NULL) + if ((w = ARRAY_ITEM(&windows, i)) == NULL || w->fd == -1) (*pfd)->fd = -1; else { (*pfd)->fd = w->fd; @@ -284,7 +284,7 @@ server_handle_windows(struct pollfd **pfd) u_int i; for (i = 0; i < ARRAY_LENGTH(&windows); i++) { - if ((w = ARRAY_ITEM(&windows, i)) != NULL) { + if ((w = ARRAY_ITEM(&windows, i)) != NULL && w->fd != -1) { log_debug("testing window %d (%d)", (*pfd)->fd, w->fd); if (buffer_poll(*pfd, w->in, w->out) != 0) server_lost_window(w); @@ -629,6 +629,11 @@ server_lost_window(struct window *w) log_debug("lost window %d", w->fd); + if (w->flags & WINDOW_ZOMBIFY) { + w->fd = -1; + return; + } + for (i = 0; i < ARRAY_LENGTH(&sessions); i++) { s = ARRAY_ITEM(&sessions, i); if (s == NULL) -- cgit