manoj 99/05/19 22:00:42
Modified: pthreads/src/main http_accept.c Log: Another cleanup. Get rid of an if (1) that was left around to make a different patch look small. Revision Changes Path 1.14 +49 -60 apache-apr/pthreads/src/main/http_accept.c Index: http_accept.c =================================================================== RCS file: /home/cvs/apache-apr/pthreads/src/main/http_accept.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -u -r1.13 -r1.14 --- http_accept.c 1999/05/20 04:48:39 1.13 +++ http_accept.c 1999/05/20 05:00:41 1.14 @@ -399,72 +399,61 @@ if (workers_may_exit) break; - /* XXX - Yes, we always go through the poll, at least for now. - * - mvsk - */ - if (1) { - /* more than one socket */ - srv = poll(listenfds, num_listenfds + 1, -1); - if (workers_may_exit) - break; - if (srv < 0) { - /* XXX - hmmmm, poll can return EINTR. - mvsk */ - if (errno == EINTR) { - continue; - } - SAFE_ACCEPT(accept_mutex_off(0)); - SAFE_ACCEPT(intra_mutex_off(0)); - /* Single Unix documents select as returning errnos - * EBADF, EINTR, and EINVAL... and in none of those - * cases does it make sense to continue. In fact - * on Linux 2.0.x we seem to end up with EFAULT - * occasionally, and we'd loop forever due to it. - */ - ap_log_error(APLOG_MARK, APLOG_ERR, (const server_rec*) ap_get_server_conf(), "select: (listen)"); - clean_child_exit(1); - } - - if (srv == 0) { - /* Is srv == 0 a valid return? */ + srv = poll(listenfds, num_listenfds + 1, -1); + if (workers_may_exit) + break; + if (srv < 0) { + /* XXX - hmmmm, poll can return EINTR. - mvsk */ + if (errno == EINTR) { continue; + } + SAFE_ACCEPT(accept_mutex_off(0)); + SAFE_ACCEPT(intra_mutex_off(0)); + /* Single Unix documents select as returning errnos + * EBADF, EINTR, and EINVAL... and in none of those + * cases does it make sense to continue. In fact + * on Linux 2.0.x we seem to end up with EFAULT + * occasionally, and we'd loop forever due to it. + */ + ap_log_error(APLOG_MARK, APLOG_ERR, (const server_rec*) ap_get_server_conf(), "select: (listen)"); + clean_child_exit(1); + } + + if (srv == 0) { + /* Is srv == 0 a valid return? */ + continue; } - /* find a listener */ - /* Loop or NULL terminated list? That is the question. Be consistent across - all the accept techniques */ - lr = head_listener; - do { - /* XXX: should we check for PR_POLL_ERR ?? */ - if (listenfds[lr->index].revents & POLLIN) { - /* advance to the next listener for next loop */ - head_listener = lr->next; - /* hack to handle listenfds being NULL terminated list - * rather than a loop - */ - if (!head_listener) { - head_listener = ap_listeners; - } - goto got_lr; + /* find a listener */ + /* Loop or NULL terminated list? That is the question. Be consistent across + all the accept techniques */ + lr = head_listener; + do { + /* XXX: should we check for PR_POLL_ERR ?? */ + if (listenfds[lr->index].revents & POLLIN) { + /* advance to the next listener for next loop */ + head_listener = lr->next; + /* hack to handle listenfds being NULL terminated list + * rather than a loop + */ + if (!head_listener) { + head_listener = ap_listeners; } - lr = lr->next; - if (lr == NULL) { + goto got_lr; + } + lr = lr->next; + if (lr == NULL) { lr = ap_listeners; - } - } while (lr != head_listener); - - /* if we don't find anything then just start again */ - fprintf(stderr,"poll returned but we got nothing!\n"); - head_listener = ap_listeners; - continue; - - got_lr: - sd = lr->fd; - } - else { - /* only one socket, just pretend we did the other stuff */ - sd = ap_listeners->fd; - } + } + } while (lr != head_listener); + /* if we don't find anything then just start again */ + fprintf(stderr,"poll returned but we got nothing!\n"); + head_listener = ap_listeners; + continue; + + got_lr: + sd = lr->fd; csd = accept(sd, sa_client, &len); requests_this_child--;