projects
/
m6w6
/
ext-raphf
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
|
github
raw
|
patch
|
inline
| side by side (parent:
8ea73a5
)
fixed pointless initialization of persistent handles lists on cleanup
author
Michael Wallner
<mike@php.net>
Thu, 28 Apr 2016 07:27:44 +0000
(09:27 +0200)
committer
Michael Wallner
<mike@php.net>
Thu, 28 Apr 2016 07:28:38 +0000
(09:28 +0200)
package.xml
patch
|
blob
|
history
src/php_raphf_api.c
patch
|
blob
|
history
tests/http001.phpt
patch
|
blob
|
history
tests/http002.phpt
patch
|
blob
|
history
tests/http003.phpt
patch
|
blob
|
history
tests/http004.phpt
patch
|
blob
|
history
diff --git
a/package.xml
b/package.xml
index e86d88731eb60ef2e66c563a7ed98fe2fdfe7ea9..d4cf12adeb599100053e5129367fec94c98ce649 100644
(file)
--- a/
package.xml
+++ b/
package.xml
@@
-19,7
+19,7
@@
http://pear.php.net/dtd/package-2.0.xsd">
<email>mike@php.net</email>
<active>yes</active>
</lead>
<email>mike@php.net</email>
<active>yes</active>
</lead>
- <date>2016-0
1-19
</date>
+ <date>2016-0
4-28
</date>
<version>
<release>2.0.1dev</release>
<api>2.0.0</api>
<version>
<release>2.0.1dev</release>
<api>2.0.0</api>
@@
-30,7
+30,7
@@
http://pear.php.net/dtd/package-2.0.xsd">
</stability>
<license>BSD, revised</license>
<notes><![CDATA[
</stability>
<license>BSD, revised</license>
<notes><![CDATA[
-*
+*
Fixed pointless initialization of persistent handles lists on cleanup
]]></notes>
<contents>
<dir name="/">
]]></notes>
<contents>
<dir name="/">
diff --git
a/src/php_raphf_api.c
b/src/php_raphf_api.c
index f867af6d7a13137f17fad2d40d69a542ceb94e10..b256e4714d3b08739e120e33c3441b1097f31825 100644
(file)
--- a/
src/php_raphf_api.c
+++ b/
src/php_raphf_api.c
@@
-243,7
+243,8
@@
static int php_persistent_handle_list_apply_dtor(zval *p, void *provider)
}
static inline php_persistent_handle_list_t *php_persistent_handle_list_find(
}
static inline php_persistent_handle_list_t *php_persistent_handle_list_find(
- php_persistent_handle_provider_t *provider, zend_string *ident)
+ php_persistent_handle_provider_t *provider, zend_string *ident,
+ zend_bool create)
{
php_persistent_handle_list_t *list;
zval *zlist = zend_symtable_find(&provider->list.free, ident);
{
php_persistent_handle_list_t *list;
zval *zlist = zend_symtable_find(&provider->list.free, ident);
@@
-255,7
+256,7
@@
static inline php_persistent_handle_list_t *php_persistent_handle_list_find(
return list;
}
return list;
}
- if ((list = php_persistent_handle_list_init(NULL))) {
+ if (
create &&
(list = php_persistent_handle_list_init(NULL))) {
zval p, *rv;
zend_string *id;
zval p, *rv;
zend_string *id;
@@
-284,7
+285,7
@@
static int php_persistent_handle_apply_cleanup_all(zval *p, int argc,
php_persistent_handle_list_t *list;
if (ident && ident->len) {
php_persistent_handle_list_t *list;
if (ident && ident->len) {
- if ((list = php_persistent_handle_list_find(provider, ident))) {
+ if ((list = php_persistent_handle_list_find(provider, ident
, 0
))) {
zend_hash_apply_with_argument(&list->free,
php_persistent_handle_apply_cleanup_ex,
&provider->rf);
zend_hash_apply_with_argument(&list->free,
php_persistent_handle_apply_cleanup_ex,
&provider->rf);
@@
-394,7
+395,7
@@
void *php_persistent_handle_acquire(php_persistent_handle_factory_t *a, void *in
void *handle = NULL;
php_persistent_handle_list_t *list;
void *handle = NULL;
php_persistent_handle_list_t *list;
- list = php_persistent_handle_list_find(a->provider, a->ident);
+ list = php_persistent_handle_list_find(a->provider, a->ident
, 1
);
if (list) {
zend_hash_internal_pointer_end(&list->free);
key = zend_hash_get_current_key(&list->free, NULL, &index);
if (list) {
zend_hash_internal_pointer_end(&list->free);
key = zend_hash_get_current_key(&list->free, NULL, &index);
@@
-427,7
+428,7
@@
void *php_persistent_handle_accrete(php_persistent_handle_factory_t *a, void *ha
new_handle = php_resource_factory_handle_copy(&a->provider->rf, handle);
if (handle) {
new_handle = php_resource_factory_handle_copy(&a->provider->rf, handle);
if (handle) {
- list = php_persistent_handle_list_find(a->provider, a->ident);
+ list = php_persistent_handle_list_find(a->provider, a->ident
, 1
);
if (list) {
++list->used;
}
if (list) {
++list->used;
}
@@
-441,7
+442,7
@@
void php_persistent_handle_release(php_persistent_handle_factory_t *a, void *han
{
php_persistent_handle_list_t *list;
{
php_persistent_handle_list_t *list;
- list = php_persistent_handle_list_find(a->provider, a->ident);
+ list = php_persistent_handle_list_find(a->provider, a->ident
, 1
);
if (list) {
if (a->provider->list.used >= PHP_RAPHF_G->persistent_handle.limit) {
#if PHP_RAPHF_DEBUG_PHANDLES
if (list) {
if (a->provider->list.used >= PHP_RAPHF_G->persistent_handle.limit) {
#if PHP_RAPHF_DEBUG_PHANDLES
@@
-471,7
+472,7
@@
void php_persistent_handle_cleanup(zend_string *name, zend_string *ident)
if (zprovider && (provider = Z_PTR_P(zprovider))) {
if (ident) {
if (zprovider && (provider = Z_PTR_P(zprovider))) {
if (ident) {
- list = php_persistent_handle_list_find(provider, ident);
+ list = php_persistent_handle_list_find(provider, ident
, 0
);
if (list) {
zend_hash_apply_with_argument(&list->free,
php_persistent_handle_apply_cleanup_ex,
if (list) {
zend_hash_apply_with_argument(&list->free,
php_persistent_handle_apply_cleanup_ex,
diff --git
a/tests/http001.phpt
b/tests/http001.phpt
index e79f5b429756f5d9a34c2104d13ba681eb0314df..8c578aefedf25111abaea585a3389cd137aa0cec 100644
(file)
--- a/
tests/http001.phpt
+++ b/
tests/http001.phpt
@@
-16,7
+16,7
@@
echo "Test\n";
$h = (array) raphf\stat_persistent_handles();
var_dump(array_intersect_key($h, array_flip(preg_grep("/^http/", array_keys($h)))));
$h = (array) raphf\stat_persistent_handles();
var_dump(array_intersect_key($h, array_flip(preg_grep("/^http/", array_keys($h)))));
-$c = new http\Client("curl", "
php.net:80
");
+$c = new http\Client("curl", "
PHP
");
do {
$c->enqueue(new http\Client\Request("GET", "http://php.net"));
} while (count($c) < 3);
do {
$c->enqueue(new http\Client\Request("GET", "http://php.net"));
} while (count($c) < 3);
@@
-44,7
+44,7
@@
array(2) {
array(2) {
["http\Client\Curl"]=>
array(1) {
array(2) {
["http\Client\Curl"]=>
array(1) {
- ["
php.net:80
"]=>
+ ["
PHP
"]=>
array(2) {
["used"]=>
int(1)
array(2) {
["used"]=>
int(1)
@@
-54,7
+54,7
@@
array(2) {
}
["http\Client\Curl\Request"]=>
array(1) {
}
["http\Client\Curl\Request"]=>
array(1) {
- ["php.net:80"]=>
+ ["
PHP:
php.net:80"]=>
array(2) {
["used"]=>
int(3)
array(2) {
["used"]=>
int(3)
@@
-66,7
+66,7
@@
array(2) {
array(2) {
["http\Client\Curl"]=>
array(1) {
array(2) {
["http\Client\Curl"]=>
array(1) {
- ["
php.net:80
"]=>
+ ["
PHP
"]=>
array(2) {
["used"]=>
int(0)
array(2) {
["used"]=>
int(0)
@@
-76,7
+76,7
@@
array(2) {
}
["http\Client\Curl\Request"]=>
array(1) {
}
["http\Client\Curl\Request"]=>
array(1) {
- ["php.net:80"]=>
+ ["
PHP:
php.net:80"]=>
array(2) {
["used"]=>
int(0)
array(2) {
["used"]=>
int(0)
diff --git
a/tests/http002.phpt
b/tests/http002.phpt
index 505adc575e54b1283db610179f85d07b734fe89e..e9a59667f1385a3038db1af71395e29264b79643 100644
(file)
--- a/
tests/http002.phpt
+++ b/
tests/http002.phpt
@@
-13,7
+13,7
@@
if (!class_exists("http\\Client", false)) {
<?php
echo "Test\n";
<?php
echo "Test\n";
-$c = new http\Client("curl", "
php.net:80
");
+$c = new http\Client("curl", "
PHP
");
do {
$c->enqueue(new http\Client\Request("GET", "http://php.net"));
} while (count($c) < 3);
do {
$c->enqueue(new http\Client\Request("GET", "http://php.net"));
} while (count($c) < 3);
@@
-25,7
+25,7
@@
var_dump(array_intersect_key($h, array_flip(preg_grep("/^http/", array_keys($h))
raphf\clean_persistent_handles("http\\Client\\Curl");
raphf\clean_persistent_handles("http\\Client\\Curl");
-raphf\clean_persistent_handles("http\\Client\\Curl\\Request", "php.net:80");
+raphf\clean_persistent_handles("http\\Client\\Curl\\Request", "
PHP:
php.net:80");
$h = (array) raphf\stat_persistent_handles();
var_dump(array_intersect_key($h, array_flip(preg_grep("/^http/", array_keys($h)))));
$h = (array) raphf\stat_persistent_handles();
var_dump(array_intersect_key($h, array_flip(preg_grep("/^http/", array_keys($h)))));
@@
-37,7
+37,7
@@
Test
array(2) {
["http\Client\Curl"]=>
array(1) {
array(2) {
["http\Client\Curl"]=>
array(1) {
- ["
php.net:80
"]=>
+ ["
PHP
"]=>
array(2) {
["used"]=>
int(0)
array(2) {
["used"]=>
int(0)
@@
-47,7
+47,7
@@
array(2) {
}
["http\Client\Curl\Request"]=>
array(1) {
}
["http\Client\Curl\Request"]=>
array(1) {
- ["php.net:80"]=>
+ ["
PHP:
php.net:80"]=>
array(2) {
["used"]=>
int(0)
array(2) {
["used"]=>
int(0)
@@
-62,7
+62,7
@@
array(2) {
}
["http\Client\Curl\Request"]=>
array(1) {
}
["http\Client\Curl\Request"]=>
array(1) {
- ["php.net:80"]=>
+ ["
PHP:
php.net:80"]=>
array(2) {
["used"]=>
int(0)
array(2) {
["used"]=>
int(0)
diff --git
a/tests/http003.phpt
b/tests/http003.phpt
index 50dbb1c4a52fb5f84511c02ad0f1f6199ba2e274..671b8d4ce9bd11f5bc8ca557f12688a142fcb0a6 100644
(file)
--- a/
tests/http003.phpt
+++ b/
tests/http003.phpt
@@
-13,7
+13,7
@@
if (!class_exists("http\\Client", false)) {
<?php
echo "Test\n";
<?php
echo "Test\n";
-$c = new http\Client("curl", "
php.net:80
");
+$c = new http\Client("curl", "
PHP
");
do {
$c->enqueue(new http\Client\Request("GET", "http://php.net"));
} while (count($c) < 3);
do {
$c->enqueue(new http\Client\Request("GET", "http://php.net"));
} while (count($c) < 3);
@@
-23,7
+23,8
@@
unset($c);
$h = (array) raphf\stat_persistent_handles();
var_dump(array_intersect_key($h, array_flip(preg_grep("/^http/", array_keys($h)))));
$h = (array) raphf\stat_persistent_handles();
var_dump(array_intersect_key($h, array_flip(preg_grep("/^http/", array_keys($h)))));
-raphf\clean_persistent_handles(null, "php.net:80");
+raphf\clean_persistent_handles(null, "PHP");
+raphf\clean_persistent_handles(null, "PHP:php.net:80");
$h = (array) raphf\stat_persistent_handles();
var_dump(array_intersect_key($h, array_flip(preg_grep("/^http/", array_keys($h)))));
$h = (array) raphf\stat_persistent_handles();
var_dump(array_intersect_key($h, array_flip(preg_grep("/^http/", array_keys($h)))));
@@
-35,7
+36,7
@@
Test
array(2) {
["http\Client\Curl"]=>
array(1) {
array(2) {
["http\Client\Curl"]=>
array(1) {
- ["
php.net:80
"]=>
+ ["
PHP
"]=>
array(2) {
["used"]=>
int(0)
array(2) {
["used"]=>
int(0)
@@
-45,7
+46,7
@@
array(2) {
}
["http\Client\Curl\Request"]=>
array(1) {
}
["http\Client\Curl\Request"]=>
array(1) {
- ["php.net:80"]=>
+ ["
PHP:
php.net:80"]=>
array(2) {
["used"]=>
int(0)
array(2) {
["used"]=>
int(0)
@@
-57,7
+58,7
@@
array(2) {
array(2) {
["http\Client\Curl"]=>
array(1) {
array(2) {
["http\Client\Curl"]=>
array(1) {
- ["
php.net:80
"]=>
+ ["
PHP
"]=>
array(2) {
["used"]=>
int(0)
array(2) {
["used"]=>
int(0)
@@
-67,7
+68,7
@@
array(2) {
}
["http\Client\Curl\Request"]=>
array(1) {
}
["http\Client\Curl\Request"]=>
array(1) {
- ["php.net:80"]=>
+ ["
PHP:
php.net:80"]=>
array(2) {
["used"]=>
int(0)
array(2) {
["used"]=>
int(0)
diff --git
a/tests/http004.phpt
b/tests/http004.phpt
index 7077cbdb533c578a742c58ab24293a808756a05c..0e677f29aaf567ee528dd0f8befe29c727b5da75 100644
(file)
--- a/
tests/http004.phpt
+++ b/
tests/http004.phpt
@@
-16,8
+16,8
@@
echo "Test\n";
$h = (array) raphf\stat_persistent_handles();
var_dump(array_intersect_key($h, array_flip(preg_grep("/^http/", array_keys($h)))));
$h = (array) raphf\stat_persistent_handles();
var_dump(array_intersect_key($h, array_flip(preg_grep("/^http/", array_keys($h)))));
-$c = new http\Client("curl", "
php.net:80
");
-$c2 = new http\Client("curl", "
php.net:80
");
+$c = new http\Client("curl", "
PHP
");
+$c2 = new http\Client("curl", "
PHP
");
do {
$c->enqueue(new http\Client\Request("GET", "http://php.net"));
$c2->enqueue(new http\Client\Request("GET", "http://php.net"));
do {
$c->enqueue(new http\Client\Request("GET", "http://php.net"));
$c2->enqueue(new http\Client\Request("GET", "http://php.net"));
@@
-51,7
+51,7
@@
array(2) {
array(2) {
["http\Client\Curl"]=>
array(1) {
array(2) {
["http\Client\Curl"]=>
array(1) {
- ["
php.net:80
"]=>
+ ["
PHP
"]=>
array(2) {
["used"]=>
int(2)
array(2) {
["used"]=>
int(2)
@@
-61,7
+61,7
@@
array(2) {
}
["http\Client\Curl\Request"]=>
array(1) {
}
["http\Client\Curl\Request"]=>
array(1) {
- ["php.net:80"]=>
+ ["
PHP:
php.net:80"]=>
array(2) {
["used"]=>
int(6)
array(2) {
["used"]=>
int(6)
@@
-73,7
+73,7
@@
array(2) {
array(2) {
["http\Client\Curl"]=>
array(1) {
array(2) {
["http\Client\Curl"]=>
array(1) {
- ["
php.net:80
"]=>
+ ["
PHP
"]=>
array(2) {
["used"]=>
int(1)
array(2) {
["used"]=>
int(1)
@@
-83,7
+83,7
@@
array(2) {
}
["http\Client\Curl\Request"]=>
array(1) {
}
["http\Client\Curl\Request"]=>
array(1) {
- ["php.net:80"]=>
+ ["
PHP:
php.net:80"]=>
array(2) {
["used"]=>
int(3)
array(2) {
["used"]=>
int(3)
@@
-95,7
+95,7
@@
array(2) {
array(2) {
["http\Client\Curl"]=>
array(1) {
array(2) {
["http\Client\Curl"]=>
array(1) {
- ["
php.net:80
"]=>
+ ["
PHP
"]=>
array(2) {
["used"]=>
int(1)
array(2) {
["used"]=>
int(1)
@@
-105,7
+105,7
@@
array(2) {
}
["http\Client\Curl\Request"]=>
array(1) {
}
["http\Client\Curl\Request"]=>
array(1) {
- ["php.net:80"]=>
+ ["
PHP:
php.net:80"]=>
array(2) {
["used"]=>
int(3)
array(2) {
["used"]=>
int(3)