sixd Thu Aug 28 06:32:52 2008 UTC Modified files: /php-src/ext/oci8 oci8.c Log: Bug #45888 (Refcounting in ZTS mode) http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/oci8.c?r1=1.354&r2=1.355&diff_format=u Index: php-src/ext/oci8/oci8.c diff -u php-src/ext/oci8/oci8.c:1.354 php-src/ext/oci8/oci8.c:1.355 --- php-src/ext/oci8/oci8.c:1.354 Tue Aug 5 20:56:03 2008 +++ php-src/ext/oci8/oci8.c Thu Aug 28 06:32:52 2008 @@ -26,7 +26,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: oci8.c,v 1.354 2008/08/05 20:56:03 pajoye Exp $ */ +/* $Id: oci8.c,v 1.355 2008/08/28 06:32:52 sixd Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -1143,7 +1143,7 @@ #ifdef ZTS zend_hash_apply_with_argument(&EG(regular_list), (apply_func_arg_t) php_oci_list_helper, (void *)le_descriptor TSRMLS_CC); zend_hash_apply_with_argument(&EG(regular_list), (apply_func_arg_t) php_oci_list_helper, (void *)le_collection TSRMLS_CC); - while (OCI_G(num_statements)) { + while (OCI_G(num_statements) > 0) { zend_hash_apply_with_argument(&EG(regular_list), (apply_func_arg_t) php_oci_list_helper, (void *)le_statement TSRMLS_CC); } #endif @@ -1155,7 +1155,9 @@ zend_hash_apply(&EG(persistent_list), (apply_func_t) php_oci_persistent_helper TSRMLS_CC); #ifdef ZTS - zend_hash_apply_with_argument(&EG(regular_list), (apply_func_arg_t) php_oci_list_helper, (void *)le_connection TSRMLS_CC); + while (OCI_G(num_links) > OCI_G(num_persistent)) { + zend_hash_apply_with_argument(&EG(regular_list), (apply_func_arg_t) php_oci_list_helper, (void *)le_connection TSRMLS_CC); + } php_oci_cleanup_global_handles(TSRMLS_C); #endif @@ -1169,7 +1171,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "OCI8 Support", "enabled"); php_info_print_table_row(2, "Version", PHP_OCI8_VERSION); - php_info_print_table_row(2, "Revision", "$Revision: 1.354 $"); + php_info_print_table_row(2, "Revision", "$Revision: 1.355 $"); snprintf(buf, sizeof(buf), "%ld", OCI_G(num_persistent)); php_info_print_table_row(2, "Active Persistent Connections", buf); @@ -1227,6 +1229,7 @@ if (connection) { php_oci_connection_close(connection TSRMLS_CC); OCI_G(num_persistent)--; + OCI_G(num_links)--; } } /* }}} */ @@ -1870,11 +1873,11 @@ if (persistent) { zend_bool alloc_non_persistent = 0; - if (OCI_G(max_persistent)!=-1 && OCI_G(num_persistent)>=OCI_G(max_persistent)) { + if (OCI_G(max_persistent) != -1 && OCI_G(num_persistent) >= OCI_G(max_persistent)) { /* try to find an idle connection and kill it */ zend_hash_apply(&EG(persistent_list), (apply_func_t) php_oci_persistent_helper TSRMLS_CC); - if (OCI_G(max_persistent)!=-1 && OCI_G(num_persistent)>=OCI_G(max_persistent)) { + if (OCI_G(max_persistent) != -1 && OCI_G(num_persistent) >= OCI_G(max_persistent)) { /* all persistent connactions are in use, fallback to non-persistent connection creation */ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Too many open persistent connections (%ld)", OCI_G(num_persistent)); alloc_non_persistent = 1; @@ -1964,6 +1967,7 @@ } zend_hash_update(&EG(persistent_list), connection->hash_key, connection->hash_key_len+1, (void *)&new_le, sizeof(zend_rsrc_list_entry), NULL); OCI_G(num_persistent)++; + OCI_G(num_links)++; } else if (!exclusive) { connection->rsrc_id = zend_list_insert(connection, le_connection); new_le.ptr = (void *)connection->rsrc_id;
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php