CVS update: php31/main
| From: | shane | Date: | Fri, 21 Aug 1998 21:00:46 +0000 |
| Subject: | CVS update: php31/main | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-447@lists.php.net to get a copy of this message | ||
Date: Friday August 21, 1998 @ 17:00
Author: shane
Update of /repository/php31/main
In directory asf:/tmp/cvs-serv3295/main
Modified Files:
main.c tls.h
Log Message:
Implement testing to see if the client is still alive. For now, doesnt do
anything other than skiping any attempt to send further info to the client.
Index: php31/main/main.c
diff -c php31/main/main.c:2.19 php31/main/main.c:2.20
*** php31/main/main.c:2.19 Fri Aug 21 16:15:48 1998
--- php31/main/main.c Fri Aug 21 17:00:44 1998
***************
*** 29,35 ****
+----------------------------------------------------------------------+
*/
! /* $Id: main.c,v 2.19 1998/08/21 20:15:48 shane Exp $ */
/* #define CRASH_DETECTION */
--- 29,35 ----
+----------------------------------------------------------------------+
*/
! /* $Id: main.c,v 2.20 1998/08/21 21:00:44 shane Exp $ */
/* #define CRASH_DETECTION */
***************
*** 122,127 ****
--- 122,129 ----
extern FILE *phpin;
php3_ini_structure *php3_ini;
+
+ unsigned int client_alive=1;
#endif /* not THREAD_SAFE */
void _php3_build_argv(char *);
***************
*** 232,257 ****
{
TLS_VARS;
! if (GLOBAL(sapi_rqst)->buffered_output) {
! string_buffer_concat(&GLOBAL(sapi_rqst)->output_buffer, buf, size);
! return size;
! } else {
! return GLOBAL(sapi_rqst)->writeclient(SAPI_GLOBAL_PASS buf,size);
! }
!
}
PHPAPI int php3_sapi_writeclient(void *buf, int size INLINE_TLS)
{
!
if (GLOBAL(sapi_rqst)->buffered_output) {
string_buffer_concat(&GLOBAL(sapi_rqst)->output_buffer, buf, size);
return size;
! } else {
! return GLOBAL(sapi_rqst)->writeclient(SAPI_GLOBAL_PASS buf,size);
}
!
}
PHPAPI int php3_printf(const char *format,...)
{
va_list args;
--- 234,258 ----
{
TLS_VARS;
! return php3_sapi_writeclient(buf, size _INLINE_TLS);
}
PHPAPI int php3_sapi_writeclient(void *buf, int size INLINE_TLS)
{
! int ret;
if (GLOBAL(sapi_rqst)->buffered_output) {
string_buffer_concat(&GLOBAL(sapi_rqst)->output_buffer, buf, size);
return size;
! } else if(GLOBAL(client_alive)){
! if((ret=GLOBAL(sapi_rqst)->writeclient(SAPI_GLOBAL_PASS buf,size))<size)
! GLOBAL(client_alive)=0;
! else
! GLOBAL(client_alive)=1;
! return ret;
}
! return 0;
}
+
PHPAPI int php3_printf(const char *format,...)
{
va_list args;
***************
*** 266,278 ****
/* fix for memory manager shutting down before request is started! */
if(GLOBAL(sapi_rqst)){
#endif
! /*duplicated from php3_write so we can avoid an dditional tls call */
! if (GLOBAL(sapi_rqst)->buffered_output) {
! string_buffer_concat(&GLOBAL(sapi_rqst)->output_buffer, buffer, size);
! ret= size;
! } else {
! ret= GLOBAL(sapi_rqst)->writeclient(SAPI_GLOBAL_PASS buffer,size);
! }
#if DEBUG
}
#endif
--- 267,273 ----
/* fix for memory manager shutting down before request is started! */
if(GLOBAL(sapi_rqst)){
#endif
! ret=php3_sapi_writeclient(buffer, size _INLINE_TLS);
#if DEBUG
}
#endif
***************
*** 407,416 ****
}
return 0;
}
! if (GLOBAL(sapi_rqst)->aborted(SAPI_GLOBAL_PASS_V)) {
GLOBAL(shutdown_requested) = ABNORMAL_SHUTDOWN;
return 0;
}
#ifdef THREAD_SAFE
switch (read_next_token(&GLOBAL(token_cache_manager), &token, phplval, php3_globals,
php_flex_gbl)) {
--- 402,416 ----
}
return 0;
}
!
! /* FIXME? Do we realy want to abort the script if the client is
! no longer alive? That could reek havoc in someone's script.
! for now, letting the script finish.
! if (!GLOBAL(client_alive)) {
GLOBAL(shutdown_requested) = ABNORMAL_SHUTDOWN;
return 0;
}
+ */
#ifdef THREAD_SAFE
switch (read_next_token(&GLOBAL(token_cache_manager), &token, phplval, php3_globals,
php_flex_gbl)) {
***************
*** 498,513 ****
WRONG_PARAM_COUNT;
}
convert_to_long(new_timeout);
! /* FIXME ** This is BAD...in a threaded situation, any user
! can set the timeout for php on a server wide basis.
! INI variables should not be reset via a user script
!
! Fix what? At least on Unix, timers like these are
! per-thread timers. Well, with a little work they will
! be. If we use a bound thread and proper masking it
! should work fine. Is this FIXME a WIN32 problem? Is
! there no way to do per-thread timers on WIN32?
! */
GLOBAL(max_execution_time) = new_timeout->value.lval;
php3_unset_timeout(_INLINE_TLS_VOID);
php3_set_timeout(new_timeout->value.lval _INLINE_TLS);
--- 498,504 ----
WRONG_PARAM_COUNT;
}
convert_to_long(new_timeout);
!
GLOBAL(max_execution_time) = new_timeout->value.lval;
php3_unset_timeout(_INLINE_TLS_VOID);
php3_set_timeout(new_timeout->value.lval _INLINE_TLS);
***************
*** 1589,1594 ****
--- 1580,1586 ----
GLOBAL(php3_display_source) = sapi_info->display_source_mode;
GLOBAL(sapi_rqst) = sapi_info;
GLOBAL(sapi_rqst)->buffered_output = 0;
+ GLOBAL(client_alive)=1;
#if defined(CRASH_DETECTION)
debug_log("%d:enter request startup\n",GetCurrentThreadId());
Index: php31/main/tls.h
diff -c php31/main/tls.h:2.6 php31/main/tls.h:2.7
*** php31/main/tls.h:2.6 Thu Aug 20 21:21:38 1998
--- php31/main/tls.h Fri Aug 21 17:00:44 1998
***************
*** 112,117 ****
--- 112,118 ----
int module_count;
int current_module_being_cleaned;
/*main.c*/
+ unsigned int client_alive;
php3_ini_structure *php3_ini;
unsigned int max_execution_time;
int error_reporting;
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net