You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by Ben Laurie <be...@hyperreal.com> on 1996/12/15 16:09:37 UTC
cvs commit: apache/src conf.h http_main.c http_main.h http_protocol.c
ben 96/12/15 07:09:37
Modified: src conf.h http_main.c http_main.h http_protocol.c
Log:
Fix keepalive timeout and waitpid substitutes.
Revision Changes Path
1.60 +0 -1 apache/src/conf.h
Index: conf.h
===================================================================
RCS file: /export/home/cvs/apache/src/conf.h,v
retrieving revision 1.59
retrieving revision 1.60
diff -C3 -r1.59 -r1.60
*** conf.h 1996/12/12 16:45:32 1.59
--- conf.h 1996/12/15 15:09:33 1.60
***************
*** 94,100 ****
#define HAVE_SHMGET
#define HAVE_CRYPT_H
#define NO_LONG_DOUBLE
- #define BROKEN_WAIT
#elif defined(HPUX) || defined(HPUX10)
#define HAVE_SYS_RESOURCE_H
--- 94,99 ----
1.96 +25 -4 apache/src/http_main.c
Index: http_main.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_main.c,v
retrieving revision 1.95
retrieving revision 1.96
diff -C3 -r1.95 -r1.96
*** http_main.c 1996/12/10 01:11:58 1.95
--- http_main.c 1996/12/15 15:09:34 1.96
***************
*** 453,459 ****
}
}
! void hard_timeout (char *name, request_rec *r)
{
timeout_req = r;
timeout_name = name;
--- 453,459 ----
}
}
! void keepalive_timeout (char *name, request_rec *r)
{
timeout_req = r;
timeout_name = name;
***************
*** 465,470 ****
--- 465,479 ----
alarm (r->server->timeout);
}
+ void hard_timeout (char *name, request_rec *r)
+ {
+ timeout_req = r;
+ timeout_name = name;
+
+ signal(SIGALRM,(void (*)())timeout);
+ alarm (r->server->timeout);
+ }
+
void soft_timeout (char *name, request_rec *r)
{
timeout_name = name;
***************
*** 941,962 ****
}
}
! #ifdef BROKEN_WAIT
/*
Some systems appear to fail to deliver dead children to wait() at times.
! This sorts them out.
*/
! void reap_children()
{
int status,n;
for(n=0 ; n < HARD_SERVER_LIMIT ; ++n)
if(scoreboard_image->servers[n].status != SERVER_DEAD
&& waitpid(scoreboard_image->servers[n].pid,&status,WNOHANG) == -1
&& errno == ECHILD)
{
update_child_status(n,SERVER_DEAD,NULL);
}
}
#endif
--- 950,977 ----
}
}
! #if defined(BROKEN_WAIT) || defined(NEED_WAITPID)
/*
Some systems appear to fail to deliver dead children to wait() at times.
! This sorts them out. In fact, this may have been caused by a race condition
! in wait_or_timeout(). But this routine is still useful for systems with no
! waitpid().
*/
! int reap_children()
{
int status,n;
+ int ret=0;
for(n=0 ; n < HARD_SERVER_LIMIT ; ++n)
if(scoreboard_image->servers[n].status != SERVER_DEAD
&& waitpid(scoreboard_image->servers[n].pid,&status,WNOHANG) == -1
&& errno == ECHILD)
{
+ sync_scoreboard_image();
update_child_status(n,SERVER_DEAD,NULL);
+ ret=1;
}
+ return ret;
}
#endif
***************
*** 968,973 ****
--- 983,989 ----
static int wait_or_timeout(int *status)
{
+ #ifndef NEED_WAITPID
int ret;
ret=waitpid(-1,status,WNOHANG);
***************
*** 977,982 ****
--- 993,1003 ----
return -1;
}
return ret;
+ #else
+ if(!reap_children())
+ sleep(1);
+ return -1;
+ #endif
}
#else
1.7 +1 -0 apache/src/http_main.h
Index: http_main.h
===================================================================
RCS file: /export/home/cvs/apache/src/http_main.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -C3 -r1.6 -r1.7
*** http_main.h 1996/12/01 20:28:28 1.6
--- http_main.h 1996/12/15 15:09:34 1.7
***************
*** 86,91 ****
--- 86,92 ----
*/
void hard_timeout (char *, request_rec *);
+ void keepalive_timeout (char *, request_rec *);
void soft_timeout (char *, request_rec *);
void kill_timeout (request_rec *);
void reset_timeout (request_rec *);
1.83 +1 -1 apache/src/http_protocol.c
Index: http_protocol.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_protocol.c,v
retrieving revision 1.82
retrieving revision 1.83
diff -C3 -r1.82 -r1.83
*** http_protocol.c 1996/12/12 00:27:59 1.82
--- http_protocol.c 1996/12/15 15:09:35 1.83
***************
*** 652,658 ****
/* Get the request... */
! hard_timeout ("read", r);
if (!read_request_line (r)) return NULL;
if (!r->assbackwards) get_mime_headers (r);
--- 652,658 ----
/* Get the request... */
! keepalive_timeout ("read", r);
if (!read_request_line (r)) return NULL;
if (!r->assbackwards) get_mime_headers (r);