diff options
author | Wez Furlong <wez@php.net> | 2002-10-04 18:59:34 +0000 |
---|---|---|
committer | Wez Furlong <wez@php.net> | 2002-10-04 18:59:34 +0000 |
commit | 9c5883bdf658111c389813b6134633c354452a12 (patch) | |
tree | 09fa887ed108646a7d8f0f301d4bde55ebfb79a5 | |
parent | 08645d53c0efa864694eee32fb5f042cc2696e6b (diff) | |
download | php-git-9c5883bdf658111c389813b6134633c354452a12.tar.gz |
replace dont_block with a flag.
-rw-r--r-- | main/network.c | 2 | ||||
-rwxr-xr-x | main/php_streams.h | 7 | ||||
-rwxr-xr-x | main/streams.c | 2 |
3 files changed, 8 insertions, 3 deletions
diff --git a/main/network.c b/main/network.c index fad7e40ff5..14238d9b8d 100644 --- a/main/network.c +++ b/main/network.c @@ -542,6 +542,7 @@ PHPAPI php_stream *_php_stream_sock_open_from_socket(int socket, const char *per 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_stream_ops php_stream_socket_ops = { php_sockop_cast, php_sockop_stat, php_sockop_set_option, - 1 }; diff --git a/main/php_streams.h b/main/php_streams.h index 421dbf2535..3acd52624f 100755 --- a/main/php_streams.h +++ b/main/php_streams.h @@ -153,7 +153,6 @@ typedef struct _php_stream_ops { 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 @@ struct _php_stream_filter { #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; diff --git a/main/streams.c b/main/streams.c index a7cbfc6221..c7ebcf7309 100755 --- a/main/streams.c +++ b/main/streams.c @@ -497,7 +497,7 @@ static void php_stream_fill_read_buffer(php_stream *stream, size_t size TSRMLS_D stream->writepos += justread; - if (stream->ops->dont_block) + if (stream->flags & PHP_STREAM_FLAG_AVOID_BLOCKING) break; } } |