summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustavo André dos Santos Lopes <cataphract@php.net>2012-02-21 21:55:00 +0000
committerGustavo André dos Santos Lopes <cataphract@php.net>2012-02-21 21:55:00 +0000
commitfc134965c878fc16d40f8004e0d8ec33565affcd (patch)
treee4f0f98da62134ba28a3df7400ed7a277bdbbf3b
parent37272e46def5673492ed926e9631a4e01568e42e (diff)
downloadphp-git-fc134965c878fc16d40f8004e0d8ec33565affcd.tar.gz
- Revert r134029. The streams pooling API was never used in more
than 8 years and therefore unnecessarily adds complexity.
-rw-r--r--main/streams/php_stream_context.h8
-rwxr-xr-xmain/streams/streams.c69
2 files changed, 0 insertions, 77 deletions
diff --git a/main/streams/php_stream_context.h b/main/streams/php_stream_context.h
index 5767b74d26..19acb08441 100644
--- a/main/streams/php_stream_context.h
+++ b/main/streams/php_stream_context.h
@@ -53,7 +53,6 @@ struct _php_stream_notifier {
struct _php_stream_context {
php_stream_notifier *notifier;
zval *options; /* hash keyed by wrapper family or specific wrapper */
- zval *links; /* hash keyed by hostent for connection pooling */
int rsrc_id; /* used for auto-cleanup */
};
@@ -65,13 +64,6 @@ PHPAPI int php_stream_context_get_option(php_stream_context *context,
PHPAPI int php_stream_context_set_option(php_stream_context *context,
const char *wrappername, const char *optionname, zval *optionvalue);
-PHPAPI int php_stream_context_get_link(php_stream_context *context,
- const char *hostent, php_stream **stream);
-PHPAPI int php_stream_context_set_link(php_stream_context *context,
- const char *hostent, php_stream *stream);
-PHPAPI int php_stream_context_del_link(php_stream_context *context,
- php_stream *stream);
-
PHPAPI php_stream_notifier *php_stream_notification_alloc(void);
PHPAPI void php_stream_notification_free(php_stream_notifier *notifier);
END_EXTERN_C()
diff --git a/main/streams/streams.c b/main/streams/streams.c
index 9c7f9a36ed..dd614bbcc9 100755
--- a/main/streams/streams.c
+++ b/main/streams/streams.c
@@ -444,11 +444,6 @@ fprintf(stderr, "stream_free: %s:%p[%s] preserve_handle=%d release_cast=%d remov
while (zend_list_delete(stream->rsrc_id) == SUCCESS) {}
}
- /* Remove stream from any context link list */
- if (stream->context && stream->context->links) {
- php_stream_context_del_link(stream->context, stream);
- }
-
if (close_options & PHP_STREAM_FREE_CALL_DTOR) {
if (release_cast && stream->fclose_stdiocast == PHP_STREAM_FCLOSE_FOPENCOOKIE) {
/* calling fclose on an fopencookied stream will ultimately
@@ -2143,10 +2138,6 @@ PHPAPI void php_stream_context_free(php_stream_context *context)
php_stream_notification_free(context->notifier);
context->notifier = NULL;
}
- if (context->links) {
- zval_ptr_dtor(&context->links);
- context->links = NULL;
- }
efree(context);
}
@@ -2209,66 +2200,6 @@ PHPAPI int php_stream_context_set_option(php_stream_context *context,
}
return zend_hash_update(Z_ARRVAL_PP(wrapperhash), (char*)optionname, strlen(optionname)+1, (void**)&copied_val, sizeof(zval *), NULL);
}
-
-PHPAPI int php_stream_context_get_link(php_stream_context *context,
- const char *hostent, php_stream **stream)
-{
- php_stream **pstream;
-
- if (!stream || !hostent || !context || !(context->links)) {
- return FAILURE;
- }
- if (SUCCESS == zend_hash_find(Z_ARRVAL_P(context->links), (char*)hostent, strlen(hostent)+1, (void**)&pstream)) {
- *stream = *pstream;
- return SUCCESS;
- }
- return FAILURE;
-}
-
-PHPAPI int php_stream_context_set_link(php_stream_context *context,
- const char *hostent, php_stream *stream)
-{
- if (!context) {
- return FAILURE;
- }
- if (!context->links) {
- ALLOC_INIT_ZVAL(context->links);
- array_init(context->links);
- }
- if (!stream) {
- /* Delete any entry for <hostent> */
- return zend_hash_del(Z_ARRVAL_P(context->links), (char*)hostent, strlen(hostent)+1);
- }
- return zend_hash_update(Z_ARRVAL_P(context->links), (char*)hostent, strlen(hostent)+1, (void**)&stream, sizeof(php_stream *), NULL);
-}
-
-PHPAPI int php_stream_context_del_link(php_stream_context *context,
- php_stream *stream)
-{
- php_stream **pstream;
- char *hostent;
- int ret = SUCCESS;
-
- if (!context || !context->links || !stream) {
- return FAILURE;
- }
-
- for(zend_hash_internal_pointer_reset(Z_ARRVAL_P(context->links));
- SUCCESS == zend_hash_get_current_data(Z_ARRVAL_P(context->links), (void**)&pstream);
- zend_hash_move_forward(Z_ARRVAL_P(context->links))) {
- if (*pstream == stream) {
- if (SUCCESS == zend_hash_get_current_key(Z_ARRVAL_P(context->links), &hostent, NULL, 0)) {
- if (FAILURE == zend_hash_del(Z_ARRVAL_P(context->links), (char*)hostent, strlen(hostent)+1)) {
- ret = FAILURE;
- }
- } else {
- ret = FAILURE;
- }
- }
- }
-
- return ret;
-}
/* }}} */
/* {{{ php_stream_dirent_alphasort