wez Fri Oct 4 14:59:34 2002 EDT Modified files: /php4/main streams.c php_streams.h network.c Log: replace dont_block with a flag. Index: php4/main/streams.c diff -u php4/main/streams.c:1.91 php4/main/streams.c:1.92 --- php4/main/streams.c:1.91 Fri Oct 4 14:44:47 2002 +++ php4/main/streams.c Fri Oct 4 14:59:34 2002 @@ -20,7 +20,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: streams.c,v 1.91 2002/10/04 18:44:47 iliaa Exp $ */ +/* $Id: streams.c,v 1.92 2002/10/04 18:59:34 wez Exp $ */ #define _GNU_SOURCE #include "php.h" @@ -497,7 +497,7 @@ stream->writepos += justread; - if (stream->ops->dont_block) + if (stream->flags & PHP_STREAM_FLAG_AVOID_BLOCKING) break; } } Index: php4/main/php_streams.h diff -u php4/main/php_streams.h:1.52 php4/main/php_streams.h:1.53 --- php4/main/php_streams.h:1.52 Fri Oct 4 14:21:40 2002 +++ php4/main/php_streams.h Fri Oct 4 14:59:34 2002 @@ -153,7 +153,6 @@ int (*cast)(php_stream *stream, int castas, void **ret TSRMLS_DC); int (*stat)(php_stream *stream, php_stream_statbuf *ssb TSRMLS_DC); int (*set_option)(php_stream *stream, int option, int value, void *ptrparam TSRMLS_DC); - int dont_block; } php_stream_ops; typedef struct _php_stream_wrapper_ops { @@ -225,6 +224,12 @@ #define PHP_STREAM_FLAG_EOL_UNIX 0 /* also includes DOS */ #define PHP_STREAM_FLAG_DETECT_EOL 4 #define PHP_STREAM_FLAG_EOL_MAC 8 + +/* set this when the stream might represent "interactive" data. + * When set, the read buffer will avoid certain operations that + * might otherwise cause the read to block for much longer than + * is strictly required. */ +#define PHP_STREAM_FLAG_AVOID_BLOCKING 16 struct _php_stream { php_stream_ops *ops; Index: php4/main/network.c diff -u php4/main/network.c:1.71 php4/main/network.c:1.72 --- php4/main/network.c:1.71 Fri Oct 4 14:21:40 2002 +++ php4/main/network.c Fri Oct 4 14:59:34 2002 @@ -16,7 +16,7 @@ | Streams work by Wez Furlong <[EMAIL PROTECTED]> | +----------------------------------------------------------------------+ */ -/* $Id: network.c,v 1.71 2002/10/04 18:21:40 sas Exp $ */ +/* $Id: network.c,v 1.72 2002/10/04 18:59:34 wez Exp $ */ /*#define DEBUG_MAIN_NETWORK 1*/ @@ -542,6 +542,7 @@ sock->socket = socket; stream = php_stream_alloc_rel(&php_stream_socket_ops, sock, persistent_id, "r+"); + stream->flags |= PHP_STREAM_FLAG_AVOID_BLOCKING; if (stream == NULL) pefree(sock, persistent_id ? 1 : 0); @@ -924,7 +925,6 @@ php_sockop_cast, php_sockop_stat, php_sockop_set_option, - 1 };
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php