cvs: /php4 main.c /php4/ext/standard basic_functions.c basic_functions.h

From: Date: Sat, 04 Sep 1999 21:10:39 +0000
Subject: cvs: /php4 main.c /php4/ext/standard basic_functions.c basic_functions.h
Groups: php.version4 
Request: Send a blank email to php-version4+get-4093@lists.php.net to get a copy of this message
rasmus Sat Sep 4 17:10:39 1999 EDT Modified files: /php4 main.c /php4/ext/standard basic_functions.c basic_functions.h Log: Catch a timeout and add user-level interface for connection handling Index: php4/main.c diff -u php4/main.c:1.110 php4/main.c:1.111 --- php4/main.c:1.110 Sat Sep 4 16:37:23 1999 +++ php4/main.c Sat Sep 4 17:10:39 1999 @@ -19,7 +19,7 @@ */ -/* $Id: main.c,v 1.110 1999/09/04 20:37:23 rasmus Exp $ */ +/* $Id: main.c,v 1.111 1999/09/04 21:10:39 rasmus Exp $ */ #include <stdio.h> @@ -474,6 +474,7 @@ php_error(E_ERROR, "Maximum execution time of %d second%s exceeded", php_timeout_seconds, php_timeout_seconds == 1 ? "" : "s"); + PG(connection_status) |= PHP_CONNECTION_TIMEOUT; } #endif Index: php4/ext/standard/basic_functions.c diff -u php4/ext/standard/basic_functions.c:1.76 php4/ext/standard/basic_functions.c:1.77 --- php4/ext/standard/basic_functions.c:1.76 Tue Aug 31 11:27:31 1999 +++ php4/ext/standard/basic_functions.c Sat Sep 4 17:10:39 1999 @@ -335,6 +335,11 @@ PHP_FE(array_keys, NULL) PHP_FE(array_values, NULL) + PHP_FE(connection_aborted, NULL) + PHP_FE(connection_timeout, NULL) + PHP_FE(connection_status, NULL) + PHP_FE(ignore_user_abort, NULL) + {NULL, NULL, NULL} }; @@ -2336,6 +2341,58 @@ RETURN_LONG(0); } } + +/* {{{ proto int connection_aborted(void) + Returns true if client disconnected */ +PHP_FUNCTION(connection_aborted) +{ + RETURN_LONG(PG(connection_status)&PHP_CONNECTION_ABORTED); +} +/* }}} */ + +/* {{{ proto int connection_timeout(void) + Returns true if script timed out */ +PHP_FUNCTION(connection_timeout) +{ + + RETURN_LONG(PG(connection_status)&PHP_CONNECTION_TIMEOUT); +} +/* }}} */ + +/* {{{ proto int connection_status(void) + Returns the connection status bitfield */ +PHP_FUNCTION(connection_status) +{ + + RETURN_LONG(PG(connection_status)); +} +/* }}} */ + +/* {{{ proto int ignore_user_abort(boolean value) + Set whether we want to ignore a user abort event or not */ +PHP_FUNCTION(ignore_user_abort) +{ + pval *arg; + int old_setting; + + old_setting = PG(ignore_user_abort); + switch (ARG_COUNT(ht)) { + case 0: + break; + case 1: + if (getParameters(ht,1,&arg) == FAILURE) { + RETURN_FALSE; + } + convert_to_long(arg); + PG(ignore_user_abort)=arg->value.lval; + break; + default: + WRONG_PARAM_COUNT; + break; + } + RETURN_LONG(old_setting); +} +/* }}} */ /* {{{ proto bool function_exists(string function_name) Checks if a given function has been defined */ Index: php4/ext/standard/basic_functions.h diff -u php4/ext/standard/basic_functions.h:1.13 php4/ext/standard/basic_functions.h:1.14 --- php4/ext/standard/basic_functions.h:1.13 Wed Jul 28 13:58:38 1999 +++ php4/ext/standard/basic_functions.h Sat Sep 4 17:10:39 1999 @@ -29,7 +29,7 @@ */ -/* $Id: basic_functions.h,v 1.13 1999/07/28 17:58:38 andi Exp $ */ +/* $Id: basic_functions.h,v 1.14 1999/09/04 21:10:39 rasmus Exp $ */ #ifndef _BASIC_FUNCTIONS_H #define _BASIC_FUNCTIONS_H @@ -122,6 +122,11 @@ PHP_FUNCTION(define); PHP_FUNCTION(defined); + +PHP_FUNCTION(connection_aborted); +PHP_FUNCTION(connection_timeout); +PHP_FUNCTION(connection_status); +PHP_FUNCTION(ignore_user_abort); PHP_FUNCTION(function_exists); PHP_FUNCTION(in_array);

« previous php.version4 (#4093) next »